Kxx Mp3/audio player for sample playback and mixing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Kxx Mp3/audio player for sample playback and mixing

1,336 Views
crezyoz
Contributor IV

I have to create a device which will play back short audio samples and mix them depending on the amplitude of an incoming signal. I would be mixing samples form flash. Fairly simple, I suppose?

I need to work with 44.1 or 48 Khz samples, mixing only two at a time from banks of multiple samples in flash.

Are there existing designs and code I can take a look at that might help me?

Labels (1)
Tags (4)
0 Kudos
6 Replies

915 Views
oleglavrukhin
Contributor IV

Hi, Phil!

if you write a function which mixing samples and put it into buffer, i can give you my variant of software MP3 decoder for play this mix buffer from flash. my project for MQX 4.1, but it simply to ported for no-OS project.

regards,

Oleg

0 Kudos

915 Views
crezyoz
Contributor IV

That sounds great. I am just beginning to research which MPU to use for this project. I have coded for the K20/K70 in the past so I would be happy to stay with them. But I haven't done any audio work yet with them. So I am trying to familiarize myself with how it might be done on the Kxx series. Very interested in seeing your project though.

Thank you.

Phil

0 Kudos

915 Views
oleglavrukhin
Contributor IV

projects for IAR 7.2 and MQX4.1.

in workspace 2 projects:

1) decode mp3 file from flash and save result in USB stick in PCM format (44100, 16 bit). i use this program for test how decoder works. for play this WAV file via any mediaplayer (VLC or other) you must ADD wav header. I use HexEdit . Just open this file (convert.wav) and any wav file with header (you can convert you favorite MP3 in WAV format (44100, 16 bit) via online converter) in Hexedit and copy-paste first 3 lines from full file into converted file. You can use this for test how decoded you mixing data without connect any external devices(DAC etc).

2) decode mp3 file from flash and play via external DAC (CS4350). this project use same functions, but added SAI and DAC drivers and have a change in output function.

good luck!

0 Kudos

915 Views
crezyoz
Contributor IV

Thank you Oleg. What I am looking for is some example of how to setup the DMA / buffers / I2s output, etc for playing PCM audio files (44.1 / 48) out of a K70 with a NAND flash setup. I  am targeting the K20 for the production but I have a K70 tower setup and I thought I might try doing a proof of concept with that.

I am using the Kinetis Design Studio ( i hope it works better than the CodeWarrior IDE I used for a couple of projects in 2012. )

0 Kudos

915 Views
isaacavila
NXP Employee
NXP Employee

Hi Phil,

There is a good example of recording and playing audio using dma and i2s drivers (It stores recorded audio in SD card and playback it from SD as well), but it is made using MQX.

you can check it at:

C:\Freescale\Freescale_MQX_4_2\mqx\examples\sai_dma_demo.

You can see there is an available example for TWR-K70 in KDS.

There is also a community post where baremetal code is used for TWR-K60D100M (However it is made in CodeWarrior, but it can serve as guidance), you should look at this:

https://community.freescale.com/message/81904#81904

Hope this could serve.

Regards,

Isaac Avila

0 Kudos

915 Views
crezyoz
Contributor IV

Thank you Isaac. Much appreciated. I suppose using MQX wouldn't be that problematic.

Phil

0 Kudos