mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-17 11:07:35 -05:00
[WIP] Using different filters
This commit is contained in:
@@ -19,6 +19,9 @@
|
|||||||
package dsp.filter.channelizer;
|
package dsp.filter.channelizer;
|
||||||
|
|
||||||
import dsp.filter.FilterFactory;
|
import dsp.filter.FilterFactory;
|
||||||
|
import dsp.filter.design.FilterDesignException;
|
||||||
|
import dsp.filter.fir.FIRFilterSpecification;
|
||||||
|
import dsp.filter.fir.remez.RemezFIRFilterDesigner;
|
||||||
import dsp.mixer.LowPhaseNoiseOscillator;
|
import dsp.mixer.LowPhaseNoiseOscillator;
|
||||||
import dsp.mixer.Oscillator;
|
import dsp.mixer.Oscillator;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@@ -65,7 +68,7 @@ public class ChannelizerViewer extends JFrame
|
|||||||
{
|
{
|
||||||
mChannelCount = channelCount;
|
mChannelCount = channelCount;
|
||||||
mSampleRate = mChannelCount * CHANNEL_BANDWIDTH;
|
mSampleRate = mChannelCount * CHANNEL_BANDWIDTH;
|
||||||
mToneFrequency = (int)(CHANNEL_BANDWIDTH * 3); //Set to channel 1 as default
|
mToneFrequency = (int)(CHANNEL_BANDWIDTH * 1); //Set to channel 1 as default
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -143,7 +146,7 @@ public class ChannelizerViewer extends JFrame
|
|||||||
int maximumFrequency = mSampleRate / 2;
|
int maximumFrequency = mSampleRate / 2;
|
||||||
|
|
||||||
SpinnerNumberModel model = new SpinnerNumberModel(mToneFrequency, -maximumFrequency, maximumFrequency,
|
SpinnerNumberModel model = new SpinnerNumberModel(mToneFrequency, -maximumFrequency, maximumFrequency,
|
||||||
500 );
|
100 );
|
||||||
|
|
||||||
model.addChangeListener(new ChangeListener()
|
model.addChangeListener(new ChangeListener()
|
||||||
{
|
{
|
||||||
@@ -186,9 +189,38 @@ public class ChannelizerViewer extends JFrame
|
|||||||
int symbolCount = 14;
|
int symbolCount = 14;
|
||||||
|
|
||||||
//Alpha is the residual channel bandwidth left over from the symbol rate and samples per symbol
|
//Alpha is the residual channel bandwidth left over from the symbol rate and samples per symbol
|
||||||
float alpha = ((float)CHANNEL_BANDWIDTH / (float)(symbolRate * samplesPerSymbol)) - 1.0f;
|
// float alpha = ((float)CHANNEL_BANDWIDTH / (float)(symbolRate * samplesPerSymbol)) - 1.0f;
|
||||||
|
|
||||||
|
float alpha = 0.8f;
|
||||||
|
|
||||||
|
// float[] taps = FilterFactory.getRootRaisedCosine(samplesPerSymbol * mChannelCount, symbolCount, alpha);
|
||||||
|
float[] taps = null;
|
||||||
|
|
||||||
|
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||||
|
.sampleRate(CHANNEL_BANDWIDTH * 2 * mChannelCount)
|
||||||
|
.gridDensity(16)
|
||||||
|
.passBandAmplitude(1.0)
|
||||||
|
.passBandCutoff(11900)
|
||||||
|
.passBandRipple(0.01)
|
||||||
|
.stopBandAmplitude(0.0)
|
||||||
|
.stopBandRipple(0.001)
|
||||||
|
.stopBandStart(13100)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
|
|
||||||
|
if(designer.isValid())
|
||||||
|
{
|
||||||
|
taps = designer.getImpulseResponse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(FilterDesignException fde)
|
||||||
|
{
|
||||||
|
mLog.error("Filter design error", fde);
|
||||||
|
}
|
||||||
|
|
||||||
float[] taps = FilterFactory.getRootRaisedCosine(samplesPerSymbol * mChannelCount, symbolCount, alpha);
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("\nPolyphase Channelizer\n");
|
sb.append("\nPolyphase Channelizer\n");
|
||||||
@@ -224,7 +256,7 @@ public class ChannelizerViewer extends JFrame
|
|||||||
{
|
{
|
||||||
setLayout(new MigLayout("insets 0 0 0 0", "fill", "fill"));
|
setLayout(new MigLayout("insets 0 0 0 0", "fill", "fill"));
|
||||||
|
|
||||||
int channelsPerRow = 32;
|
int channelsPerRow = 16;
|
||||||
|
|
||||||
for(int x = 0; x < mChannelCount; x++)
|
for(int x = 0; x < mChannelCount; x++)
|
||||||
{
|
{
|
||||||
@@ -314,7 +346,7 @@ public class ChannelizerViewer extends JFrame
|
|||||||
|
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
{
|
{
|
||||||
int channelCount = 512;
|
int channelCount = 4;
|
||||||
|
|
||||||
final ChannelizerViewer frame = new ChannelizerViewer(channelCount);
|
final ChannelizerViewer frame = new ChannelizerViewer(channelCount);
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public class PolyphaseChannelizer2 implements Listener<ComplexBuffer>
|
|||||||
|
|
||||||
public void filter(float inphase, float quadrature)
|
public void filter(float inphase, float quadrature)
|
||||||
{
|
{
|
||||||
int index = mFilterPointer * 2;
|
int index = (mChannelCount - mFilterPointer - 1) * 2;
|
||||||
|
|
||||||
mFilteredSamples[index] = mInphaseFilters[mFilterPointer].filter(inphase);
|
mFilteredSamples[index] = mInphaseFilters[mFilterPointer].filter(inphase);
|
||||||
mFilteredSamples[index + 1] = mQuadratureFilters[mFilterPointer].filter(quadrature);
|
mFilteredSamples[index + 1] = mQuadratureFilters[mFilterPointer].filter(quadrature);
|
||||||
|
|||||||
@@ -40,16 +40,16 @@ public class FilterViewer extends Application
|
|||||||
*/
|
*/
|
||||||
private float[] getFilter()
|
private float[] getFilter()
|
||||||
{
|
{
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||||
// .sampleRate(4000)
|
.sampleRate(100000)
|
||||||
// .gridDensity(16)
|
.gridDensity(16)
|
||||||
// .passBandCutoff(950)
|
.passBandAmplitude(1.0)
|
||||||
// .passBandAmplitude(1.0)
|
.passBandCutoff(12000)
|
||||||
// .passBandRipple(0.01)
|
.passBandRipple(0.01)
|
||||||
// .stopBandStart(1050)
|
.stopBandAmplitude(0.0)
|
||||||
// .stopBandAmplitude(0.0)
|
.stopBandRipple(0.001)
|
||||||
// .stopBandRipple(0.005)
|
.stopBandStart(13000)
|
||||||
// .build();
|
.build();
|
||||||
|
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
||||||
// .sampleRate( 24000 )
|
// .sampleRate( 24000 )
|
||||||
@@ -75,21 +75,20 @@ public class FilterViewer extends Application
|
|||||||
|
|
||||||
// taps = FilterFactory.getLowPass( 16000, 2400, 73, WindowType.HANNING );
|
// taps = FilterFactory.getLowPass( 16000, 2400, 73, WindowType.HANNING );
|
||||||
|
|
||||||
taps = FilterFactory.getRootRaisedCosine(2 * 8, 16, (12500.0f / 9600.0f - 1.0f));
|
|
||||||
|
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
//
|
|
||||||
// if(designer.isValid())
|
if(designer.isValid())
|
||||||
// {
|
{
|
||||||
// taps = designer.getImpulseResponse();
|
taps = designer.getImpulseResponse();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// catch(FilterDesignException fde)
|
catch(FilterDesignException fde)
|
||||||
// {
|
{
|
||||||
// mLog.error("Filter design error", fde);
|
mLog.error("Filter design error", fde);
|
||||||
// }
|
}
|
||||||
|
|
||||||
return taps;
|
return taps;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user