AudioKit / AudioKit

Audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

Home Page:http://audiokit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable Delay operation changing the amplitude of resulting audio

juancrobles opened this issue · comments

macOS Version(s) Used to Build

macOS 13 Ventura

Xcode Version(s)

Xcode 14

Description

I'm trying to generate a stereo signal that can be dynamically delayed, partially based on the StereoDelayOperation example on the coockbook project. I'm using as a source a oscillator passed through an amplitude evelope.
This is my initialization code

init() {
        osc = Oscillator()
        env = AmplitudeEnvelope(osc)
        fader = Fader(env)

        effect = OperationEffect(fader, channelCount: 2) { _, parameters in
            let leftDelay = Operation.leftInput.variableDelay(time: parameters[0], feedback: parameters[1])
            let rightDelay = Operation.rightInput.variableDelay(time: parameters[2], feedback: parameters[3])
            
            return [leftDelay, rightDelay]
        }
        
        effect.parameter1 = 0.1 // time delay for left channel
        effect.parameter2 = 0.0
        effect.parameter3 = 0.1 // time delay for right channel
        effect.parameter4 = 0.0

        osc.amplitude = 1.0
        engine.output = effect
    }

the resulting signal of this code is giving me a stereo signal in which right channel is being amplified and saturating the output as shown in the image

AudioStereoSignal

I have tried creating a second fader and changing the gain, mixing both faders and applying the same delay and still getting the same issue, right channel being amplified

Note: I'm using Xcode 15.2, the form only have up to Xcode 14

I found out that the method that was used to do the record was, some how, changing the right channel volume