Search for notes in a WAV file

I am going to figure out how to split the data in a WAV file into its component notes. I upload WAV files with:

import scipy.io.wavfile as wavfile
rate, data = wavfile.read('scale.wav')
time = np.arange(len(data[:,0]))*1.0/rate

and schedule with

plt.plot(time, data[:,0])
plt.show()

it gives me this image , which is a piano scale with eight notes in it. I need a way to isolate each note so that I can then find its frequency and find out which note is playing. When I have isolated notes, I can take care of the rest.

I tried to find the maximum values, but there are so many of them and it takes several iterations to get it to the maxima that I wanted, and this is an unreliable method, because too many iterations get rid of some peaks with a lower amplitude, getting the length of the note in time was also would be nice.

EDIT: So it's quite complicated, as you gentlemen. Now I think that I just want to find the "extreme" peaks, and then find the extreme lows that come after these peaks, and use this as my note, since we do not need too much data to figure out this frequency. The problem I am facing is that there are many peaks, and it is difficult to find only those that I want. Any ideas?

+4
source share
3 answers

, , . , , , , , . abjab . , .

, , .

. .

+1

, spectrogram , , . , . Python specgram, , matplotlib. . Google , . , MP3/WAV , , Winamp 10 .

, , - : , . , , , , . - , ( hi-hats), .

, Q- (. wikipedia , ). , , (, ). , , . , numpy, , , .

+3

, ( !), , , , , , FFT. , , , , , . -, ​​

enter image description here

g (t-u) , , . , , . , .

You could, of course, simply have a window where you analyze each block above the window using FFT and extract the highest frequency - but it is fragile, requires manual tuning and will not work for more complex signals.

+2
source

Source: https://habr.com/ru/post/1530420/


All Articles