rbrisuda
rbrisuda

Reputation: 1005

Comparing pitches with digital audio

I work on application which will compare musical notes with digital audio. My first idea was analyzes wav file (or sound in real-time) with some polyphonic pitch algorithms and gets notes and chords from this file and subsequently compared with notes in dataset. I went through a lot of pages and it seems to be a lot of hard work because existing implementations and algorithms are mainly/only focus on monophonic sound.

Now, I got the idea to do this in the opposite way. In dataset I have for example note: A4 or better example chord: A4 B4 H4. And my idea is make some wave (or whatever I don't know what) from this note or chord and then compared with piece of digital audio.

Is this good idea? Is it better/harder solution? If yes can you recommend me how to do it?

Upvotes: 0

Views: 175

Answers (2)

hotpaw2
hotpaw2

Reputation: 70703

Your "solution" most likely makes matching even more difficult, since you will have no idea what waveform to make for each note. Most musical instruments and voices not only produce waveforms that are significantly different from single sinewaves or any other familiar waveform, but these waveforms evolve over time. Thus guessing the proper waveform to use for each note for a match is extremely improbable.

Upvotes: 0

Floris
Floris

Reputation: 46375

The easiest solution is to take the FFT (Fast Fourier Transform) of the waveform: all the notes (and their harmonics) will be present in the signal. You then look for the frequencies that correspond to notes, and there's your solution.

Note - in order to get decent frequency resolution you need a sufficiently long sample, and high enough sample rate. But try it and you will see.

Here are a couple of screen shots of an app called SpectraWave that I took sitting in front of my piano. The first is of middle A (f = 440 Hz as you know):

enter image description here

and the second is of an A-minor chord (as you can see, my middle finger is a little stronger and the C is showing up as the note with the greatest volume). The harmonics will soon make it hard to see more than just a few notes…

enter image description here

Upvotes: 1

Related Questions