How to add noise to audiosegment using pydub?

I am very new to signal processing so apologies for the simplicity! I would like to use pydub to add noise to a sound clip. I know pydub has several generator functions for noise and an overlay audio one. Is overlaying the generated noise segment over the sound clip equivalent to

sound = some signal (possibly raw data?)

noise = np.random.normal(0,1,100)

result = sound + noise ?

1 Answer

You’ll need to overlay the noise — something like:

from pydub import AudioSegment from pydub.generators import WhiteNoise sound = AudioSegment.from_file(...) noise = WhiteNoise().to_audio_segment(duration=len(sound)) combined = sound.overlay(noise) 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like