Glitching caused by rapid volume changes
I am controlling the volume of a looped sample by setting the volume of an AEAudioUnitChannel object.
I would like to be able to make rapid changes to the volume of this AEAudioUnitChannel object, but am hearing glitches when the changes are too rapid.
I assume the way to reduce the glitching is to interpolate from the current volume level to the desired volume level, and to perform this interpolation at a rate higher than the rate at which the desired volume level is being updated.
Given that the desired volume level is being updated approximately every 10 msecs, I am wondering if there is already some kind of setup in TAAE for interpolating values at or close to the audio sampling rate?
I have been searching this forum for posts on this topic but have not found anything, so any suggestions would be very gratefully received!
Comments
Just found a related but unresolved question here:
http://forum.theamazingaudioengine.com/discussion/676/linear-ramps-for-audio-unit-parameter-changes
Further to the example of line~ objects in PD and Max in the above post, here also is a potentially relevant class method from Web Audio:
https://developer.mozilla.org/en-US/docs/Web/API/AudioParam/linearRampToValueAtTime
In case this is useful for anyone else, I’ve found a function called vDSP_vrampmul (part the Accelerate Framework) that could be useful for this.
Here is an TAAE example where it is utilised:
https://github.com/TheAmazingAudioEngine/TheAmazingAudioEngine/blob/master/Modules/AELimiter.m
Additional links:
https://developer.apple.com/library/tvos/documentation/Accelerate/Reference/AccelerateFWRef/index.html
http://forum.theamazingaudioengine.com/discussion/568/creating-an-envelope
See also the comments section here for Michael’s explanation of how he uses it: http://atastypixel.com/blog/how-to-mix-audio-samples-properly-on-ios/
Thanks very much for you input on this. What would be causing this amplitude modulation?
Thanks for that. I think I understand what you are saying now. Our amplitude changes are not periodic (i.e. no oscillation) and also not nearly as fast as 0 to 1 in 10 msec, so this is probably not the issue. Good food for thought though and thanks again for your input!