void SingleBlockNotificationStreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs e) { if (OnSampleCaptured != null) { OnSampleCaptured(e.Left, e.Right); } }
private void notificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { if (_analyser != null) { _analyser.Add(e.Left, e.Right); } }
private void singleBlockNotificationStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { if (blocks.Count > amnVisuals) { blocks.RemoveAt(0); } blocks.Add(e.Left + e.Right); //both is most even /* * if (blocks.Count > SAMPLE_SIZE) * blocks.RemoveAt(0); * * blocks.Add(e.Left + e.Right); //both is most even */ if (leftBlocks.Count > DUAL_SAMPLE_SIZE) { leftBlocks.RemoveAt(0); } if (rightBlocks.Count > DUAL_SAMPLE_SIZE) { rightBlocks.RemoveAt(0); } leftBlocks.Add(e.Left); rightBlocks.Add(e.Right); }
private void OnNotifyStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { _left = Math.Max((int)(Math.Abs(e.Left) * 10000), _left); _right = Math.Max((int)(Math.Abs(e.Right) * 10000), _right); if (++_peakUpdateCounter >= _waveIn.WaveFormat.SampleRate / 20) { Invoke(new MethodInvoker(() => { var amplitude = Math.Sqrt(_left * _left + _right * _right); if (minAmplitude > amplitude) { minAmplitude = amplitude; } if (maxAmplitude < amplitude) { maxAmplitude = amplitude; } sumAmplitude += amplitude; points++; var averageAmplitude = sumAmplitude / points; var dynamicRange = Math.Log10(maxAmplitude / minAmplitude); var parp = Math.Log10(maxAmplitude / averageAmplitude); lblDynRangeValue.Text = "" + dynamicRange; lblParpValue.Text = "" + parp; peakLeft.Value = _left; peakRight.Value = _right; _peakUpdateCounter = _left = _right = 0; })); } }
private void SampleSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { this.currentAudioBlock.left = e.Left; this.currentAudioBlock.right = e.Right; this.currentAudioBlock.samples = e.Channels > 2 && e.Samples != null ? e.Samples : new[] { e.Left, e.Right }; this.SingleBlockRead?.Invoke(this, e); }
private void NotificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { //Probably actions for readed data from source //Debug.Log("Left: " + e.Left + " \t\tRight: " + e.Right); buffer[sampleNumberForBuffer] = e.Left; buffer[sampleNumberForBuffer + 1] = e.Right; sampleNumberForBuffer = (sampleNumberForBuffer + 2) % bufferLength; notify(); }
private void SingleBlockNotificationStreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs e) { lock (_lockObject) { _left.Add(e.Left); _right.Add(e.Right); _fftProvider.Add(e.Left, e.Right); } }
private void InputStream_LeftSample(object sender, SingleBlockReadEventArgs e) { try { this.fftProvider.Add(e.Left, 0f); } catch (Exception) { } }
private void InputStream_RightSample(object sender, SingleBlockReadEventArgs e) { try { this.fftProvider.Add(0f, e.Right); } catch (Exception) { } }
public void SingleBlockRead(System.Object sender, SingleBlockReadEventArgs args) { fft1.Add(args.Left, args.Right); fft2.Add(args.Left, args.Right); leftChannel[leftChannelIndex++] = args.Left; if (leftChannelIndex >= leftChannel.Length) { leftChannelIndex %= leftChannel.Length; } }
private void InputStream(object sender, SingleBlockReadEventArgs e) { try { this.fftProvider.Add(e.Left, e.Right); } catch (Exception) { // ignored } }
private void addToFFTs(object sender, SingleBlockReadEventArgs e) { if (!SeparateChannels) { fftProvider.Add(e.Left, e.Right); return; } else { fftProvider.Add(e.Left, e.Left); fftProvider2.Add(e.Right, e.Right); } }
protected virtual void LoopbackAudioSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { Func <float, float> ClampFilter = x => Mathf.Clamp01(this.useFilter ? this.Filter(x * this.sensitivity, false) : x * this.sensitivity); var currentAudioBlock = AudioSourceController.LoopbackAudioSource.CurrentAudioBlock.Abs(); this.filteredSamples.samples = currentAudioBlock.samples; this.filteredSamples.left = this.filteredSamples.samples[0] = ClampFilter(currentAudioBlock.left); this.filteredSamples.right = this.filteredSamples.samples[1] = ClampFilter(currentAudioBlock.right); for (int i = 2; i < this.filteredSamples.samples.Length; ++i) { this.filteredSamples.samples[i] = ClampFilter(this.filteredSamples.samples[i]); } }
//float n = 0; //float a; void SingleBlockNotificationStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { float value = e.Left + e.Right; //n++; //a = a + (value - a) / n; //Debug.Log(a); //Remove first if full if (blocks1.Count > amnVisuals - 1f) { blocks1.RemoveAt(0); } //Add positive values if (value > 0) { blocks1.Add(value); } else { //blocks1.Add(0); } //Remove first if full if (blocks2.Count > amnVisuals - 1f) { blocks2.RemoveAt(0); } //Add negative values; if (value < 0) { blocks2.Add(value); } else { //blocks2.Add(0); } //if (blocks.Count > amnVisuals) // blocks.RemoveAt(0); //blocks.Add(e.Left + e.Right); //both is most even }
void SingleBlockNotificationStreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs e) { // Normalize incoming values. m_SourcePeak = Mathf.Max(m_SourcePeak, e.Left); m_SourcePeak = Mathf.Max(m_SourcePeak, e.Right); float renormalizationMultiplier = 1.0f / m_SourcePeak; renormalizationMultiplier = Mathf.Min(renormalizationMultiplier, m_NormalizationMaxMultiplier); float leftNormalized = e.Left * renormalizationMultiplier; float rightNormalized = e.Right * renormalizationMultiplier; m_HotValues.Add(leftNormalized, rightNormalized); if (VideoRecorderUtils.ActiveVideoRecording != null) { VideoRecorderUtils.ActiveVideoRecording.ProcessAudio(leftNormalized, rightNormalized); } }
private static void NStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { //Console.WriteLine(String.Join(",", e.Samples.Select(x => Math.Round(x, 4).ToString()))); if (queueBuf == null) { queueBuf = new float[(capture.WaveFormat.SampleRate * 6) / 50]; } queueBuf[counter * e.Samples.Length] = e.Samples[0]; queueBuf[counter * e.Samples.Length + 1] = e.Samples[2]; queueBuf[counter * e.Samples.Length + 2] = e.Samples[1]; queueBuf[counter * e.Samples.Length + 3] = e.Samples[4]; queueBuf[counter * e.Samples.Length + 4] = e.Samples[5]; queueBuf[counter * e.Samples.Length + 5] = e.Samples[3]; counter++; if (counter == (capture.WaveFormat.SampleRate / 50)) { lock (encoderLock) { sampleQueue.Enqueue(queueBuf); Monitor.PulseAll(encoderLock); } queueBuf = null; counter = 0; } //fstream.Write( e.Samples.Select(x=>(byte) x).ToArray(), 0, 6); //fstream.Close(); //if (e.Samples[0] != 0) //{ // Console.WriteLine("sample > 0"); //} }
private void VoiceChatCommandOnLocalBlockRead(object sender, SingleBlockReadEventArgs singleBlockReadEventArgs) { LocalVisualisationDataProvider.AddSamples(singleBlockReadEventArgs.Left, singleBlockReadEventArgs.Right); }
private void NotificationStreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs singleBlockReadEventArgs) { SingleBlockRead?.Invoke(this, singleBlockReadEventArgs); }
private void NotificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { //do something //spectrumProvider.Add(e.Left, e.Right); }
private void SingleBlockRead(object sender, SingleBlockReadEventArgs e) => fftProvider.Add(e.Left, e.Right);
private void InputStream_Sample(object sender, SingleBlockReadEventArgs e) { this.fftProvider.Add(e.Left, e.Right); }
private void NotificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { (_spectrum.SpectrumProvider as BasicSpectrumProvider).Add(e.Left, e.Right); }
public void SingleBlockRead(Object sender, SingleBlockReadEventArgs args) { fft.Add(args.Left, args.Right); }
private void SingleBlockNotificationStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { _lineSpectrumProvider.Add(e.Left, e.Right); _spectrogramProvider.Add(e.Left, e.Right); _oscilloscope.Add(e.Left, e.Right); }
private void UpdateMainVisualization(object sender, SingleBlockReadEventArgs e) { this._mainVisualization?.AddSamples(e.Left, e.Right); }
private void SingleBlockNotificationStreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs e) { l = e.Left; r = e.Right; _graphVisualization.AddSamples(e.Left, e.Right); }
private void StreamOnSingleBlockRead(object sender, SingleBlockReadEventArgs singleBlockReadEventArgs) => DataAvailable?.Invoke(singleBlockReadEventArgs.Left, singleBlockReadEventArgs.Right);
private void _notificationSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { recordedData.Add(e.Left); recordedData.Add(e.Right); spectrumProvider.Add(e.Left, e.Right); }
private void SingleBlockNotificationStream_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { _basicSpectrumProvider.Add(e.Left, e.Right); }
protected virtual void LoopbackAudioSource_SingleBlockRead(object sender, SingleBlockReadEventArgs e) { this.spectrumProvider.Add(e.Left, e.Right); }