Channel Separation
How to split multiple stereo channels or recombine mono audio signals
// Configure the graph for rendering
let context = Assembler(rendering: .live).createAudioGraph()
// Configure an audio source (Renderer) from a local audio file
let url = URL(fileURLWithPath: "/path/to/source.mp3")
let source = MediaRenderer(contentsOf: url)
// Configure a stereo mixer and separator
let separator = ChannelSeparator(numberOfOutputs: 2)
let merger = ChannelMerger(numberOfInputs: 2)
// Configure node connections
try context.connect(source: source, to: separator)
try context.connect(source: separator, to: merger, with: .init(source: 0, destination: 1))
try context.connect(source: separator, to: merger, with: .init(source: 1, destination: 0))
try context.connect(source: merger, to: context.destination)
source.play(after: 0)Last updated