I'm writing a script that should detect the tempo of a song. To do this, I want it to measure the intervals between pulses, such as kick drums or something like that - Since kick drums seemed too infrequent in a song I was testing, I wanted to isolate the claps in the song instead, which are more regular. To do this, I want to isolate the frequencies of the song between 200hz and 300hz.
I've got some code for a low pass filter, found here, but that doesn't exactly help. Other documentation only really plots the filtered audio on a graph using Matplotlib, but I want to write the filtered audio to another WAV file.
sr,y=scipy.io.wavfile.read(data)
lo,hi=200,300
b,a=scipy.signal.butter(N=6, Wn=[2*lo/sr, 2*hi/sr], btype='band')
x = scipy.signal.lfilter(b,a,y)
scipy.io.wavfile.write('test.wav', sr, x.astype(np.int16))
I've currently got this far, however, all it does is make the output quieter based on the filters. In this current state, it makes it completely silent. I'm quite new to audio manipulation, so I'm not entirely sure where to go from here.