0
How can I add music to C#?
My teacher tell me if I add music to a C# program (console) he'll give me extra points in my exam. Please help me with the code.
8 RĂ©ponses
+ 3
You will want to use System.Console.Beep(int frequency, int duration)
https://docs.microsoft.com/en-us/dotnet/api/system.console.beep?view=netframework-4.8#System_Console_Beep_System_Int32_System_Int32_
https://www.geeksforgeeks.org/c-sharp-how-to-play-user-modified-beep-sound-through-console/amp/
Here are some examples I found online. I would avoid using these as your teacher probably found the same examples as well. đ
But, these should give you a good idea of what's involved.
Tetris (with theme song) in the C# console.
https://gist.github.com/erineccleston/0d65a78e9df88d68a13a421d2a298f10
SUPER MARIO SONG USING CONSOLE.BEEP()
https://hashtagakash.wordpress.com/2014/01/22/182/
https://code.sololearn.com/cN9GCp8sxk8L/
+ 5
TheCoder | I Specialise in C#
I'm confused about your response and the down votes. đ€
There's nothing "bad about preparing him for the future..." so to speak, nor did I mean you any offense.
I was simply clarifying that my answer was a direct response to the criteria specified in the question. I certainly wasn't making a case for creating songs using Console.Beep() over a more sophisticated solution you were pointing out.
That said, SaĂșl is free to submit either solution to his teacher. However, if the criteria was limited to a Console App, the WPF solution might not earn the extra points he was hoping for on his exam. đ€·ââïž
If this response is somehow received as offensive, please know that wasn't my intent.
+ 3
TheCoder | I Specialise in C#
If the challenge applies to WPF, then, your suggestion would be great. đđ
However, as I understand it from the posted question, the challenge from the teacher was to add sound to a Console Application written in C#. In that case, I believe the option I provided is the only one that will work. đ€·ââïžđ€
+ 1
What do you have so far ,in code?
How much C# do you know?
+ 1
I don't have a big experience, I'm still learning
+ 1
Thanks David Carroll