Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
First: Sorry about my bad English!

Now my Question.

I am Trying to write a program for a Keyboard.

Example: If i Press the C on a Music Keyboard, and the Program Shows a C (via Microphone Input)
I know it possible to program a Guitar Tuner...

I hope you understand what i mean.


Thanks for reading


Fabian
Posted
Updated 3-Oct-13 0:14am
v2

The easiest way is to hold the notes as individual WAV or MP3 files - for a Guitar tuner where you need a small number of notes that is fine - and play them on the keystroke.

If you save them as WAV files, you can add them to your application Resources, and play them very easily:
C#
SoundPlayer keyOfC= new SoundPlayer(Properties.Resources.NoteC);
keyOfC.Play();


Beyond that, there is Console.Beep - but it may not work in all OS's - it allows you to specify the frequency and duration:
C#
Console.Beep(261, 10000);
will play a C for ten seconds
 
Share this answer
 
Are you saying that you want to press a note-key on a MIDI keyboard, like middle-C, and have a middle-C note shown in some form, in your .NET application ?

If you are using a MIDI keyboard, see: [^].

Please clarify exactly what you refer to when you use the term: "keyboard."
 
Share this answer
 
Comments
Belloanton 10-Oct-13 8:53am    
Okay,

yeah, i press a key on my keyboard (in front of my notebook)
and my windows Form should show me which key is presses (like a "if key.pressed" event but for a piano/synthesizer.

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