views:

231

answers:

1

Hi!

I am trying to control the channel (left/right) and its volume from which the audio file is played. It will be great if someone can explain how this can be done or point me to some document or tutorial which explains this.

Thanks a lot!

A: 

If your source audio is monophonic, panning is done by reducing the volume in one of the left or right channels, so at center, they're both at 100%, and one channel is ramped down as you pan left or right.

If your source audio is stereophonic, then it's called "balance" and that's done the same way as panning, except that the two channels are kept separate instead of one channel being put into both left and right.

Volume can be controlled by multiplying each sample by a percentage.

But that's if you're reading and mixing audio at the sample level. If you're using one of the higher-level APIs there's usually a mixer unit or mixer controls where you set values for it and it does all that automatically.

Here's more low-level documentation on Core Audio:

http://developer.apple.com/Mac/library/documentation/MusicAudio/Conceptual/AudioUnitProgrammingGuide/AQuickTouroftheCoreAudioSDK/AQuickTouroftheCoreAudioSDK.html

lucius