Experimentation with C#

I've been working on video game console programming for a while now, about 7 years. The entire life of the PS2 and now into the lifespan of the PS3. Working on consoles that long made me wonder what's going on with PC software. Every once in a while I like to experiment with the PC. Just to see what's up in the PC arena.

.NET is kind of all new to me. All the managed code and C# and Windows Forms. So I thought I'd play with it a bit and see what it's about. Turns out it's all very interesting.

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.


Mike said...

Excuse me, i'm studying computer science 7th semester in a university here on Mexico, for a PDS class i said i was going to do a note detector exactly like urs(i didn't know urs existed at the time), i'm searching documentation, i've been searching for a week and haven't been very lucky. this project i have to do it for this week from december 3th to 8th, so i do not have enough time, could u tell me how u did it?, i use c#, vb, java, c++, and righ now any language that would allow me to do that software.
could u please help me, maybe give me a link or something??, that would be really nice, and by the wy ur software rocks!, i just want to build like 10% of it or less would be nice. tnx =)
this is my mail, daxl70@gmail.com

dude said...

Hey man.

Note Detector just quit's unexpectedly. I've downloaded different versions, any ideas?

Rima said...

I have the same thing as the guy before me, except i have 2 weeks, i was wondering if you gave any advice to the guy before me, you could help me too

my e-mail rima044@aol.com

thank you so much

Mike said...

he did not give me an advice, but it is actually very easy to do, find a way of listening the computer microphone at real time (this is the hard part, but there are free classes done by someone else) , with the info this must gives you, use something to convert it to a frequency ( i do not remember if it was a laplace transform but maybe ) that frequency can be converted into a note using some ranges available on the web (easy to find)