AnsweredAssumed Answered

STM32F4 Simple Audio Processing Using Record and Playback Example

Question asked by singh.savi on Apr 15, 2014
Latest reply on Apr 15, 2014 by singh.savi
Hey all,

I'm working on a project where I have to process an audio signal in a few different ways. However, I have never done anything of the sort. I have been reading up into how to implement basics such as band pass filters and such in C, but am lost as to how to actually implement it.

I have been using the ST provided Audio Playback and Record example to play a .WAV file from a USB drive. I was going through the "waveplayer.c" file and noticed where the data from the USB is stored into a buffer, and was wondering if I could grab that signal, process it, and then store it into the buffer. The part of the code I am referring to is: 

if(buffer_switch == 0)
        /* Play data from buffer1 */
        Audio_MAL_Play((uint32_t)buffer1, _MAX_SS);
        /* Store data in buffer2 */
        f_read (&fileR, buffer2, _MAX_SS, &BytesRead);
        buffer_switch = 1;
        /* Play data from buffer2 */
        Audio_MAL_Play((uint32_t)buffer2, _MAX_SS);
        /* Store data in buffer1 */
        f_read (&fileR, buffer1, _MAX_SS, &BytesRead);
        buffer_switch = 0;

Could I take the data stored into the buffer, by "f_read", and process it as required before storing it in the buffer? If so, can anyone provide a quick high level example? As I mentioned I've never done anything of this sort before and am stuck as to where to start. If there is a better method, using this example, please explain it to me.

I am using the STM32F4 Discovery board with IAR Embedded Workbench IDE.

Thanks for the help!