예제 #1
0
        /**
         * Create a new BandpassPipeable with the following properties
         * @param sampleRate the sampleRate of the underlying adapter
         * @param channels the number of channels of the underlying adapter
         * @param minFreq minimum cut-off frequency for all channels, interpreted as the center of the frequency cutoff
         * @param maxFreq maximum cut-off frequency for all channels, interpreted as the center of the frequenct cutoff
         * @param transitionBandwidth signal attentuation will start at fC - transitionBandwidth/2 and end at fC + transitionBandwidth / 2
         */
        public BandpassPipeable(
            double sampleRate,
            int channels,
            double minFreq,
            double maxFreq,
            double transitionBandwidth)
        {
            signalFilters = new IFilter <double> [channels];
            buffer        = new double[channels];

            for (int i = 0; i < channels; i++)
            {
                signalFilters[i] = new ConvolvingDoubleEndedFilter(minFreq, maxFreq, transitionBandwidth, sampleRate, true);
            }
        }
예제 #2
0
        // end artifact fields

        public SimpleFilterPipeable(
            double sampleRate,
            int channels,
            double minFreq,
            double maxFreq,
            double transitionBandwidth,
            double artifactLearningTime)
        {
            artifactLearningSize = (int)Math.Round(sampleRate * artifactLearningTime);

            signalFilters           = new IFilter <double> [channels];
            artifactLearningSamples = new Queue <double> [channels];
            arPredictors            = new ARModel[channels];
            lastPredictions         = new double[channels];
            arError = new OnlineVariance[channels];

            for (int i = 0; i < channels; i++)
            {
                signalFilters[i]           = new ConvolvingDoubleEndedFilter(minFreq, maxFreq, transitionBandwidth, sampleRate, true);
                artifactLearningSamples[i] = new Queue <double>();
                arError[i] = new OnlineVariance();
            }
        }