Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. from scipy import signal
  2.  
  3. from utility.sound_util import *
  4.  
  5. source = wave.open(sound_file, 'r')
  6. nChannels = source.getnchannels()
  7. sampWidth = source.getsampwidth() # sampling width
  8. FrameRate = source.getframerate() # sampling rate
  9. nFrames = source.getnframes()
  10.  
  11. revb = wave.open(file_DIR + 'Reverberation.wav', 'r')
  12.  
  13. source_str = wav2str(source)
  14. revb_str = wav2str(revb)
  15.  
  16. revb_output = signal.lfilter(revb_str, [1.], source_str) / np.max(np.abs(revb_str))
  17.  
  18. output = wave.open(file_DIR + 'output_revb.wav', 'w')
  19. output.setparams((nChannels, sampWidth, FrameRate, nFrames, 'NONE', 'not compressed'))
  20. copyWav(output, revb_output)
  21.  
  22. source.close()
  23. revb.close()
  24. output.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement