From fcd3c2fd46bb7ddd8715e4ea2d77a26227e526ee Mon Sep 17 00:00:00 2001 From: Denny Date: Sun, 28 Jan 2018 10:52:53 -0500 Subject: [PATCH] [WIP] channelizer and 1/2 channel output processors along with the 2 channel synthesizer ... all appear to be functional. --- .../dsheirer/dsp/filter/FilterFactory.java | 2 +- .../filter/channelizer/ChannelizerViewer.java | 20 ++++++++-------- .../channelizer/PolyphaseChannelManager.java | 2 +- .../output/TwoChannelOutputProcessor.java | 12 ++-------- .../dsp/mixer/LowPhaseNoiseOscillator.java | 23 ------------------- .../tuner/test/TestTunerController.java | 2 +- 6 files changed, 15 insertions(+), 46 deletions(-) diff --git a/src/main/java/io/github/dsheirer/dsp/filter/FilterFactory.java b/src/main/java/io/github/dsheirer/dsp/filter/FilterFactory.java index bafa24fc..440400f9 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/FilterFactory.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/FilterFactory.java @@ -740,7 +740,7 @@ public class FilterFactory public static float[] getSincM2Channelizer(double channelBandwidth, int channels, int tapsPerChannel, Window.WindowType windowType, boolean logResults) throws FilterDesignException { - return getSincFilter(channelBandwidth * channels * 2.0, channelBandwidth, + return getSincFilter(channelBandwidth * channels, channelBandwidth, channels, tapsPerChannel, windowType,logResults); } diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelizerViewer.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelizerViewer.java index 94ce0f31..8b1f8d8d 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelizerViewer.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ChannelizerViewer.java @@ -91,7 +91,7 @@ public class ChannelizerViewer extends JFrame private void init() { setTitle("Polyphase Channelizer Viewer"); - setSize(1000, 800); + setSize(1200, 800); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill]")); setLocationRelativeTo(null); @@ -119,7 +119,7 @@ public class ChannelizerViewer extends JFrame { mPrimarySpectrumPanel = new PrimarySpectrumPanel(mSettingsManager, mTestTuner.getTunerController().getSampleRate()); - mPrimarySpectrumPanel.setPreferredSize(new Dimension(1000, 200)); + mPrimarySpectrumPanel.setPreferredSize(new Dimension(1200, 200)); mPrimarySpectrumPanel.setDFTSize(mMainPanelDFTSize); mTestTuner.getTunerController().addComplexBufferListener(mPrimarySpectrumPanel); } @@ -135,8 +135,8 @@ public class ChannelizerViewer extends JFrame mControlPanel.setLayout(new MigLayout("insets 0 0 0 0", "", "")); mControlPanel.add(new JLabel("Tone:"), "align left"); - long minimumFrequency = -(long)mTestTuner.getTunerController().getSampleRate() / 2; - long maximumFrequency = (long)mTestTuner.getTunerController().getSampleRate() / 2; + long minimumFrequency = -(long)mTestTuner.getTunerController().getSampleRate() / 2 + 1; + long maximumFrequency = (long)mTestTuner.getTunerController().getSampleRate() / 2 - 1; long toneFrequency = 0; SpinnerNumberModel model = new SpinnerNumberModel(toneFrequency, minimumFrequency, maximumFrequency, @@ -310,7 +310,7 @@ public class ChannelizerViewer extends JFrame { setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill]")); mSpectrumPanel = new SpectrumPanel(settingsManager); - mSpectrumPanel.setSampleSize(26); + mSpectrumPanel.setSampleSize(16); add(mSpectrumPanel); mDFTProcessor.addConverter(mComplexDecibelConverter); @@ -349,7 +349,7 @@ public class ChannelizerViewer extends JFrame { setLayout(new MigLayout("insets 0 0 0 0", "[center,grow,fill][]", "[grow,fill][]")); mSpectrumPanel = new SpectrumPanel(settingsManager); - mSpectrumPanel.setSampleSize(22); + mSpectrumPanel.setSampleSize(16); add(mSpectrumPanel, "span"); add(new JLabel("Center:" + frequency)); @@ -362,7 +362,7 @@ public class ChannelizerViewer extends JFrame mLoggingEnabled = mLoggingButton.isSelected(); } }); - add(mLoggingButton); +// add(mLoggingButton); mDFTProcessor.addConverter(mComplexDecibelConverter); mDFTProcessor.process(SourceEvent.sampleRateChange(sampleRate)); @@ -433,7 +433,7 @@ public class ChannelizerViewer extends JFrame mSource = source; setLayout(new MigLayout("insets 0 0 0 0", "[center,grow,fill][]", "[grow,fill][]")); mSpectrumPanel = new SpectrumPanel(settingsManager); - mSpectrumPanel.setSampleSize(28); + mSpectrumPanel.setSampleSize(16); add(mSpectrumPanel, "span"); add(new JLabel("Index:" + index)); @@ -446,7 +446,7 @@ public class ChannelizerViewer extends JFrame mLoggingEnabled = mLoggingButton.isSelected(); } }); - add(mLoggingButton); +// add(mLoggingButton); mDFTProcessor.addConverter(mComplexDecibelConverter); mDFTProcessor.process(SourceEvent.sampleRateChange(25000.0)); @@ -507,7 +507,7 @@ public class ChannelizerViewer extends JFrame if(useGUI) { - int channelsPerRow = 8; + int channelsPerRow = 16; final ChannelizerViewer frame = new ChannelizerViewer(channelsPerRow); diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java index be617313..ccc13d1d 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java @@ -49,7 +49,7 @@ public class PolyphaseChannelManager implements ISourceEventProcessor private final static Logger mLog = LoggerFactory.getLogger(PolyphaseChannelManager.class); private static final double MINIMUM_CHANNEL_BANDWIDTH = 12500.0; private static final double CHANNEL_OVERSAMPLING = 2.0; - private static final int POLYPHASE_FILTER_TAPS_PER_CHANNEL = 19; + private static final int POLYPHASE_FILTER_TAPS_PER_CHANNEL = 17; private Broadcaster mSourceEventBroadcaster = new Broadcaster<>(); private IComplexBufferProvider mComplexBufferProvider; diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/TwoChannelOutputProcessor.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/TwoChannelOutputProcessor.java index 1ca55983..7b30e2ed 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/TwoChannelOutputProcessor.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/TwoChannelOutputProcessor.java @@ -15,10 +15,8 @@ ******************************************************************************/ package io.github.dsheirer.dsp.filter.channelizer.output; -import io.github.dsheirer.dsp.filter.Filters; import io.github.dsheirer.dsp.filter.channelizer.PolyphaseChannelResultsBuffer; import io.github.dsheirer.dsp.filter.channelizer.TwoChannelSynthesizerM2; -import io.github.dsheirer.dsp.filter.fir.complex.ComplexFIRFilter; import io.github.dsheirer.dsp.mixer.FS4DownConverter; import io.github.dsheirer.sample.complex.TimestampedBufferAssembler; import org.slf4j.Logger; @@ -28,8 +26,6 @@ import java.util.List; public class TwoChannelOutputProcessor extends ChannelOutputProcessor { - private ComplexFIRFilter mLowPassFilter = - new ComplexFIRFilter(Filters.HALF_BAND_FILTER_47T.getCoefficients(), 1.0f); private TwoChannelSynthesizerM2 mSynthesizer; private FS4DownConverter mFS4DownConverter = new FS4DownConverter(); @@ -113,13 +109,9 @@ public class TwoChannelOutputProcessor extends ChannelOutputProcessor //The synthesized channels are centered at +FS/4 ... downconvert to center the spectrum mFS4DownConverter.mixComplex(synthesized); - //Apply frequency correction to center the signal of interest within the synthesized channel -// getFrequencyCorrectionMixer().mixComplex(synthesized); + //Apply offset and frequency correction to center the signal of interest within the synthesized channel + getFrequencyCorrectionMixer().mixComplex(synthesized); - //Apply low-pass filtering to attenuate neighboring channel(s) -// synthesized = mLowPassFilter.filter(synthesized); - - //Send it on its merry way ... timestampedBufferAssembler.receive(synthesized); } } diff --git a/src/main/java/io/github/dsheirer/dsp/mixer/LowPhaseNoiseOscillator.java b/src/main/java/io/github/dsheirer/dsp/mixer/LowPhaseNoiseOscillator.java index 76171c27..09c772d0 100644 --- a/src/main/java/io/github/dsheirer/dsp/mixer/LowPhaseNoiseOscillator.java +++ b/src/main/java/io/github/dsheirer/dsp/mixer/LowPhaseNoiseOscillator.java @@ -31,7 +31,6 @@ public class LowPhaseNoiseOscillator extends AbstractOscillator private double mCosineAngle; private double mSineAngle; private double mGain = 1.0; - private boolean mReset; /** * Ultra-low phase noise complex oscillator as described in Digital Signal Processing 3e, Lyons, p.786 @@ -46,19 +45,6 @@ public class LowPhaseNoiseOscillator extends AbstractOscillator update(); } - /** - * Sets the frequency of the tone generated by this oscillator. - */ - @Override - public void setFrequency(double frequency) - { - //This oscillator does not recover when the current frequency is equal to exactly half the sample rate, so we - //have to set a flag to reset the I/Q structures when changing the frequency from exactly half the sample rate. - mReset = getFrequency() < 0.01 || Math.abs(getFrequency()) - (getSampleRate() / 2) < 1.0; - - super.setFrequency(frequency); - } - @Override public float quadrature() { @@ -80,15 +66,6 @@ public class LowPhaseNoiseOscillator extends AbstractOscillator mCosineAngle = Math.cos(anglePerSample); mSineAngle = Math.sin(anglePerSample); - - if(mReset) - { - mInphase = 1.0; - mQuadrature = 0.0; - mPreviousInphase = 1.0; - mPreviousQuadrature = 0.0; - mReset = false; - } } /** diff --git a/src/main/java/io/github/dsheirer/source/tuner/test/TestTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/test/TestTunerController.java index bedb5bfd..c9dac7ce 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/test/TestTunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/test/TestTunerController.java @@ -32,7 +32,7 @@ public class TestTunerController extends TunerController public static final long MINIMUM_FREQUENCY = 1l; public static final long MAXIMUM_FREQUENCY = 1000000000l; - public static final int SAMPLE_RATE = 50000; + public static final int SAMPLE_RATE = 800000; public static final int DC_NOISE_BANDWIDTH = 0; public static final double USABLE_BANDWIDTH = 1.00;