Is there any way to make a musical note in C# / javascript? So you specify frequency, pitch, etc. and it plays something?
Asked
Active
Viewed 1,920 times
4
-
3C# and Javascript don't come with speakers, unfortunately. What platform are you building upon (ASP.NET, Winforms, etc?) – Ken Pespisa May 20 '11 at 19:53
-
Probably a duplicate: http://stackoverflow.com/questions/879152/how-do-i-make-javascript-beep – YetAnotherUser May 20 '11 at 19:54
-
Using Unity, attempting to make an audio kit as requested by someone. I'm guessing it was a joke, so I'll treat it like one. – Muzz5 May 20 '11 at 20:09
-
1@kirk...speaking of pedantic and unhelpful... – J Benjamin May 20 '11 at 20:12
-
@kirk woll, I'm joking about the speakers, of course, but only because the question lacks context. For example, the answer would be different if the OP is writing an ASP.NET MVC application and wants to hear a sound vs. a console application. No offense intended. – Ken Pespisa May 20 '11 at 20:36
1 Answers
12
C#, yes. JavaScript, not really (you could use Ajax and the HTML5 <audio />
tag but that's not really a great idea).
In C#, you would do:
Console.Beep(frequencyInHertz, durationInMilliseconds);
. There are also various other ways to do about the same thing.

Ry-
- 218,210
- 55
- 464
- 476