From e78d2339ffea554096ab415953ff12a6a57aedff Mon Sep 17 00:00:00 2001 From: Denny Date: Sat, 27 Jan 2018 16:27:58 -0500 Subject: [PATCH] WIP - aligns the SynthesizerViewer configuration with that of the ChannelizerViewer so that we can compare the two-channel synthesis operations. The SynthesizerViewer is successfully down-sampling and synthesizing two 25.0 kHz channels into a combined 25.0 kHz channel with no noticeable drop/nulling in the joined region. However, the channelizer viewer's synthesized channels definitely have a null in the joined region. I suspect that the channelizer is not quite where it needs to be and am going to start experimenting there. --- .../dsp/filter/channelizer/ChannelizerViewer.java | 2 +- .../filter/channelizer/PolyphaseChannelManager.java | 4 ++-- .../dsp/filter/channelizer/SynthesizerViewer.java | 12 +++++++----- 3 files changed, 10 insertions(+), 8 deletions(-) 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 fba3a9da..94ce0f31 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 @@ -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(28); + mSpectrumPanel.setSampleSize(22); add(mSpectrumPanel, "span"); add(new JLabel("Center:" + frequency)); 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 cae8b91a..be617313 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 = 17; + private static final int POLYPHASE_FILTER_TAPS_PER_CHANNEL = 19; private Broadcaster mSourceEventBroadcaster = new Broadcaster<>(); private IComplexBufferProvider mComplexBufferProvider; @@ -483,7 +483,7 @@ public class PolyphaseChannelManager implements ISourceEventProcessor if(taps == null) { - taps = FilterFactory.getSincM2Synthesizer(mChannelCalculator.getChannelSampleRate(), channels, + taps = FilterFactory.getSincM2Synthesizer(mChannelCalculator.getChannelBandwidth(), channels, POLYPHASE_FILTER_TAPS_PER_CHANNEL, Window.WindowType.BLACKMAN_HARRIS_7, true); mOutputProcessorFilters.put(channels, taps); diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/SynthesizerViewer.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/SynthesizerViewer.java index 33e728bd..94de48c7 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/SynthesizerViewer.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/SynthesizerViewer.java @@ -18,6 +18,7 @@ package io.github.dsheirer.dsp.filter.channelizer; import io.github.dsheirer.dsp.filter.FilterFactory; import io.github.dsheirer.dsp.filter.Window; import io.github.dsheirer.dsp.filter.design.FilterDesignException; +import io.github.dsheirer.dsp.mixer.FS4DownConverter; import io.github.dsheirer.dsp.mixer.IOscillator; import io.github.dsheirer.dsp.mixer.LowPhaseNoiseOscillator; import io.github.dsheirer.sample.Listener; @@ -149,7 +150,7 @@ public class SynthesizerViewer extends JFrame { setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill]")); mSpectrumPanel = new SpectrumPanel(settingsManager); - mSpectrumPanel.setSampleSize(12); + mSpectrumPanel.setSampleSize(22); add(mSpectrumPanel); mDFTProcessor.addConverter(mComplexDecibelConverter); @@ -190,7 +191,7 @@ public class SynthesizerViewer extends JFrame { setLayout(new MigLayout("insets 0 0 0 0", "[grow,fill]", "[grow,fill][]")); mSpectrumPanel = new SpectrumPanel(settingsManager); - mSpectrumPanel.setSampleSize(12); + mSpectrumPanel.setSampleSize(22); add(mSpectrumPanel, "wrap"); add(channelControlPanel); @@ -235,12 +236,11 @@ public class SynthesizerViewer extends JFrame public class ChannelControlPanel extends JPanel { - private static final int SAMPLE_RATE = 25000; private static final int MIN_FREQUENCY = -6250; private static final int MAX_FREQUENCY = 6250; private static final int DEFAULT_FREQUENCY = 50; - private IOscillator mOscillator = new LowPhaseNoiseOscillator(6000, CHANNEL_SAMPLE_RATE); + private IOscillator mOscillator = new LowPhaseNoiseOscillator(DEFAULT_FREQUENCY, CHANNEL_SAMPLE_RATE); public ChannelControlPanel() { @@ -272,7 +272,8 @@ public class SynthesizerViewer extends JFrame public class DataGenerationManager implements Runnable { private TwoChannelSynthesizerM2 mSynthesizer; - private int mSamplesPerCycle = 25000 / DATA_GENERATOR_FRAME_RATE; + private FS4DownConverter mFS4DownConverter = new FS4DownConverter(); + private int mSamplesPerCycle = CHANNEL_SAMPLE_RATE / DATA_GENERATOR_FRAME_RATE; public DataGenerationManager() { @@ -295,6 +296,7 @@ public class SynthesizerViewer extends JFrame float[] channel2 = getChannel2ControlPanel().getOscillator().generateComplex(mSamplesPerCycle); float[] synthesized = mSynthesizer.process(channel1, channel2); + mFS4DownConverter.mixComplex(synthesized); getChannel1Panel().receive(new ComplexBuffer(channel1)); getChannel2Panel().receive(new ComplexBuffer(channel2));