将调幅应用于粉红噪声操作

Apply amplitude modulation to pink noise operation

AudioKit 提供了有关通过平移创建白噪声的文档,如下所示:

let generator = AKOperationGenerator { _ in
    let white = AKOperation.whiteNoise()
    let pink = AKOperation.pinkNoise()

    let lfo = AKOperation.sineWave(frequency: 0.3)
    let balance = lfo.scale(minimum: 0, maximum: 1)
    let noise = mixer(white, pink, balance: balance)
    return noise.pan(lfo)
}

然而,我希望使用以下参数(来自 SoundForge Pro)来改变振幅,而不是平移:

    // AmplitudeModulation -> Sine
    // 0.15 (s) -> Modulation frequency
    // Minimum amplitude: Up to -30.0
    // Stereo pan: Up to 20
    // Dry out -30db

这可以使用 AudioKit 吗?

你可以使用 AKTremolo。

class ViewController: UIViewController {

    let whiteNoise = AKWhiteNoise()
    let tremolo = AKTremolo()
    let mixer = AKMixer()

    override func viewDidLoad() {

        AudioKit.output = mixer
        AudioKit.start()

        whiteNoise >>> tremolo >>> mixer
        tremolo.frequency = 0
        whiteNoise.start()

        let slider = AKSlider(property: "Tremolo") { value in
            self.tremolo.frequency = 100 * value
        }
        slider.frame = CGRect(x: 0, y: 100, width: view.bounds.width, height: 100)
        view.addSubview(slider)
    }
}

您可以使用AKOperationEffect 进行振幅调制。例如:

let Amplfo = AKOperation.sineWave(frequency: freq, amplitude: 1.0)
let Output = AKOperationEffect(generator) { generator, _ in
                let lfo = max(Amplfo,0)
                return generator *  lfo }