2

The AVAudioEngine and related AVAudioNode objects seem to be quite powerful for audio processing but it's difficult to see how to automate parameter changes with them. I'm sure there must be something more effective than manually using a Timer to change values, as a crude example.

AVMutableAudioMixInputParameters includes a method setVolumeRampFromStartVolume:toEndVolume:timeRange: but I cannot see how I could integrate that with AVAudioPlayerNode (connected with AVAudioEffectNodes) and use that method to fade the volume over time. Instead, I have only seen examples of AVMutableAudioMixInputParameters working with AVMutableCompositioninstances and none of them include AVAudioNode objects.

Can anyone post or link to some code samples that combine the use of AVAudioNodes with setVolumeRampFromStartVolume:toEndVolume:timeRange: or explain best practices for automating parameter changes on a node over time?

Many thanks

Dallas Johnson
  • 1,546
  • 10
  • 13

1 Answers1

3

The AVAudioEngine is a real-time engine, but AVMutableComposition seems to be a non-real-time object. Thus incompatible. An alternative is to build and insert your own fader real-time AUAudioUnit node..

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • 2
    Given, how hard it is to find an alternative other than creating my own fader audio unit this may be the best answer. It just seems like a glaring omission in the AVAudioEngine API to not be able to gradually change a parameter over time using the built in units when it almost looks supported with the `scheduleParameterBlock`, `flag_CanRamp` etc..as part of the API. Am I the only person who feels this way. Having said that I'll upvote your answer with the hope that there is a better solution out there. – Dallas Johnson Aug 08 '17 at 08:49