private void FormMain_Load(object sender, EventArgs e) { if (WaveNative.waveInGetNumDevs() == 0) { textBoxConsole.AppendText(DateTime.Now.ToString() + " : No audio input devices detected\r\n"); } else { textBoxConsole.AppendText(DateTime.Now.ToString() + " : Audio input device detected\r\n"); if (_isPlayer == true) _streamOut = new FifoStream(); _audioFrame = new AudioFrame(_isTest); _audioFrame.IsDetectingEvents = Properties.Settings.Default.SettingIsDetectingEvents; _audioFrame.AmplitudeThreshold = Properties.Settings.Default.SettingAmplitudeThreshold; _streamMemory = new MemoryStream(); Start(); } }
private void FormMain_Load(object sender, EventArgs e) { if (WaveNative.waveInGetNumDevs() == 0) { consoletext += DateTime.Now.ToString() + " : No audio input devices detected\r\n"; } else { consoletext += DateTime.Now.ToString() + " : Audio input device detected\r\n"; if (_isPlayer == true) { _streamOut = new FifoStream(); } _audioFrame = new AudioFrame(_isTest); _audioFrame.IsDetectingEvents = Properties.Settings.Default.SettingIsDetectingEvents; _audioFrame.AmplitudeThreshold = Properties.Settings.Default.SettingAmplitudeThreshold; _streamMemory = new MemoryStream(); Start(); } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { FormSettingsDialog form = new FormSettingsDialog(); if (form.ShowDialog() == DialogResult.OK) { Stop(); if (_isSaving == true) { byte[] waveBuffer = new byte[Properties.Settings.Default.SettingBitsPerSample]; _streamWave = WaveStream.CreateStream(_streamMemory, _waveFormat); waveBuffer = new byte[_streamWave.Length - _streamWave.Position]; _streamWave.Read(waveBuffer, 0, waveBuffer.Length); _streamFile = new FileStream(_sampleFilename, FileMode.Create); _streamFile.Write(waveBuffer, 0, waveBuffer.Length); _isSaving = false; } if (_streamOut != null) try { _streamOut.Close(); } finally { _streamOut = null; } if (_streamWave != null) try { _streamWave.Close(); } finally { _streamWave = null; } if (_streamFile != null) try { _streamFile.Close(); } finally { _streamFile = null; } if (_streamMemory != null) try { _streamMemory.Close(); } finally { _streamMemory = null; } if (_isPlayer == true) _streamOut = new FifoStream(); _audioFrame = new AudioFrame(_isTest); _audioFrame.IsDetectingEvents = Properties.Settings.Default.SettingIsDetectingEvents; _audioFrame.AmplitudeThreshold = Properties.Settings.Default.SettingAmplitudeThreshold; _streamMemory = new MemoryStream(); Start(); } }
private void FormMain_Load(object sender, EventArgs e) { if (WaveNative.waveInGetNumDevs() == 0) { textBoxConsole.AppendText(DateTime.Now.ToString() + " : No audio input devices detected\r\n"); } else { textBoxConsole.AppendText(DateTime.Now.ToString() + " : Audio input device detected\r\n"); if (_isPlayer == true) _streamOut = new FifoStream(); _audioFrame = new AudioFrame(_isTest); _audioFrame.IsDetectingEvents = Properties.Settings.Default.SettingIsDetectingEvents; _audioFrame.AmplitudeThreshold = Properties.Settings.Default.SettingAmplitudeThreshold; _streamMemory = new MemoryStream(); neuralNetwork.setOutputErrorComponent(networkErrorLabel); neuralNetwork.learn(); double error = neuralNetwork.getError(); while(error>0.0004) { neuralNetwork.reduceError(); error = neuralNetwork.getError(); } _audioFrame.setNeuralNetwork(neuralNetwork); _audioFrame.setRobot(robot); Start(); } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { Stop(); if (_isSaving == true) { byte[] waveBuffer = new byte[Properties.Settings.Default.SettingBitsPerSample]; _streamWave = WaveStream.CreateStream(_streamMemory, _waveFormat); waveBuffer = new byte[_streamWave.Length - _streamWave.Position]; _streamWave.Read(waveBuffer, 0, waveBuffer.Length); if (Properties.Settings.Default.SettingOutputPath != "") _streamFile = new FileStream(Properties.Settings.Default.SettingOutputPath + "\\" + _sampleFilename, FileMode.Create); else _streamFile = new FileStream(_sampleFilename, FileMode.Create); _streamFile.Write(waveBuffer, 0, waveBuffer.Length); _isSaving = false; } if (_streamOut != null) try { _streamOut.Close(); } finally { _streamOut = null; } if (_streamWave != null) try { _streamWave.Close(); } finally { _streamWave = null; } if (_streamFile != null) try { _streamFile.Close(); } finally { _streamFile = null; } if (_streamMemory != null) try { _streamMemory.Close(); } finally { _streamMemory = null; } }
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) { Stop(); if (_isSaving == true) { byte[] waveBuffer = new byte[Properties.Settings.Default.SettingBitsPerSample]; _streamWave = WaveStream.CreateStream(_streamMemory, _waveFormat); waveBuffer = new byte[_streamWave.Length - _streamWave.Position]; _streamWave.Read(waveBuffer, 0, waveBuffer.Length); if (Properties.Settings.Default.SettingOutputPath != "") { _streamFile = new FileStream(Properties.Settings.Default.SettingOutputPath + "\\" + _sampleFilename, FileMode.Create); } else { _streamFile = new FileStream(_sampleFilename, FileMode.Create); } _streamFile.Write(waveBuffer, 0, waveBuffer.Length); _isSaving = false; } if (_streamOut != null) { try { _streamOut.Close(); } finally { _streamOut = null; } } if (_streamWave != null) { try { _streamWave.Close(); } finally { _streamWave = null; } } if (_streamFile != null) { try { _streamFile.Close(); } finally { _streamFile = null; } } if (_streamMemory != null) { try { _streamMemory.Close(); } finally { _streamMemory = null; } } }
private void settingsToolStripMenuItem_Click(object sender, EventArgs e) { FormSettingsDialog form = new FormSettingsDialog(); if (form.ShowDialog() == DialogResult.OK) { Stop(); if (_isSaving == true) { byte[] waveBuffer = new byte[Properties.Settings.Default.SettingBitsPerSample]; _streamWave = WaveStream.CreateStream(_streamMemory, _waveFormat); waveBuffer = new byte[_streamWave.Length - _streamWave.Position]; _streamWave.Read(waveBuffer, 0, waveBuffer.Length); _streamFile = new FileStream(_sampleFilename, FileMode.Create); _streamFile.Write(waveBuffer, 0, waveBuffer.Length); _isSaving = false; } if (_streamOut != null) { try { _streamOut.Close(); } finally { _streamOut = null; } } if (_streamWave != null) { try { _streamWave.Close(); } finally { _streamWave = null; } } if (_streamFile != null) { try { _streamFile.Close(); } finally { _streamFile = null; } } if (_streamMemory != null) { try { _streamMemory.Close(); } finally { _streamMemory = null; } } if (_isPlayer == true) { _streamOut = new FifoStream(); } _audioFrame = new AudioFrame(_isTest); _audioFrame.IsDetectingEvents = Properties.Settings.Default.SettingIsDetectingEvents; _audioFrame.AmplitudeThreshold = Properties.Settings.Default.SettingAmplitudeThreshold; _streamMemory = new MemoryStream(); Start(); } }