通过声音拨打电话
去年暑假在家看都市报道的g3行动组说通过声音也能拨打固定电话,所以就忍不住试了一下。
原理:固定电话是通过声音的频率来确定用户按的是哪个键,各个键频率不一样,所发出声音也就不一样,因此就可以通过声音来拨打电话。
具体过程:
首先要下载0~9的音频文件。
下载地址:http://dl.dbank.com/c06h3zhg4w
编写waveplay 动态链接库,将声音资源导入其中。
View Code
public static void WavePlaySound(char num)
{
switch (num)
{
case '0':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._0);
simpleSound.Play();
}
break;
case '1':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._1);
simpleSound.Play();
}
break;
case '2':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._2);
simpleSound.Play();
}
break;
case '3':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._3);
simpleSound.Play();
}
break;
case '4':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._4);
simpleSound.Play();
}
break;
case '5':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._5);
simpleSound.Play();
}
break;
case '6':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._6);
simpleSound.Play();
}
break;
case '7':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._7);
simpleSound.Play();
}
break;
case '8':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._8);
simpleSound.Play();
}
break;
case '9':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources._9);
simpleSound.Play();
}
break;
case '#':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources.井号);
simpleSound.Play();
}
break;
case '*':
{
SoundPlayer simpleSound = new SoundPlayer(WavePlay.Properties.Resources.星号);
simpleSound.Play();
}
break;
}
}
最后新建一个工程将waveplay.dl 引入到工程之中,直接调用方法
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
void sound(object sender, EventArgs e)
{
Play.WavePlaySound(Convert.ToChar(((Button)sender).Text));
}
private void button13_Click(object sender, EventArgs e)
{
Play.WavePlaySound(textBox1.Text);
}
使用方法:拿起电话听筒,靠近电脑音箱,拨号,最后电话就打通了。
下载地址:http://dl.dbank.com/c0ws5dmi02

浙公网安备 33010602011771号