I'm an all-around uber-noob when it comes to Python and Scipy, so bear with me.
I have a piece of code that reads in a wav file (2 second guitar chord recorded on proTools and exported as a 44100 Hz sound file called Dmaj7.wav
) and then simply makes a copy of it called checkDmaj7.wav
just for verification purposes.
Ideally, the two should sound identical. However, the copy file comes out sounding like pure white noise with no hint of the original sound. Here is the code:
from numpy import *
import scipy
import scipy.io.wavfile as wave
soundspath = 'C:/Nicks_Projects/DSP/Sounds/'
def makewav(data, outfile, samplerate):
scaled = array(data, dtype = int16) #to coerce the data to int16 datatype
wave.write(outfile, samplerate, scaled)
def getwavdata(wavfile):
return wave.read(wavfile)[1]
audio = getwavdata(soundspath + 'Dmaj7.wav')
makewav(audio, soundspath + 'checkDmaj7.wav', 44100)
The code doesn't throw any errors. How can I solve this ?