/import_wav.py
Python | 43 lines | 23 code | 15 blank | 5 comment | 2 complexity | 1c968082794b08331b3c1bdeff045eb1 MD5 | raw file
- from numpy import *
- import scipy.io.wavfile as S
- import pylab
- import os
- (fs,x) = S.read("haydenSample.wav")
- x = x#/32768.0
- #kill off the left speaker
- for i in x:
- i[0] = 0
- #make the data nonstero
- b = x[:,1]
- for i in range(len(b)-100000):
- b[i] = b[i+100000]
- S.write("hayden_same_on_both_speakers.wav", fs, b)
- #os.system("mplayer hayden_same_on_both_speakers.wav")
- secs = 1.0
- fs = 44100
- t = arange(fs*secs)/fs
- freq = 440
- #this is scaled wrong and sounds buzzy and shit
- x = cos(t*2*pi*freq)*.7
- #this is nice
- x = (x*32768.0).astype(int16)
- pylab.figure()
- pylab.plot(t, x)
- pylab.show()
- S.write("sine_wave.wav", fs, x)
- os.system("mplayer sine_wave.wav")