7 years, 8 months ago.

Multiple *.wav playback from SD CARD?

Hi I am trying to play 2 wave files from the sd card simultaneously, but i dont have clue how to do it with the current file library. I already managed to output one wave file with my DAC but trying to open second one intrudices delay and looses the point state that the first file have reached. Did somebody have solution for this or can just guide me how to proceed with my code design? I will be really greatfull for a tested working algorithm for that Regards, Boyko

Personally I don't think I can be that much help, but for sure it helps if you give more information. Which code do you use? (If it is short, copy paste it here between code tags, otherwise publish it and link it). Which setup do you use? For example your LPC1768 only has one DAC, so do you use an external one?

posted by Erik - 03 Dec 2013

2 Answers

7 years, 8 months ago.

In theory you should be able to take the sample from each file add them together and do a bitshift (divide by 2). That is assuming that the bitrates are the same and the hardware is fast enough to read both files before you have to hand everything over to the DAC to do it's magic.

7 years, 8 months ago.

I have one external 16bit DAC to the SPI0 and SD card to the other. I set one timer interrupt with the sample rate of the Wav file to send the dac samples, and one main loop which feeds a ring buffer. The Most complicated part for me is which sd/fat library to use which is able to open two file instances( the one I have is ported and can only open one instance.) and to be fast and optimized for performance at the same time. Because besides the playback the cpu must do other small calculations. Regards, Boyko