ios – How do I take away noise from an audio sign? And what threshold/threshold vary ought to I exploit?


I’ve loaded an audio file and have created an enter and output buffer.

However once I comply with Apple’s publish I get an output sign that has distorted sounds.

personal func extractSignal(enter: AVAudioPCMBuffer, output: AVAudioPCMBuffer) {

    let depend = 256

    let ahead = vDSP.DCT(earlier: nil, depend: depend, transformType: .II)!
    let inverse = vDSP.DCT(earlier: nil, depend: depend, transformType: .III)!

    // Iterates over the sign.
    enter.iterate(signalCount: 32000) { step, sign in

        var collection = ahead.remodel(sign)
        collection = vDSP.threshold(collection, to: 0.0003, with: .zeroFill) // What ought to this threshold be?

        var inversed = inverse.remodel(collection)

        let divisor: Float = Float(depend / 2)
        inversed = vDSP.divide(inversed, divisor)

        // Code: write inversed to output buffer.

        output.frameLength = AVAudioFrameCount(step * sign.depend + sign.depend)


Leave a Reply