How to save an audio file with different left and right volume from original sound in AVAudioEngine

I create a process to save an effected audio file by AVAudioEngine. However, even if I change the left and right side volume by changing .pan parameter and save it, the effect is not reflected on the file.

Sample code) let emvironmentNode = AVAudioEnvironmentNode() emvironmentNode.pan = 1.0 ... < omit > ... emvironmentNode.installTap(onBus: 0, bufferSize: AVAudioFrameCount(emvironmentNode.outputFormat(forBus: 0).sampleRate), format: emvironmentNode.outputFormat(forBus: 0)) { (buffer, when) in do { try outputFile.write(from: buffer) } catch let error { print(error) } }

How do I save an audio file that reflects the .pan settings? Please let me know if there is another way to change the volume on the left and right side and save it to a file.

Thank you.

Add a Comment