Playback WAV files
This sketch shows how to playback audio samples from a buffer.
An audio file is loaded into a buffer
gSampleData. This is accessed with a read pointer that is incremented at audio rate within the render function:
out += gSampleData.samples[gReadPtr++].
Note that the read pointer is stopped from incrementing past the length of the
gSampleData. This is achieved by comparing the read pointer value against the sample length which we can access as follows:
The sample is triggered by keyboard input: (a) starts sample playback, (s) stops sample playback. The triggering is treated as a lower priority task than the audio. You can see this at the bottom of the render function:
Generated on Mon Nov 11 2019 06:29:50 for Bela by 1.8.11