AP-Atul / Audio-Denoising

Noise removal/ reducer from the audio file in python. De-noising is done using Wavelets and thresholding is done by VISU Shrink thresholding technique
MIT License
150 stars 19 forks source link

denoised audio doesn't sound right #5

Open kevin-farhat opened 2 months ago

kevin-farhat commented 2 months ago

Not sure why but the denoised audio sounds like cut off sounds or little pulses of sound that have nothing to do with the original audio. The original audio is a speaker with some background noise, but the output sounds as if someone is plugging in and out their electric guitar really quickly (like the speaker pop sound). I am new to this so I do not understand the underlying tech, but why does the generateNoiseProfile function overwrite the input audio file. Should i be passing the input audio file to the generateNoiseProfile function? without calling generateNoiseProfile, my input and output audio sounds the exact same. I am also getting the warnings below, but I believe I read somewhere that the divide by 0 error is okay. Any explanation of how to use this properly and what might be causing my problems would be appreciated.

Thank you for the help!

UserWarning: Level value of 2 is too high: all coefficients will experience boundary effects.
  warnings.warn(s]
                      /home/ubuntu/.local/lib/python3.9/site-packages/pywt/_thresholding.py:22: RuntimeWarning: invalid value encountered in divide
  thresholded = (1 - value/magnitude)
AP-Atul commented 2 months ago

you don't need to do generateNoiseProfile

kevin-farhat commented 2 months ago

Thank you for your response. When I don't do generateNoiseProfile, the output audio is the same as the input audio with no noise reduction.

This is the script i'm using:


import os
from tqdm import tqdm 

# input_dir = '/home/ubuntu/denoising/DNS_data/datasets_fullband/noisy_audios'
input_dir = '/home/ubuntu/denoising/audios/noisy_audios'

output_dir = '/home/ubuntu/kevin/denoising/Audio-Denoising/'

os.makedirs(output_dir, exist_ok=True)

wav_files = [f for f in os.listdir(input_dir) if f.endswith('.wav')]

for file in tqdm(wav_files):
    in_audio_file = os.path.join(input_dir, file)
    out_audio_file = os.path.join(output_dir, f"results2/denoised_{file}")
    print(in_audio_file)
    print(out_audio_file)
    audioDenoiser = AudioDeNoise(inputFile=in_audio_file)
    audioDenoiser.deNoise(outputFile=f"{out_audio_file}")
    # audioDenoiser.generateNoiseProfile(noiseFile=in_audio_file)```