Thursday, December 1, 2022
HomeiOS Developmentios - How do I take away noise from an audio sign?...

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


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

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

non-public func extractSignal(enter: AVAudioPCMBuffer, output: AVAudioPCMBuffer) {

    let rely = 256

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

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

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

        var inversed = inverse.remodel(sequence)

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

        // Code: write inversed to output buffer.

        output.frameLength = AVAudioFrameCount(step * sign.rely + sign.rely)
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments