public DefaultSpectrogramConfig()
 {
     Overlap = 64;
     WdftSize = 2048;
     FrequencyRange = new FrequencyRange { Min = 318, Max = 2000 };
     LogBase = 2;
     LogBins = 32;
     ImageLength = 128;
     UseDynamicLogBase = false;
     NormalizeSignal = false;
     Stride = new IncrementalStaticStride(5115, ImageLength * Overlap);
 }
 public DefaultFingerprintingConfiguration()
 {
     FingerprintLength = 128;
     Overlap = 64;
     SamplesPerFingerprint = FingerprintLength * Overlap;
     WdftSize = 2048;
     MinFrequency = 318;
     MaxFrequency = 2000;
     TopWavelets = 200;
     SampleRate = 5512;
     LogBase = 2;
     Stride = new IncrementalStaticStride(5115, FingerprintLength * Overlap);
     LogBins = 32;
     NormalizeSignal = false;
     UseDynamicLogBase = false;
 }
 public void IncrementalStaticStrideTest()
 {
     IncrementalStaticStride incrementalStatic = new IncrementalStaticStride(5115);
     Assert.AreEqual(5115 - 8192, incrementalStatic.NextStride);
 }
Example #4
0
 public void IncrementalStaticStrideTest()
 {
     IncrementalStaticStride incrementalStatic = new IncrementalStaticStride(5115, SamplesPerFingerprint);
     Assert.AreEqual(5115 - SamplesPerFingerprint, incrementalStatic.GetNextStride());
 }
        public void CutLogarithmizedSpectrumWithAnIncrementalStaticStride()
        {
            var stride = new IncrementalStaticStride(new DefaultFingerprintConfiguration().SamplesPerFingerprint / 2, new DefaultFingerprintConfiguration().SamplesPerFingerprint, 0);
            var config = new CustomSpectrogramConfig { Stride = stride };
            int logSpectrumLength = (config.ImageLength * 24) + config.Overlap;
            var logSpectrum = GetLogSpectrum(logSpectrumLength);

            var cutLogarithmizedSpectrum = spectrumService.CutLogarithmizedSpectrum(logSpectrum, SampleRate, config);
            
            Assert.AreEqual(48, cutLogarithmizedSpectrum.Count);
            double lengthOfOneFingerprint = (double)config.ImageLength * config.Overlap / SampleRate;
            for (int i = 0; i < cutLogarithmizedSpectrum.Count; i++)
            {
                Assert.IsTrue(System.Math.Abs(cutLogarithmizedSpectrum[i].Timestamp - (i * lengthOfOneFingerprint / 2)) < Epsilon);
            }
        }
        public void CutLogarithmizedSpectrumWithAnIncrementalStaticStride()
        {
            DefaultFingerprintConfiguration config = new DefaultFingerprintConfiguration();
            int logSpectrumLength = (config.FingerprintLength * 24) + config.Overlap;
            var stride = new IncrementalStaticStride(config.SamplesPerFingerprint / 2, config.SamplesPerFingerprint, 0);
            var logSpectrum = new float[logSpectrumLength][];
            for (int i = 0; i < logSpectrumLength; i++)
            {
                logSpectrum[i] = new float[32];
            }

            var cutLogarithmizedSpectrum = spectrumService.CutLogarithmizedSpectrum(logSpectrum, stride, config.FingerprintLength, config.Overlap);

            Assert.AreEqual(48, cutLogarithmizedSpectrum.Count);
        }