Ejemplo n.º 1
0
        public LogFilterbank(double scale, double @base, double centsperband, double overlap)
        {
            scale_        = scale;
            centsperband_ = centsperband;
            logstart_     = SpectrogramUtils.Freq2Cent(@base);
            logstep_      = (1 - overlap) * centsperband_;

            Console.Out.WriteLine("Cents per band: {0}", centsperband_);
            Console.Out.WriteLine("Logstep: {0}", logstep_);
            Debug.Assert(logstep_ > 0);
        }
Ejemplo n.º 2
0
        public void ApplyWindow(ref Complex[] chunk, int lowidx, double filterscale)
        {
            int highidx = lowidx + chunk.Length;

            if (frequency_axis == AxisScale.SCALE_LINEAR)
            {
                for (int i = 0; i < chunk.Length; ++i)
                {
                    chunk[i] *= SpectrogramUtils.WindowCoef((double)i / (chunk.Length - 1), window);
                }
            }
            else
            {
                double rloglow  = SpectrogramUtils.Freq2Cent(lowidx / filterscale);              // after rounding
                double rloghigh = SpectrogramUtils.Freq2Cent((highidx - 1) / filterscale);
                for (int i = 0; i < chunk.Length; ++i)
                {
                    double logidx = SpectrogramUtils.Freq2Cent((lowidx + i) / filterscale);
                    double winidx = (logidx - rloglow) / (rloghigh - rloglow);
                    chunk[i] *= SpectrogramUtils.WindowCoef(winidx, window);
                }
            }
        }
Ejemplo n.º 3
0
 public override double NumBandsEst(double maxfreq)
 {
     return((SpectrogramUtils.Freq2Cent(maxfreq) - logstart_) / logstep_ + 4);
 }