Click here to Skip to main content
15,944,959 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
Hello everyone!

I have a rather interesting problem to solve.

I want to take a very simple sound (one note played on the piano) and try to process it in such a way that I can print out which note is most likely being played.

From some googling and searching I have come across the fast fourier transform but am not entirely sure how I would use this to analyze data from a wav file.

Another thought I had was that a note should be more or less the same each time it is played. If that is the case could a percentage match on two wav files turned into byte arrays be of any use?

Thoughts and ideas would be much appreciated.

UPDATE:
Am I correct in thinking I will need a dedicated sound card to use Accord? When I run the sample programs and click start it says "waiting for sound card" then stops working.
Posted
Updated 4-Mar-11 7:35am
v2

I'd say have a look at Autotune.Net

http://channel9.msdn.com/coding4fun/articles/AutotuneNET[^]

As you'll see, pitch detection is obviously vital to an autotune program, so that will help you with what you're trying to do.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Mar-11 12:40pm    
Good, correct thinking and interesting reference, my 5.
--SA
Nyx.Carpenter 4-Mar-11 13:31pm    
Just started reading this article. It seems to be very good. Thank you for the link!
sairam.bhat 5-Mar-11 5:06am    
good answer
Each piano key has unique frequency. So the frequency domain i.e fourier transformation helps to identify the pattern of the pure sound from noise. That pattern you could use compare the sound.

"Another thought I had was that a note should be more or less the same each time it is played. If that is the case could a percentage match on two wav files turned into byte arrays be of any use?"

This idea works only for one piano with constant setting. For example if the volume of the piano increase/ decrease which again depends on the distance of the recorder device then the byte array will not be comparable every time. Then you need to normalize the data for various such parameters.

Instead frequency will remain same. Well other things like pitch, timbre also important parameters.

Dylan Morley given a link about pitch detection. You may get more information from other people as well.

Here is a link for a free library which has functionality to transform audio to fourier and Hilbert transforms

http://accord-net.origo.ethz.ch/wiki/features[^]

Good luck
 
Share this answer
 
Comments
Nyx.Carpenter 4-Mar-11 13:30pm    
Accord .NET is one of the things I have been searching for (a recent set of tools and libraries)! Thank you
sairam.bhat 5-Mar-11 5:06am    
good

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900