fabianh11
fabianh11

Reputation: 79

AudioKit - Stereo channel flipping from input to output?

I'm using AudioKit to create an experimental iOS audio application. Currently, I'm trying to reroute the left channel of my AKStereoInput to the right channel of AudioKit.output, and the right channel of my AKStereoInput to the left channel of the output.

I was able to simply pan the signal, but I have a hard time splitting the input signal, swapping the left/right channels, and reconnecting them to the output. Any help is appreciated!

Upvotes: 3

Views: 458

Answers (1)

Aurelius Prochazka
Aurelius Prochazka

Reputation: 4573

This is trivial to do at C DSP Level, but I also think you can just use AudioKit's booster and pan nodes to do this. Assuming input is an AKNode:

leftSignal = AKBooster(input)
leftSignal.rightGain = 0
leftPannedRight = AKPanner(leftSignal, pan: 1)

rightSignal = AKBooster(input)
rightSignal.leftGain = 0
rightPannedLeft = AKPanner(rightSignal, pan: -1)

reverseMix = AKMixer(leftPannedRight, rightPannedLeft)
AudioKit.output = reverseMix

I haven't tested this but I think its right.

Upvotes: 3

Related Questions