Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import matplotlib.pyplot as plt
- import scipy.io.wavfile as wf
- import wave as wv
- y1 = wv.open("PS.wav",'r')
- signal = y1.readframes(-1)
- signal=np.fromstring(signal,'Int16')
- fs=y1.getframerate();
- Time =np.linspace(0,len(signal)/fs, num=len(signal))
- szum = np.random.randn(len(signal))
- db=3000
- x=signal/(db*szum)
- szumy=szum*db
- y=signal+szumy
- plt.subplot(2,1,1)
- plt.plot(Time,signal);
- plt.title("Orginal Signal")
- plt.xlabel("time")
- plt.subplot(3,1,3)
- plt.plot(Time,y)
- plt.title("Signal noise")
- plt.xlabel("time")
- plt.show()
Add Comment
Please, Sign In to add comment