private void stop(object sender, RoutedEventArgs e) { if (!isRecording || this.lvSentences.SelectedItems.Count < 1) { return; } isRecording = false; recorder.Close(); filewriter.Close(); int index = this.lvSentences.SelectedIndex; lblRecording.Visibility = System.Windows.Visibility.Hidden; Sentence sentence = (Sentence)this.lvSentences.SelectedItem; loadLanguage(); // Called to refresh the sentence data of the current langugae this.lvSentences.SelectedIndex = index; wavProcessor processor = new wavProcessor(); int noiceLevel = (int)this.noiceLevelSlider.Value; processor.StripSilence(sentence.fullPath, noiceLevel); processor.ToneIn(sentence.fullPath); processor.ToneOut(sentence.fullPath); processor.SpeedUp(sentence.fullPath, (int)this.speedSlider.Value); }
void Go() { int samplerate = 16000; int bits = 16; // 8 or 16 int channels = 1; // 1 or 2 filewriter = new WavFileWriter("out.wav", samplerate, bits, channels); WaveFormat fmt = new WaveFormat(samplerate, bits, channels); // devicenumber, wavformat, buffersize, callback int buffersize = 16384; WaveInRecorder rec = new WaveInRecorder(-1, fmt, buffersize, this.DataArrived); tmparray = new byte[buffersize]; Console.WriteLine("Recording - press Enter to end"); Console.ReadLine(); rec.Close(); filewriter.Close(); Console.WriteLine("Bye"); }