Example #1
0
    public LogFilterbank(double scale, double @base, double centsperband, double overlap)
    {
        scale_        = scale;
        centsperband_ = centsperband;
        logstart_     = GlobalMembersSpectrogram.freq2cent(@base);
        logstep_      = (1 - overlap) * centsperband_;

        Console.Out.WriteLine("centsperband_: {0}", centsperband_);
        Console.Out.WriteLine("logstep_: {0}", logstep_);
        Debug.Assert(logstep_ > 0);
    }
Example #2
0
    public void apply_window(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] *= GlobalMembersSpectrogram.window_coef((double)i / (chunk.Length - 1), window);
            }
        }
        else
        {
            double rloglow  = GlobalMembersSpectrogram.freq2cent(lowidx / filterscale);          // after rounding
            double rloghigh = GlobalMembersSpectrogram.freq2cent((highidx - 1) / filterscale);
            for (int i = 0; i < chunk.Length; ++i)
            {
                double logidx = GlobalMembersSpectrogram.freq2cent((lowidx + i) / filterscale);
                double winidx = (logidx - rloglow) / (rloghigh - rloglow);
                chunk[i] *= GlobalMembersSpectrogram.window_coef(winidx, window);
            }
        }
    }
Example #3
0
 public override double num_bands_est(double maxfreq)
 {
     return((GlobalMembersSpectrogram.freq2cent(maxfreq) - logstart_) / logstep_ + 4);
 }