Fast audio Playback for Drum Machine
I am trying to build a drum machine. I have a PCM5102 I2C board, an ESP32 Wroom, and a SD card to hold the wav files.
I want to be able to play short drum samples in quick succession.
What Structure should I use?
I played around with the Mixer example, but sadly it has some weird artifacts when mixing two samples. I also tried to just play / stop one sample, but at slightly higher bpm this does not work either.
My Structure for Mixing was: AudioFileSourceFS -> AudioGeneratorWAV -\ | -> AudioOutputMixerStub -> AudioOutputMixer -> AudioOutputI2S AudioFileSourceFS -> AudioGeneratorWAV -/
Then I switched to just Start/Stop: AudioFileSourceFS -> AudioGeneratorWAV -> AudioOutputI2S
I always had to reload the File, because playing the Audio and then closing the AudioGeneratorWAV closed the file. I think for my purpose it would be nice, to load the whole rather short wav into Ram and then Play it fast from there. File Size on the SD card is about 10-100KB which should fit into the 520KB of SRAM. I tried using the AudioFileSourceBuffer, but had no luck.
Kind Regards Alex