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:
- consol.beep (); but I feel its sound is not like the tone of the piano
- saving and playing WAV files. I thought of getting wav files of piano tones but I feel it’s the hard way to do so and it won’t be salable any may take much unneeded space
Is there a library to play a piano-like tones or any different tones of a different musical instruments?
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: