Monday, October 19, 2009

Note Detector


I decided to explore both the musical and programming aspects of C# all at once. As a first project I built the Note Detector. It opens the sound card and if you have a mic it will tell you the musical note that it hears. It displays the note name C,D,E#,etc and it shows you the note's position on the staff.

Note Detector can be used as a guitar tuner or a singing voice pitch trainer. I use it as an educational device. I have a bamboo flute laying aroung the house and I always wondered what notes came out when I blew on it. I'm not musically inclined enough to determine that kind of stuff with my ear. With Note Detector I was able to map out where all the notes on the flute were and how hard to blow in order to get an A instead of an A#. Now I can play simple tunes.

Microsoft .NET development provides an automatic publishing solution. When you complete a project you can click publish and share it with the internet. If you are so inclined you can download Note Detector to use for yourself.

The project itself is a mixture of Native and Managed C++ code, some C# code and windows forms. The sound card is opened code and the Fast Fourier Transform (FFT) is done in native C++. Then encapsulated by some Managed C++ which is accessed from the windows forms interface using C#.

Working with native and managed code together is difficult sometimes because the debugger will not work with both at the same time. The call stack gets a bit wonky. But I found the coding of the user interface way easier in C# than things I have made in the past using MFC.

No comments:

Post a Comment