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(); } }
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(); } }