Closed Probeat closed 2 years ago
Sorry for the late reply. The general approach to achieve what you want to do is to just copy as many samples to the buffer as the current buffer expects. Then copy the next chunk if samples from your file in the next audio callback.
@Probeat: rather than buffer an entire audio file into memory yourself you could leverage a realtime player to keep track of position as you play it back in the manner @fgo-ableton suggested above. For example you could use a player from Superpowered SDK.
Sorry for possible nubie question, but I have some trouble with understanding starter example. To best understand the example I tried to change simple sin signal at
renderMetronomeIntoBuffer
to some wav file from asset - so we will have to play wav file on each beat.I read my wav file to array of <float, float>, where first value is time from wav and second is float value. How can I fill that data to buffer at renderMetronomeIntoBuffer ? If my understanding is correct I need to
encrease bufferSize by some init settings (???) because 512 is too small for any even simple wav, but good enough for sin signal
choose float values from my wav array more closely to secondsAfterClick ?
Are my suggestions correct? Is there is any support from LinkKit for audio files, or maybe you can recommend any third-party sdk, or at least just a way to understand and fill data into buffer at renderMetronomeIntoBuffer?
Any suggestions will be appreciated, thanks in advance.