1

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 吗?

4

2 回答 2

2

您可以使用 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)
    }
}
于 2017-10-10T00:49:06.240 回答
1

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

let Amplfo = AKOperation.sineWave(frequency: freq, amplitude: 1.0)
let Output = AKOperationEffect(generator) { generator, _ in
                let lfo = max(Amplfo,0)
                return generator *  lfo }
于 2017-10-10T08:17:55.387 回答