Search code examples
iosoutputaudiounit

How to make the left and right channels of iOS AudioUnit output different audio data independently?


  • I have two different custom audio data, I need to output different audio data for the left and right channels of iOS. Now I can use audiounit to output the same audio data at the same time, but how to control the left channel and the right channel to output different audio data respectively.
  • Seeing some introductions, I need to mix two different data and then output, but because I also need to do some control on the audio data of the left and right channels, such as the difference in volume, but the data after mixing is more like Averaged.
  • In fact, my audio data is the construction data of the square wave. It needs to be independent and accurate on the output of the left and right channels.

Solution

  • Use a mixer audio unit with 2 stereo inputs. A mixer has separate volume controls for each input. Zero one channel of each input (Left on one channel, and Right on the other, and use the un-zero-ed channels for your 2 data sources).