Commit 390ede80 authored by Samuel Warfield's avatar Samuel Warfield

Peak Detecttion

parent 5722db5f
......@@ -72,7 +72,7 @@ fft_plot = fig.add_subplot(111)
sounddevice.play(wav_data, rate)
timestep = 1/30
timestep = 1/24
t = time.time()
origin = time.time()
nextBeat = 0
......@@ -93,8 +93,8 @@ while t - origin < len(wav_data) / rate:
transform = np.abs(np.fft.fftshift(np.fft.fft(second[:])))
peaks = signal.find_peaks_cwt(np.fft.fftshift(transform), [30,50])
peaks, _ = signal.find_peaks(transform, prominence=20)
print(peaks)
fft_plot.clear()
if load_from_file == True:
......@@ -103,7 +103,7 @@ while t - origin < len(wav_data) / rate:
fft_plot.plot(transform) # np.abs(np.fft.fftshift(np.fft.fft(second[:])))
for x in peaks:
fft_plot.plot(x, transform[x], marker='x')
fft_plot.plot(x,transform[x], marker='x')
fft_plot.set_ylim([0,300])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment