简体   繁体   English

使用Console.Beep .Net播放语音单词声音

[英]Play voice words sounds using Console.Beep .Net

I use VS 2010, .Net 3.5, Win7 64 bits. 我使用VS 2010,.Net 3.5,Win7 64位。

Can I use Console.Beep for "simule" human sounds (voice), maybe producing a synthesized voice sound ? 我可以使用Console.Beep来“模拟”人类声音(语音),也许产生合成的语音声音吗?

For example, using Beep for "simule" the sound of word "Error" ? 例如,使用Beep来“模拟”单词“ Error”的声音? any sample about it ? 关于它的任何样本吗?

Another samples using Console.Beep to play music chords and notes. 另一个示例使用Console.Beep播放音乐和弦和音符。

Is there any way I can get Console.Beep to play anything that sounds (voice, word Error) more like a chord or notes? 有什么办法可以使Console.Beep播放听起来更像是和弦或音符的声音(语音,单词错误)?

I want only use Console.Beep. 我只想使用Console.Beep。 (if it is possible,maybe) Simulation, not real voice. (如果可能的话)模拟,而不是真实的声音。 I don't mind it sounds like R2D2. 我不介意听起来像R2D2。

Beep
How can I make the computer beep in C#? 如何使计算机在C#中发出蜂鸣声?

Play musical chords , notes 演奏和弦,音符
http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvb/thread/6620fd81-974a-40d1-8599-66d6c7c7d22d/ http://social.msdn.microsoft.com/Forums/zh-CN/Vsexpressvb/thread/6620fd81-974a-40d1-8599-66d6c7c7d22d/

http://oguzkoroglu.net/post/2011/01/16/ConsoleBeep().aspx http://oguzkoroglu.net/post/2011/01/16/ConsoleBeep().aspx

No IT IS NOT possible 没有不可能

you can find all you need in the System.Speech.Synthesis Namespace 您可以在System.Speech.Synthesis Namespace找到所需的所有内容

using System;
using System.Speech.Synthesis;

namespace SampleSynthesis
{
  class Program
  {
    static void Main(string[] args)
    {

      // Initialize a new instance of the SpeechSynthesizer.
      SpeechSynthesizer synth = new SpeechSynthesizer();

      // Configure the audio output. 
      synth.SetOutputToDefaultAudioDevice();

      // Speak a string.
      synth.Speak("This example demonstrates a basic use of Speech Synthesizer");

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

The SpeechSynthesizer class provides access to the functionality of a speech synthesis engine that is installed on the host computer. SpeechSynthesizer类提供对安装在主机上的语音合成引擎功能的访问。 Installed speech synthesis engines are represented by a voice, for example Microsoft Anna. 已安装的语音合成引擎由语音表示,例如Microsoft Anna。

http://msdn.microsoft.com/en-us/library/system.speech.synthesis.speechsynthesizer.aspx http://msdn.microsoft.com/zh-CN/library/system.speech.synthesis.speechsynthesizer.aspx

Hey there =) I was thinking of this too, so I searched the web but could not find anything. 嘿=)我也在考虑这个问题,因此我在网上搜索,但找不到任何内容。 worked on it a little myself and came up with this =). 我自己做了一点工作,并提出了这个=)。 its working pretty well! 它工作得很好!

I made 1 random number (int) generator in the " public partial class Form1 : Form " so it will load @ start. 我在“公共局部类Form1:Form”中制作了1个随机数(int)生成器,因此它将加载@start。

Code : 代码:

  private Random randomgen = new Random(); 

Below here i made integers for the 8 different sounds, and 8 for different speeds. 在下面,我为8种不同的声音制作了整数,为8种不同速度制作了整数。

"beepgen1" until "8" in the code below is the frequency of the sound 37-7000 Hertz See this link for more info on the "Console.Beep(FREQUENCY, MILISEC)" 在下面的代码“beepgen1”,直到“8”是声音37-7000赫兹的频率见上的链接的详细信息“Console.Beep(频率,以毫秒为单位)”

Example Place this code under a button and your pc will make a beep @ 1000Hertz and 100Milisec long. 示例将此代码放在按钮下,您的PC会在1000Hertz和100Milisec长的情况下发出蜂鸣声。

"Console.Beep(1000, 100)" “控制台。哔声(1000,100)”

            int beepgen1, beepgen2, beepgen3, beepgen4, beepgen5, beepgen6, beepgen7, beepgen8, beepgenn1, beepgenn2, beepgenn3, beepgenn4, beepgenn5, beepgenn6, beepgenn7, beepgenn8;

            beepgen1 = (randomgen.Next(37, 7000));
            beepgen2 = (randomgen.Next(37, 6000));
            beepgen3 = (randomgen.Next(37, 6000));
            beepgen4 = (randomgen.Next(37, 7000));
            beepgen5 = (randomgen.Next(37, 8000));
            beepgen6 = (randomgen.Next(37, 7000));
            beepgen7 = (randomgen.Next(37, 7000));
            beepgen8 = (randomgen.Next(37, 5000));
            beepgenn1 = (randomgen.Next(50, 200));
            beepgenn2 = (randomgen.Next(50, 250));
            beepgenn3 = (randomgen.Next(50, 300));
            beepgenn4 = (randomgen.Next(50, 200));
            beepgenn5 = (randomgen.Next(50, 250));
            beepgenn6 = (randomgen.Next(50, 200));
            beepgenn7 = (randomgen.Next(50, 300));
            beepgenn8 = (randomgen.Next(50, 250));

            Console.Beep(beepgen1, beepgenn1);
            Console.Beep(beepgen2, beepgenn2);
            Console.Beep(beepgen3, beepgenn3);
            Console.Beep(beepgen4, beepgenn4);
            Console.Beep(beepgen5, beepgenn5);
            Console.Beep(beepgen6, beepgenn6);
            Console.Beep(beepgen7, beepgenn7);
            Console.Beep(beepgen8, beepgenn8);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM