0

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 ?

Xun
  • 43
  • 1
  • 5

1 Answers1

3

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)
Jiaaro
  • 74,485
  • 42
  • 169
  • 190