kabanosiek

Untitled

Oct 31st, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. import numpy as np
  2. import matplotlib.pyplot as plt
  3. import scipy.io.wavfile as wf
  4. import wave as wv
  5.  
  6. y1 = wv.open("PS.wav",'r')
  7.  
  8. signal = y1.readframes(-1)
  9. signal=np.fromstring(signal,'Int16')
  10. fs=y1.getframerate();
  11.  
  12. Time =np.linspace(0,len(signal)/fs, num=len(signal))
  13.  
  14.  
  15. szum = np.random.randn(len(signal))
  16. db=3000
  17. x=signal/(db*szum)
  18. szumy=szum*db
  19.  
  20.  
  21. y=signal+szumy
  22.  
  23. plt.subplot(2,1,1)
  24. plt.plot(Time,signal);
  25. plt.title("Orginal Signal")
  26. plt.xlabel("time")
  27. plt.subplot(3,1,3)
  28. plt.plot(Time,y)
  29. plt.title("Signal noise")
  30. plt.xlabel("time")
  31.  
  32. plt.show()
Add Comment
Please, Sign In to add comment