public void PlaySound(string name, Action done = null) { FileStream ms = File.OpenRead(_soundLibrary[name]); var rdr = new Mp3FileReader(ms); WaveStream wavStream = WaveFormatConversionStream.CreatePcmStream(rdr); var baStream = new BlockAlignReductionStream(wavStream); var waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()); waveOut.Init(baStream); waveOut.Play(); var bw = new BackgroundWorker(); bw.DoWork += (s, o) => { while (waveOut.PlaybackState == PlaybackState.Playing) { Thread.Sleep(100); } waveOut.Dispose(); baStream.Dispose(); wavStream.Dispose(); rdr.Dispose(); ms.Dispose(); if (done != null) done(); }; bw.RunWorkerAsync(); }
static void Main(string[] args) { // for recording waveFileWriter = new WaveFileWriter(@"C:\rec\out.wav", new WaveFormat(44100, 2)); var sound = new MySound(); sound.SetWaveFormat(44100, 2); sound.init(); waveOut = new WaveOut(); waveOut.Init(sound); waveOut.Play(); ConsoleKeyInfo keyInfo; bool loop = true; while (loop) { keyInfo = Console.ReadKey(); if (keyInfo.Key == ConsoleKey.Q) { waveOut.Stop(); waveOut.Dispose(); waveFileWriter.Close(); waveFileWriter.Dispose(); loop = false; } } }
static void Main(string[] args) { var adj = new AdjustableTFunc {Value = 1600}; var tFuncWaveProvider = new TFuncWaveProvider { // Amplitude = TFunc.Sin(new Frequency(adj.TFunc)) // Amplitude = TFunc.Sin(new Frequency(t => TFuncs.Sin(Frequency.Hertz(1))(t) + 1000)) Amplitude = TFunc.Sin(TFunc.Sin(Frequency.Hertz(2)) + 1000) }; var waveOut = new WaveOut(); waveOut.Init(tFuncWaveProvider); waveOut.Play(); Console.WriteLine("Press q to kill"); char k; while ((k = Console.ReadKey().KeyChar) != 'q') { if (k == 'u') { adj.Value+=10; } if (k == 'd') { adj.Value-=10; } Console.Write(" "); Console.WriteLine(adj.Value); } waveOut.Stop(); waveOut.Dispose(); }
private void GameMain_FormClosed(object sender, FormClosedEventArgs e) { // 閉じたらループBGM終了 if (playBGMplayer != null) { playBGMplayer.Stop(); playBGMplayer.Dispose(); } // セリフ用オブジェクトの破棄 pl.Dispose(); }
private void Dispose(bool isDisposing) { if (!isDisposed) { if (isDisposing) { if (waveOut != null) { waveOut.PlaybackStopped -= new EventHandler <StoppedEventArgs>(waveOut_PlaybackStopped); Stop(); waveOut.Dispose(); } isDisposed = true; } } }
public static void disposeWave() { if (output != null) { if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing) { output.Stop(); } output.Dispose(); } if (stream != null) { stream.Dispose(); stream = null; } }
// セリフ音声の再生 private async void Speach(string s) { NAudio.Wave.WaveOut player; player = new NAudio.Wave.WaveOut(); byte[] buffer = (byte[])Properties.Resources.ResourceManager.GetObject(s); using var stream = new MemoryStream(buffer); using WaveStream pcm = new Mp3FileReader(stream); player.Init(pcm); player.Play(); while (player.PlaybackState == PlaybackState.Playing) { await Task.Delay(10); } player.Dispose(); }
public void Dispose() { if (soundPlayer.PlaybackState == NAudio.Wave.PlaybackState.Playing) { soundPlayer.Stop(); } if (musicPlayer.PlaybackState == NAudio.Wave.PlaybackState.Playing) { musicPlayer.Stop(); } soundPlayer.Dispose(); musicPlayer.Dispose(); soundPlayer = null; musicPlayer = null; _musicMap.Clear(); _soundMap.Clear(); }
public void DisposeWave() { try { if (output != null) { if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing) { output.Stop(); output.Dispose(); output = null; } } if (stream != null) { stream.Dispose(); stream = null; } if (outputLocal != null) { if (outputLocal.PlaybackState == NAudio.Wave.PlaybackState.Playing) { outputLocal.Stop(); outputLocal.Dispose(); outputLocal = null; } } if (stream2 != null) { stream2.Dispose(); stream2 = null; } } catch (NAudio.MmException) { throw; } }
private IEnumerator ImportAudioNAudioRoutine(string url) { var loader = new WWW(url); while (!loader.isDone) { yield return(loader); } Debug.Log("NAudio file play"); NAudio.Wave.WaveOut waveOut = new NAudio.Wave.WaveOut(); NAudio.Wave.WaveFileReader wavReader = new NAudio.Wave.WaveFileReader("bardintro.wav"); Debug.Log("Format : " + wavReader.WaveFormat.ToString() + "sample count : " + wavReader.SampleCount + " :: " + wavReader.Length); var pcmLength = (int)wavReader.Length; var buffer = new byte[pcmLength]; var bytesRead = wavReader.Read(buffer, 0, pcmLength); using (FileStream fs = File.Open("generatedaudiofile", FileMode.Create)) { StreamWriter sw = new StreamWriter(fs); int i = 0; for (i = 0; i < buffer.Length; i += 3) { short int16 = (short)(((buffer[i] & 0xFF) << 8) | (buffer[i + 1] & 0xFF)); float f = int16; sw.WriteLine(f); } } //waveOut.Play(); yield return(new WaitForSeconds(3)); //waveOut.Stop(); wavReader.Dispose(); waveOut.Dispose(); }
public void Execute() { if(this.StreamStarted != null) this.StreamStarted(this, EventArgs.Empty); MediaFoundationReader reader = new MediaFoundationReader(this.Video.DownloadUrl); WaveOut player = new WaveOut(); player.Init(reader); player.Play(); while(player.PlaybackState != PlaybackState.Stopped) { if (this.StreamPositionChanged != null) this.StreamPositionChanged(this, new ProgressEventArgs(reader.CurrentTime.Seconds * reader.TotalTime.Seconds / 100)); Thread.Sleep(1000); } if(this.StreamFinished != null) this.StreamFinished(this, EventArgs.Empty); player.Dispose(); }
static void Main(string[] args) { var waveOut = new WaveOut(); var encoder = new Source(); waveOut.Init(encoder); waveOut.Play(); Stopwatch timer = new Stopwatch(); timer.Start(); while (timer.Elapsed < new TimeSpan(0, 0, 5)) { encoder.SetTimecode(new LTCSharp.Timecode( timer.Elapsed.Hours, timer.Elapsed.Minutes, timer.Elapsed.Seconds, (int) ((float)timer.Elapsed.Milliseconds / 1000.0f * 30.0f))); Thread.Sleep(10); } timer.Stop(); waveOut.Stop(); waveOut.Dispose(); }
/// <summary> /// Stops play back and relise all resorces. /// </summary> public void stop() { try { if (output != null) { if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing) { output.Stop(); } output.Dispose(); output = null; } if (stream != null) { stream.Dispose(); stream = null; } } catch (Exception) { stream = null; } }
public void Play(object sender, MouseButtonEventArgs e) { var button = (NumboardButton)sender; if (button == null) return; if (button.Source == null) return; if (!File.Exists(button.Source)) { MessageBox.Show("Cannot Find file '" + button.Source + "'"); return; } var fileType = System.IO.Path.GetExtension(button.Source); var volume = button.Volume; if (volume == null) { volume = 1; } //primary ouput var primaryReader = new AudioFileReader(button.Source); primaryReader.Volume = (float)(volume * MasterVolume); var primaryWaveOut = new WaveOut(); primaryWaveOut.DeviceNumber = SelectedPrimaryOutputDevice; //secondary ouput var secondaryReader = new AudioFileReader(button.Source); secondaryReader.Volume = (float)(volume * MasterVolume); var secondaryWaveOut = new WaveOut(); secondaryWaveOut.DeviceNumber = SelectedSecondaryOutputDevice; primaryWaveOut.PlaybackStopped += StopStream; try { primaryWaveOut.Init(primaryReader); primaryWaveOut.Play(); secondaryWaveOut.Init(secondaryReader); secondaryWaveOut.Play(); PlayingStreams.Add(new PlayingStream { Button = button, PrimaryReader = primaryReader, SecondaryReader = secondaryReader, PrimaryWaveOut = primaryWaveOut, SecondaryWaveOut = secondaryWaveOut }); } catch (MmException ex) { primaryReader.Dispose(); primaryWaveOut.Dispose(); secondaryReader.Dispose(); secondaryWaveOut.Dispose(); if (ex.Result == MmResult.MemoryAllocationError) { StopAllStreams(); } } }
public void Stream(string url, bool async) { if (url == null) { return; } WaveOut WaveOutPlay = new WaveOut(WaveCallbackInfo.FunctionCallback()); WaveOutPlay.DeviceNumber = device; using (var ms = new MemoryStream()) using (var stream = WebRequest.Create(url).GetResponse().GetResponseStream()) { byte[] buffer = new byte[32768]; int read; while ((read = stream.Read(buffer, 0, buffer.Length)) > 0) { ms.Write(buffer, 0, read); } ms.Position = 0; // Play WaveStream bool wav = url.ToLower().EndsWith(".wav") || url.ToLower().EndsWith(".wma"); var reader = wav ? WaveFormatConversionStream.CreatePcmStream(new WaveFileReader(ms)) : (WaveStream)new Mp3FileReader(ms); RunSession(WaveOutPlay, reader, url); } WaveOutPlay.Dispose(); }
private void PlayInThread(object data) { string filename = (string)data; _waveOutDevice = new WaveOut(); WaveChannel32 inputStream = null; WaveStream mp3Reader = null; try { if (SupportedFileTypes.CanBePlayed(filename)) { mp3Reader = new Mp3FileReader(filename); inputStream = new WaveChannel32(mp3Reader); } else { throw new InvalidOperationException("Unsupported extension"); } _waveOutDevice.Init(inputStream); _waveOutDevice.Volume = _volume; _waveOutDevice.PlaybackStopped += _waveOutDevice_PlaybackStopped; _waveOutDevice.Play(); Log.Debug("Playing " + filename); Thread.Sleep(mp3Reader.TotalTime); } catch (Exception exc) { Log.Debug("Error while playing song " + filename + ":" + exc.ToString()); } finally { _waveOutDevice.Stop(); if (mp3Reader!=null) mp3Reader.Close(); if (inputStream!=null) inputStream.Close(); _waveOutDevice.Dispose(); } }
public void Play(string fileName, bool async) { if (fileName == null) { return; } if (fileName.StartsWith("http")) { Stream(fileName, async); return; } if (!File.Exists(fileName)) { return; } // Play WaveStream bool wav = fileName.ToLower().EndsWith(".wav") || fileName.ToLower().EndsWith(".wma"); var reader = wav ? WaveFormatConversionStream.CreatePcmStream(new WaveFileReader(fileName)) : (WaveStream)new Mp3FileReader(fileName); WaveOut WaveOutPlay = new WaveOut(WaveCallbackInfo.FunctionCallback()); WaveOutPlay.DeviceNumber = device; RunSession(WaveOutPlay, reader, fileName); WaveOutPlay.Dispose(); }
private static void _Beep(int frequency, int duration) { WaveOut wo = new WaveOut(); SquareWaveProvider wp = new SquareWaveProvider(); if (frequency != 0) { wp.Frequency = frequency; wo.Init(wp); wo.Play(); } Thread.Sleep(duration); if (frequency != 0) wo.Stop(); wo.Dispose(); }
private void OnMp3RepositionTestClick(object sender, EventArgs e) { var filename = SelectInputFile(); if (filename == null) return; var wo = new WaveOut(); var af = new AudioFileReader(filename); wo.Init(af); var f = new Form(); var b = new Button() { Text = "Play" }; b.Click += (s, a) => wo.Play(); var b2 = new Button() { Text = "Stop", Left = b.Right }; b2.Click += (s, a) => wo.Stop(); var b3 = new Button { Text = "Rewind", Left = b2.Right }; b3.Click += (s, a) => af.Position = 0; f.FormClosed += (s, a) => { wo.Dispose(); af.Dispose(); }; f.Controls.Add(b); f.Controls.Add(b2); f.Controls.Add(b3); f.ShowDialog(this); }
public void Dispose() { Stop(); _waveOut.Dispose(); }
private void SoundWord() { // Считываем параметры с движков регуляторов // Беконечная работа - если слово условно звучит одну секунду, то это на 1 год if (infinity_work_flag) numberofwords = 31536000; else numberofwords = trackBar_N.Value; interval = trackBar_Pause.Value; speed = trackBar_Speed.Value; tone = trackBar_Tone.Value; // Инициализация звуковой карты (NAudio library) WaveOut MyWaveOut = new WaveOut(); var sineWaveProvider = new SineWaveProvider32(); sineWaveProvider.SetWaveFormat(16000, 1); // 16кГц, моно sineWaveProvider.Frequency = tone; // Тон посылки sineWaveProvider.Amplitude = 0.5f; // Амплитуда посылки MyWaveOut.Init(sineWaveProvider); // Воспроизведение слова int dot = speed_calibr / speed; // Длительность точки int dash = 3 * dot; // Длительность тире int dash_conjoint = dash; // Промежуток между слитными буквами типа <KN> // Если стоит галка "Пауза при старте", то использовать паузу перед началом if (checkBox_StartPause.Checked) { startpause_flag = true; // Использовать паузу Thread.Sleep(startpause * 1000); // Задержка в секундах перед началом передачи } // Выводим случайные слова из массива Random rnd = new Random(); if(non_random_flag) { numberofwords = AllWords.Length; // При отмене случайного выбора слов выводим все слова } // один раз for (int i = 1; i <= numberofwords; i++) { int num; // Обрабатываем кнопку "СТОП" Application.DoEvents(); if (!working_flag) break; //останавливаем воспроизведение слов if (!non_random_flag) { num = rnd.Next(0, AllWords.Length); // Номер случайного слова } else { num = i-1; } string word = AllWords[num].ToUpper(); // Получаем случайное слово в верхнем // регистре for (int j = 0; j < word.Length; j++) // Перебираем буквы в слове { // Обрабатываем кнопку "СТОП" Application.DoEvents(); if (!working_flag) break; //останавливаем воспроизведение // Воспроизводим букву char symbol = word[j]; // Слитные буквы для <AS> и т.п. if (symbol == '<') dash_conjoint = dot; // "<" - слитное слово if (symbol == '>') { dash_conjoint = dash; // ">" - раздельное слово Thread.Sleep(dash_conjoint); } // Цифры if(symbol == '0') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '1') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '2') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '3') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '4') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '5') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '6') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '7') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '8') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if(symbol == '9') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } // Буквы if (symbol == 'A' || symbol == 'А') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'B' || symbol == 'Б') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'C' || symbol == 'Ц') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'D' || symbol == 'Д') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'E' || symbol == 'Е' || symbol == 'Ё') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'F' || symbol == 'Ф') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'G' || symbol == 'Г') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'H' || symbol == 'Х') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'I' || symbol == 'И') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'J' || symbol == 'Й') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'K' || symbol == 'К') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'L' || symbol == 'Л') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'M' || symbol == 'М') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'N' || symbol == 'Н') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'O' || symbol == 'О') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'P' || symbol == 'П') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Q' || symbol == 'Щ') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'R' || symbol == 'Р') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'S' || symbol == 'С') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'T' || symbol == 'Т') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'U' || symbol == 'У') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'V' || symbol == 'Ж') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'W' || symbol == 'В') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'X' || symbol == 'Ь') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Y' || symbol == 'Ы') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Z' || symbol == 'З') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Ч') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Ш') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Э') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Ю') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } if (symbol == 'Я') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash_conjoint); } // Символы if (symbol == '=') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '?') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '/') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '@') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '.' && russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '.' && !russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == ',' && russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == ',' && !russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == ';') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == ':') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '!' && russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '!' && !russianpunktuation_flag) { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '-') { MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dash); } if (symbol == '\'') { MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dash); MyWaveOut.Stop(); Thread.Sleep(dot); MyWaveOut.Play(); Thread.Sleep(dot); MyWaveOut.Stop(); Thread.Sleep(dash); } } // End For j if (non_random_flag) { screen_Out(word); // вывод на label непрерывно } else { screen_Out_By_10(i, word); // вывод на label по 10 слов } int dynamic_interval = 1; // Длительность динамического интервала между словами if (dynamic_interval_flag) { dynamic_interval = word.Length; } Thread.Sleep(interval * dash * dynamic_interval); // Пауза между словами } // End for(i) // Звершить работу со звуковой картой MyWaveOut.Dispose(); MyWaveOut = null; }