Skip to main content
. 2025 Sep 29;12(10):1052. doi: 10.3390/bioengineering12101052
Algorithm 1 Audio Denoising Algorithm
  • 1:

    Input: Noisy audio file input_audio.wav

  • 2:

    Output: Denoised audio file output_denoised.wav

  • 3:

    Load the input audio file and sampling rate fs=44.1 kHz

  • 4:

    Normalize the audio data to the range [1,1]

  • 5:
    Compute the short-time fourier transform (STFT):
    X(t,f)=nx(n)w(nt)ej2πfn
  • 6:
    Estimate noise power spectrum from the first T=10 silent frames:
    PN(f)=1Tt=1T|X(t,f)|2
  • 7:
    Compute noise threshold:
    T(f)=kPN(f),k=1.5
  • 8:
    Apply spectral gating using gain function:
    G(f)=1,|X(t,f)|>T(f)α,|X(t,f)|T(f),α=0.1
  • 9:
    Filter the STFT coefficients:
    X(t,f)=G(f)·X(t,f)
  • 10:
    Perform inverse STFT to reconstruct the denoised signal:
    x(n)=fX(t,f)ej2πfnw(nt)
  • 11:

    Normalize and save the denoised audio as output_denoised.wav