Exemplo n.º 1
0
        private unsafe void Configure()
        {
            this._osc.SampleRate = this._sampleRate;
            this._osc.Frequency  = 57000.0;
            int i;

            for (i = 0; this._sampleRate >= (double)(20000 << i); i++)
            {
            }
            this._decimationFactor       = 1 << i;
            this._demodulationSampleRate = this._sampleRate / (double)this._decimationFactor;
            this._decimator = new DownConverter(this._demodulationSampleRate, this._decimationFactor);
            float[] coefficients = FilterBuilder.MakeLowPassKernel(this._demodulationSampleRate, 200, 2500.0, WindowType.BlackmanHarris4);
            this._baseBandFilter        = new IQFirFilter(coefficients, 1);
            this._pll->SampleRate       = (float)this._demodulationSampleRate;
            this._pll->DefaultFrequency = 0f;
            this._pll->Range            = 12f;
            this._pll->Bandwidth        = 1f;
            this._pll->Zeta             = 0.707f;
            this._pll->LockTime         = 0.5f;
            this._pll->LockThreshold    = 3.2f;
            int length = (int)(this._demodulationSampleRate / 1187.5) | 1;

            coefficients        = FilterBuilder.MakeSin(this._demodulationSampleRate, 1187.5, length);
            this._matchedFilter = new FirFilter(coefficients, 1);
            this._syncFilter->Init(IirFilterType.BandPass, 1187.5, this._demodulationSampleRate, 500.0);
        }
Exemplo n.º 2
0
        private unsafe void Configure()
        {
            this._osc->SampleRate = this._sampleRate;
            this._osc->Frequency  = 57000.0;
            int i;

            for (i = 0; this._sampleRate >= 20000.0 * Math.Pow(2.0, (double)i); i++)
            {
            }
            this._decimator              = new IQDecimator(i, this._sampleRate, true, false);
            this._decimationFactor       = (int)Math.Pow(2.0, (double)i);
            this._demodulationSampleRate = this._sampleRate / (double)this._decimationFactor;
            float[] coefficients = FilterBuilder.MakeLowPassKernel(this._demodulationSampleRate, 200, 2500.0, WindowType.BlackmanHarris4);
            this._baseBandFilter.SetCoefficients(coefficients);
            this._pll->SampleRate       = (float)this._demodulationSampleRate;
            this._pll->DefaultFrequency = 0f;
            this._pll->Range            = 12f;
            this._pll->Bandwidth        = 1f;
            this._pll->Zeta             = 0.707f;
            this._pll->LockTime         = 0.5f;
            this._pll->LockThreshold    = 3.2f;
            int length = (int)(this._demodulationSampleRate / 1187.5) | 1;

            coefficients = FilterBuilder.MakeSin(this._demodulationSampleRate, 1187.5, length);
            this._matchedFilter.SetCoefficients(coefficients);
            this._syncFilter->Init(IirFilterType.BandPass, 1187.5, this._demodulationSampleRate, 500);
        }
Exemplo n.º 3
0
        private void Configure()
        {
            _osc->SampleRate = _sampleRate;
            _osc->Frequency  = PllDefaultFrequency;

            var decimationStageCount = 0;

            while (_sampleRate >= 20000 * Math.Pow(2.0, decimationStageCount))
            {
                decimationStageCount++;
            }

            _decimator              = new IQDecimator(decimationStageCount, _sampleRate, true, false);
            _decimationFactor       = (int)Math.Pow(2.0, decimationStageCount);
            _demodulationSampleRate = _sampleRate / _decimationFactor;

            var coefficients = FilterBuilder.MakeLowPassKernel(_demodulationSampleRate, 200, 2500, WindowType.BlackmanHarris4);

            _baseBandFilter.SetCoefficients(coefficients);

            _pll->SampleRate       = (float)_demodulationSampleRate;
            _pll->DefaultFrequency = 0;
            _pll->Range            = PllRange;
            _pll->Bandwidth        = PllBandwith;
            _pll->Zeta             = PllZeta;
            _pll->LockTime         = PllLockTime;
            _pll->LockThreshold    = PllLockThreshold;

            var matchedFilterLength = (int)(_demodulationSampleRate / RdsBitRate) | 1;

            coefficients = FilterBuilder.MakeSin(_demodulationSampleRate, RdsBitRate, matchedFilterLength);
            _matchedFilter.SetCoefficients(coefficients);

            _syncFilter->Init(IirFilterType.BandPass, RdsBitRate, _demodulationSampleRate, 500);
        }