15,944,959 members
See more:
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

## Solution 1

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.

Sergey Alexandrovich Kryukov 4-Mar-11 12:40pm
Good, correct thinking and interesting reference, my 5.
--SA
Nyx.Carpenter 4-Mar-11 13:31pm
sairam.bhat 5-Mar-11 5:06am

## Solution 2

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.

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

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