Skip to content

Instantly share code, notes, and snippets.

@tikhonova
Last active April 16, 2023 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tikhonova/f137cd52ee18229e0d6a11be98baa9e4 to your computer and use it in GitHub Desktop.
Save tikhonova/f137cd52ee18229e0d6a11be98baa9e4 to your computer and use it in GitHub Desktop.
def reduce_noise(file_path: str, file: str, dest_path: str) -> None:
# load data
rate, data = wavfile.read(os.path.join(file_path, file))
reduced_noise = nr.reduce_noise(y=data, sr=rate)
# perform noise reduction
try:
wavfile.write(os.path.join(dest_path, file), rate, reduced_noise)
except Exception():
pass
# via https://github.com/tikhonova/what_would_alan_watts_say/blob/master/speech_synthesis/1_reduce_noise.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment