On AudioPlaySdWav to play drum machine samples

Status
Not open for further replies.

lodevalm

Member
Hello,

this is my first post here.

I'm involved in the developing a drum machine using a teensy 3.6 and I have a question on which is the best way in terms of performance to play samples before start testing on the board.

My task is to fill an SD card with several samples and every drum part reads the related sample, for instance bd.wav, sn.wav hh.wav and so on.

I've found that there are several ways to play samples and the one "out of the box" of the Audio library that do the task seems to be AudioPlaySdWav
Then I've read the code of the object and if I'm not wrong, every time the sound is triggered with play(filename), it is forced to reload the file from SD.

I don't know if this introduces latency or overheads but what I'm thinking is that reading the file one time and then keeping the data in memory could have better performances.

Then I'm in front of a juncture:
1. Develop a new object like AudioPlaySdWav but that stores the file data in memory and then plays without reloading it
2. Develop a wav file parser, like the tool used by the wav2sketch utility and then use it to load the wav data in memory and then use the AudioPlayMemory to play back the data.

Does anybody of you have some experience on this subject and could give me some advices?

Thanks!
 
Hi,
There's a similar thread here that may help you. What I would advise you to do is first try things the easiest way using the audio library to play samples directly from the SD card. If you find that you can't play enough simultaneously for what you want (which will partly depend on how long the samples are), then the next step will depend on how much space the samples will require.
 
Status
Not open for further replies.
Back
Top