Ableton / LinkKit

iOS SDK for Ableton Link, a new technology that synchronizes musical beat, tempo, and phase across multiple applications running on one or more devices.
http://ableton.github.io/linkkit
Other
147 stars 10 forks source link

renderMetronomeIntoBuffer from wav #34

Closed Probeat closed 2 years ago

Probeat commented 7 years ago

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

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.

fgo-ableton commented 7 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.

iliaskarim commented 7 years ago

@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.