Hi,
I'm working at a project that requires to play very short sound-samples (200-300ms) one after another with (nearly) no gap.
My Dad buit an RC-controlled excavator (Fuchs 301 see here in original) for which I now want to do the sound-module. Therefore we have several sound-samples of the original motor used in this excavator at different loads (~10 samples). Each sample is about 250ms long and has only a few turns of the motor. The idea now is to measure the current used by the motors, decide which of the sample is needed and then play this, but of course wait until the previos sound ended. The sounds are not all from the same length, because with higher rotational speeds they are getting shorter.
Because the sounds are so short I converted them with WAV2Sketch and imported them into my program. This already works and I can play the Sounds.
But what I don't like is that I have to check with isPlaying() if a file is still running. Because then I automatically have a short gap to the next sound.
Is there any other solution you could imagine?
Some thoughts of me:
Sorry for all this (perhaps stupid) questions.
It would be great if you could give me some hints how you would solve this.
I can program in C# and Basic, but I have only little experience in C(++) and Arduino.
Greetings
Marius
PS: Sorry for my English, because my native language is german.
I'm working at a project that requires to play very short sound-samples (200-300ms) one after another with (nearly) no gap.
My Dad buit an RC-controlled excavator (Fuchs 301 see here in original) for which I now want to do the sound-module. Therefore we have several sound-samples of the original motor used in this excavator at different loads (~10 samples). Each sample is about 250ms long and has only a few turns of the motor. The idea now is to measure the current used by the motors, decide which of the sample is needed and then play this, but of course wait until the previos sound ended. The sounds are not all from the same length, because with higher rotational speeds they are getting shorter.
Because the sounds are so short I converted them with WAV2Sketch and imported them into my program. This already works and I can play the Sounds.
But what I don't like is that I have to check with isPlaying() if a file is still running. Because then I automatically have a short gap to the next sound.
Is there any other solution you could imagine?
Some thoughts of me:
- Because I exactly know how long the sound sample is, i also know when I have to start the next sound, but how can I use this in my program? Because the calculation of the next sound is varying in time
- Could I perhaps use a AudioPlayQueue and load the data from my samples in there? Then I could possibly realize ZERO gap, by loading directly the bytes of the next sound, but I found no example how to do this
- Should I use two AudioPlayMemory and "preload" the second one with the next sound
Sorry for all this (perhaps stupid) questions.
It would be great if you could give me some hints how you would solve this.
I can program in C# and Basic, but I have only little experience in C(++) and Arduino.
Greetings
Marius
PS: Sorry for my English, because my native language is german.