How to compose a tune using C#
Beep method is a simple instrument to create some wonderful tunes. I love music, but haven’t practiced or played. Hence I will stop posting the overloaded Beep function that can be ‘tuned’ for your use
Overloaded Console.Beep method takes two arguments
Console.Beep(int32 frequency, int32 duration)
Here is a way to do it
private static void RhymingBeeps()
{
int duration = 1000;
for (int i = 1500; i <= 2000; i = i +50)
{
Console.Beep(i, duration);
duration = duration / 2;
if (duration <>
{
duration = 1000;
}
}
}
Agreed! It is not that Rhyming. But post you are welcomed to post the rhyming ones here
I think a BuuGoo bird songs like this:
ReplyDeleteConsole.Beep(2000, 150)
Console.Beep(2000, 150)
Console.Beep(2000, 150)
Console.Beep(1500, 300)