//TODO: Only for testing / dev purposes. Remove on final build private void QuickSaveSnippet() { string filename = "C:\\Users\\Natalie\\Documents\\wavs\\snips\\QuickSave.wav"; FFTs stft_copy = stft.Copy(); if (selectedIndices.Exists()) { stft_copy.SaveSnippet(filename, selectedIndices.Indices().timeIndex1, selectedIndices.Indices().timeIndex2); } else { stft_copy.SaveToWav(filename); } }
//Sets up a listener for the selected microphone and initializes a spectrogram display public void StartListening() { int sampleRate = Int32.Parse(sampleRates[cbSampleRate.SelectedIndex]); int fftSize = 1 << (9 + cbFFTsize.SelectedIndex); int stepSize = fftSize - (int)(fftSize * overlap); listener?.Dispose(); listener = new Listener(cbMicInput.SelectedIndex, sampleRate); spec = new Spectrogram.Spectrogram(sampleRate, fftSize, stepSize); if (cmaps != null) { spec.SetColormap(cmaps[cbCmaps.SelectedIndex]); //todo this is a hack for this running before SpecInit } stft = new FFTs(spec.GetFFTs(), spec.SampleRate, spec.StepSize, spec.GetWindow()); }
private double[] FFT(List <short> ls) { int acac = 32768; double[] inin = new double[acac]; double[] outout = new double[acac]; for (int j = 0; j < acac; j++) { inin[j] = (double)ls[j]; outout[j] = (double)0; } FFTs fft = new FFTs(); int a = fft.upFFT(inin, outout, 1); return(inin); }
public void ApplyGain(double dbGain, bool applyToWindow = false) { FFTs stft = parentRef.GetSTFT(); SelectedWindowIndices indices = parentRef.GetSelectedWindowIndices(); if (applyToWindow) { if (!indices.Exists()) { MessageBox.Show("There is no window selected!"); return; } Processing.AddGain(stft, dbGain, indices, dB: true); } else { Processing.AddGain(stft, dbGain, dB: true); } }
public void ApplyWhiteNoiseFilter(double threshold, bool applyToWindow = false) { FFTs stft = parentRef.GetSTFT(); SelectedWindowIndices indices = parentRef.GetSelectedWindowIndices(); if (applyToWindow) { if (!indices.Exists()) { MessageBox.Show("There is no window selected!"); return; } Filters.WhiteNoiseFilter(stft, threshold, indices); } else { Filters.WhiteNoiseFilter(stft, threshold); } }