示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (var stream = new MemoryStream())
            {
                List <Note>   notes = new translate(textBox1.Text).noten;
                WaveGenerator wave  = new WaveGenerator(notes);
                wave.Save(stream);

                stream.Seek(0, SeekOrigin.Begin);
                SoundPlayer player = new SoundPlayer(stream);
                player.Play();
            }
        }
示例#2
0
 private void button2_Click(object sender, EventArgs e)
 {
     saveFileDialog1.ShowDialog();
     if (saveFileDialog1.FileName != "")
     {
         if (saveFileDialog1.FileName.IndexOf('.') == -1)
         {
             saveFileDialog1.FileName += ".wav";
         }
         WaveGenerator wave = new WaveGenerator(new translate(textBox1.Text).noten);
         wave.Save(saveFileDialog1.FileName);
         SoundPlayer player = new SoundPlayer(saveFileDialog1.FileName);
         player.Play();
     }
 }
示例#3
0
文件: Form1.cs 项目: lonns/WaveFun
 private void Form1_Load(object sender, EventArgs e)
 {
     wave        = new WaveGenerator();
     frequencies = new List <double>();
     keysPressed = new List <int>();
 }