Tell us about yourself!

Complete Your Profile
  • CaitlinR25 commented on amandaghassaei's instructable Laser Cut Record9 months ago
    Laser Cut Record

    Hi Amanda,I'm having trouble getting python to find my file. Here is the test and a screen shot.Thank You!Best,C#this code unpacks and repacks data from:#16 bit stereo wav file at 44100hz sampling rate#to:##16 bit mono wav file at 44100hz sampling rateimport waveimport mathimport structbitDepth = 8#target bitDepthfrate = 44100#target frame ratefileName = "space.wav"#file to be imported (change this)#read file and get dataw = wave.open(fileName, 'r')numframes = w.getnframes()frame = w.readframes(numframes)#w.getnframes()frameInt = map(ord, list(frame))#turn into array#separate left and right channels and merge bytesframeOneChannel = [0]*numframes#initialize list of one channel of wavefor i in range(numframes): frameOneChannel[i] = frameInt[4*i+1]*2**8+frameInt[4*i]#separate ...

    see more »

    Hi Amanda,I'm having trouble getting python to find my file. Here is the test and a screen shot.Thank You!Best,C#this code unpacks and repacks data from:#16 bit stereo wav file at 44100hz sampling rate#to:##16 bit mono wav file at 44100hz sampling rateimport waveimport mathimport structbitDepth = 8#target bitDepthfrate = 44100#target frame ratefileName = "space.wav"#file to be imported (change this)#read file and get dataw = wave.open(fileName, 'r')numframes = w.getnframes()frame = w.readframes(numframes)#w.getnframes()frameInt = map(ord, list(frame))#turn into array#separate left and right channels and merge bytesframeOneChannel = [0]*numframes#initialize list of one channel of wavefor i in range(numframes): frameOneChannel[i] = frameInt[4*i+1]*2**8+frameInt[4*i]#separate channels and store one channel in new list if frameOneChannel[i] > 2**15: frameOneChannel[i] = (frameOneChannel[i]-2**16) elif frameOneChannel[i] == 2**15: frameOneChannel[i] = 0 else: frameOneChannel[i] = frameOneChannel[i]#convert to stringaudioStr = ''for i in range(numframes): audioStr += str(frameOneChannel[i]) audioStr += ","#separate elements with commafileName = fileName[:-3]#remove .wav extensiontext_file = open(fileName+"txt", "w")text_file.write("%s"%audioStr)text_file.close()

    View Instructable »