Accessing Multiple Audio Hardware Outputs/Channels Using Avfoundation and Swift

How do you access multiple channels in AVAudioEngine playback?

Install your tap on the playerNode and don't bother specifying the format:

playerNode.installTap(
onBus: 0,
bufferSize: 1024,
format: nil
) { buffer, time in

// 6 channel buffer
for channel in 0..<buffer.format.channelCount {
}
}

Removing audio channels from audio file swift

I didn't find any good way for this but how I achieved this is by converting audio to wav file then I separate each channel sample, combined only data of the channels I required and then convert that file multichannel wav file.

I used the guidance form the link http://soundfile.sapp.org/doc/WaveFormat/ for identifying wave file header and separating each channel sample.

then I converted the multichannel wav file to mono channel using AVAssetReader and AVAssetWriter.



Related Topics



Leave a reply



Submit