示例#1
0
        public SpectrogramCepstral(AmplitudeSonogram sg, int minHz, int maxHz)
            : this(sg)
        {
            this.DecibelsPerFrame   = sg.DecibelsPerFrame;
            this.DecibelsNormalised = sg.DecibelsNormalised;
            this.Duration           = sg.Duration;
            this.FrameCount         = sg.FrameCount;
            this.DecibelReference   = sg.DecibelReference;
            this.MaxAmplitude       = sg.MaxAmplitude;
            this.SampleRate         = sg.SampleRate;
            this.SigState           = sg.SigState;
            this.SnrData            = sg.SnrData;

            // subband highlighting no longer available
            //this.subBandMinHz = minHz;
            //this.subBandMaxHz = maxHz;

            //double[] noise_subband = BaseSonogram.ExtractModalNoiseSubband(this.SnrData.ModalNoiseProfile, minHz, maxHz, sg.doMelScale,
            //                                                   sonogram.Configuration.FreqBinCount, sonogram.FBinWidth);
            this.Data = SpectrogramTools.ExtractFreqSubband(sg.Data, minHz, maxHz,
                                                            this.Configuration.DoMelScale, sg.Configuration.FreqBinCount, sg.FBinWidth);

            // NO LONGER DO THIS >>>>             CalculateSubbandSNR(this.Data);
            this.Make(this.Data);          //converts amplitude matrix to cepstral sonogram
        }
示例#2
0
        /// <summary>
        /// The data passed to this method must be the Spectral sonogram.
        /// </summary>
        public static Tuple <double[, ], double[]> GetCepstrogram(double[,] data, int minHz, int maxHz,
                                                                  int freqBinCount, double freqBinWidth, bool doMelScale, int ccCount)
        {
            ImageTools.DrawMatrix(data, @"C:\SensorNetworks\Output\MFCC_LewinsRail\tempImage1.jpg", false);
            double[,] m = SpectrogramTools.ExtractFreqSubband(data, minHz, maxHz, doMelScale, freqBinCount, freqBinWidth);
            ImageTools.DrawMatrix(m, @"C:\SensorNetworks\Output\MFCC_LewinsRail\tempImage2.jpg", false);

            //DO NOT DO NOISE REDUCTION BECAUSE ALREADY DONE
            //double[] modalNoise = SNR.CalculateModalNoise(m, 7); //calculate modal noise profile and smooth
            //m = SNR.NoiseReduce_Standard(m, modalNoise);
            //m = SNR.NoiseReduce_FixedRange(m, this.Configuration.DynamicRange);

            m = MFCCStuff.Cepstra(m, ccCount);
            m = DataTools.normalise(m);
            ImageTools.DrawMatrix(m, @"C:\SensorNetworks\Output\MFCC_LewinsRail\tempImage3.jpg", false);
            return(Tuple.Create(m, (double[])null));
        }