I'm trying to make a simple piano application in C#.
It's supposed to be a very simple piano (5 or 6 keys maximum). I've found different alternatives, and the ones I've found till now are:
Is there a library to play a piano-like tones or any different tones of a different musical instruments?
The C major chord is made up of three notes: C, E, and G. To play the root position chord on the piano with your right hand, you'd use the following three fingers: G - Fifth finger (5) E - Third finger (3) C - First finger (1)
The pitch increases with frequency. Thus, the frequency of middle C is 256 Hz, and the frequency of the A above is 440 Hz.
Did you think about using MIDI?
This can be useful.
See http://grouplab.cpsc.ucalgary.ca/cookbook/index.php/VisualStudio/HowToPlayMIDIInstruments
This one is very interesting, it allows you to play sounds in a simple way like this:
MidiPlayer.Play( new NoteOn( 0, 1, "C4", 127 ) );
You can also take a look at this code project page. See http://www.codeproject.com/KB/audio-video/MIDIToolkit.aspx
Checkout the downloadable source for Mike Gold's Virtual Piano in C#. I think it has what you're looking for.
You may also want to check out this post: Is it possible to generate a constant sound in C# while adjusting its frequency? . The basic idea is that you have a single sample, and you programmatically manipulate the frequency of the sound file, thus generating a different note.
As far as libraries that can help you, you can take a look at:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With