问题
Possible Duplicate:
How can I make the computer beep in C#?
Can the computer beep at different pitches or is there only one?
回答1:
The Console.Beep method has two overloads: the first version is the default beep, and the second version receives two arguments—the frequency and the duration in milliseconds. Try following program to sample different beeps your c# code can make.
using System;
class Program
{
static void Main()
{
for (int i = 37; i <= 32767; i += 200)
{
Console.Beep(i, 100);
}
}
}
回答2:
for example,
Console.Beep(5000, 1000);
Will beep @ 5000 MHz for 1 second
You can play with the HZ to control the tone
More on beep here.
回答3:
public static void Beep(
int frequency,
int duration)
You can change the frequency
The frequency of the beep, ranging from 37 to 32767
hertz.
回答4:
According to the kernel32.Beep
API, you can set the frequency manually: http://pinvoke.net/default.aspx/kernel32.Beep
dwFreq
: Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32767 (0x25 through 0x7FFF).
回答5:
You can change the frequency.
See a good example. You can even play musics. Check this link
来源:https://stackoverflow.com/questions/8414707/can-i-generate-different-beeps-using-the-computer-speaker-or-is-there-only-one