Improving the join of two wave file?

Posted by kaki on Stack Overflow See other posts from Stack Overflow or by kaki
Published on 2010-06-16T06:35:49Z Indexed on 2010/06/16 6:42 UTC
Read the original article Hit count: 216

Filed under:
|

I have written a code for joining two wave files.It works fine when i am joining larger segments but as i need to join very small segments the clarity is not good.

I have learned that the signal processing technique such a windowed join can be used to improve the joining of file.

y[n] = w[n]s[n] Multiply value of signal at sample number n by the value of a windowing function hamming window w[n]= .54 - .46*cos(2*Pi*n)/L 0

I am not understanding how to get the value to signal at sample n and how to implement this??

the code i am using for joining is

import wave
m=['C:/begpython/S0001_0002.wav', 'C:/begpython/S0001_0001.wav']
i=1
a=m[i]
infiles = [a, "C:/begpython/S0001_0002.wav", a]
outfile = "C:/begpython/S0001_00367.wav"

data= []
data1=[]
for infile in infiles:
    w = wave.open(infile, 'rb')
    data1=[w.getnframes]
    data.append( [w.getparams(), w.readframes(w.getnframes())] )
    #data1 = [ord(character) for character in data1]

    #print data1
    #data1 = ''.join(chr(character) for character in data1)

    w.close()

output = wave.open(outfile, 'wb')
output.setparams(data[0][0])
output.writeframes(data[0][1])
output.writeframes(data[1][1])
output.writeframes(data[2][1])
output.close()

© Stack Overflow or respective owner

Related posts about python

Related posts about wav