Example #1
0
        private void computeButton_Click(object sender, EventArgs e)
        {
            var frameSize         = float.Parse(analysisFftTextBox.Text);
            var hopSize           = float.Parse(hopSizeTextBox.Text);
            var modulationFftSize = int.Parse(longTermFftSizeTextBox.Text);
            var modulationHopSize = int.Parse(longTermHopSizeTextBox.Text);

            // ===== test modulation spectrum for Mfcc features =====
            //
            //var mfccExtractor = new MfccExtractor(13, _signal.SamplingRate,
            //                                          frameSize: frameSize,
            //                                          hopSize: hopSize);
            //var vectors = mfccExtractor.ComputeFrom(_signal);
            //FeaturePostProcessing.NormalizeMean(vectors);

            //_extractor = new AmsExtractor(_signal.SamplingRate,
            //                             frameSize, hopSize,
            //                             modulationFftSize, modulationHopSize,
            //                             featuregram: vectors.Select(v => v.Features));

            _extractor = new AmsExtractor(frameSize, hopSize,
                                          modulationFftSize, modulationHopSize,
                                          filterbank: _filterbank, window: WindowTypes.Hamming);
            _features  = _extractor.ComputeFrom(_signal);
            _featIndex = 0;

            infoLabel.Text = $"{_features.Count}x{_features[0].Features.Length}";

            DrawEnvelopes(_extractor.Envelopes);
            DrawModulationSpectrum(_extractor.MakeSpectrum2D(_features[_featIndex]));
        }