0
0

I’m using a custom DSP to implement volume envelopes. It’s within the context of a sequencer where audio is scheduled using Channel::setDelay (FMOD_DELAYTYPE delaytype, unsigned int delayhi, unsigned int delaylo) in order to achieve accurate timing.

The issue I’m having is with identifying the exact beginning of the sound data. I’m having difficulty – for example – beginning a fade at sample 0 of a sound because the DSP callback is called regardless of whether the scheduled channel is playing back yet. The DSP clock is also not accurate enough to use for measuring since it increments with coarse granularity.

I could test for the first non-zero value detected, but if an audio file begins with silence the timing will be thrown off. Any advice would be appreciated. Thank you!

  • You must to post comments
0
0

Hi,
You should be able to get the clock value from the dsp callback with System::getDSPClock. When the 1024 sample block comes along, the clock sholud be a multiple of 1024. Just count into the block with youroffset%blocksize to get the sample offset inside the mix block.

  • You must to post comments
0
0

also just to note the low level api for FMOD Studio (which is based on fmod ex’s low level api) has fade in start, delay start, delay end, fade out stop – so you can implement attack, delay and release with sample accuracy.

  • You must to post comments
0
0

Thanks Brett – that API you mentioned for FMOD studio sounds promising. We’re on iOS though which I don’t see listed under the supported platforms. Are you planning on releasing it for iOS?

I’ll also check out your suggestion regarding sample counting. Thanks!

  • You must to post comments
0
0

Yes, FMOD Studio developer preview 2 will add support for iOS. We are planning to release this tomorrow so feel free to give it a go.

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.