I have a project to write electric piano (siple ones), but I have problem with playing the tones, how to play the musical tones in C#?

Should I record it in wav file and play it one by one?

Help me please...