private void StartListening() { int sampleRate = 6000; int fftSize = 1 << (9 + cbFftSize.SelectedIndex); int stepSize = fftSize / 20; pbSpectrogram.Image?.Dispose(); pbSpectrogram.Image = null; listener?.Dispose(); listener = new Listener(cbDevice.SelectedIndex, sampleRate); spec = new Spectrogram(sampleRate, fftSize, stepSize); //spec.SetWindow(FftSharp.Window.Rectangular(fftSize)); pbSpectrogram.Height = spec.Height; pbScaleVert.Image?.Dispose(); pbScaleVert.Image = spec.GetVerticalScale(pbScaleVert.Width); pbScaleVert.Height = spec.Height; }