mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-13 17:17:29 -05:00
Changes audio module decimation filter from lowpass to bandpass so that we can remove 0-250 Hz and any LTR signalling from the audio output.
This commit is contained in:
@@ -40,37 +40,35 @@ public class FilterViewer extends Application
|
||||
*/
|
||||
private float[] getFilter()
|
||||
{
|
||||
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||
.sampleRate( 48000 )
|
||||
.gridDensity( 16 )
|
||||
.passBandCutoff( 3000 )
|
||||
// FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||
// .sampleRate( 48000 )
|
||||
// .gridDensity( 16 )
|
||||
// .passBandCutoff( 3000 )
|
||||
// .passBandAmplitude( 1.0 )
|
||||
// .passBandRipple( 0.01 )
|
||||
// .stopBandStart( 4000 )
|
||||
// .stopBandAmplitude( 0.0 )
|
||||
// .stopBandRipple( 0.027 )
|
||||
// .build();
|
||||
|
||||
FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
||||
.sampleRate( 8000 )
|
||||
.stopBandCutoff( 250 )
|
||||
.stopBandAmplitude( 0.0 )
|
||||
.stopBandRipple( 0.01 )
|
||||
.passBandStart( 300 )
|
||||
.passBandAmplitude( 1.0 )
|
||||
.passBandRipple( 0.01 )
|
||||
.stopBandStart( 4000 )
|
||||
.stopBandAmplitude( 0.0 )
|
||||
.stopBandRipple( 0.027 )
|
||||
.build();
|
||||
|
||||
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
||||
// .sampleRate( 8000 )
|
||||
// .gridDensity( 16 )
|
||||
// .stopBandCutoff( 2000 )
|
||||
// .stopBandAmplitude( 0.0 )
|
||||
// .stopBandRipple( 0.003 )
|
||||
// .passBandStart( 3000 )
|
||||
// .passBandAmplitude( 1.0 )
|
||||
// .passBandRipple( 0.001 )
|
||||
// .build();
|
||||
|
||||
// FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||
// .sampleRate( 8000 )
|
||||
// .order( 164 )
|
||||
// .stopFrequency1( 1100 )
|
||||
// .passFrequencyBegin( 1200 )
|
||||
// .passFrequencyEnd( 2400 )
|
||||
// .stopFrequency2( 2500 )
|
||||
// .stopRipple( 0.01 )
|
||||
// .passRipple( 0.01 )
|
||||
// .sampleRate( 48000 )
|
||||
// .stopFrequency1( 150 )
|
||||
// .passFrequencyBegin( 200 )
|
||||
// .passFrequencyEnd( 3950 )
|
||||
// .stopFrequency2( 4000 )
|
||||
// .stopRipple( 0.0005 )
|
||||
// .passRipple( 0.003)
|
||||
// .build();
|
||||
|
||||
float[] taps = null;
|
||||
|
||||
@@ -43,6 +43,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
||||
private RealToRealBufferAssembler mAssembler;
|
||||
private int mDecimationRatio;
|
||||
private float mAccumulator = 0.0f;
|
||||
private float mGain = 1.0f;
|
||||
|
||||
/**
|
||||
* Polyphase filter stage for decimating real-valued sample buffers by the decimation ratio. Creates a number of
|
||||
@@ -55,10 +56,13 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
||||
* to the nyquist frequency for an output sample rate equal to the input sample rate divided by the decimation ratio.
|
||||
*
|
||||
* @param decimationRatio to decimate the input sample rate by.
|
||||
* @param gain to apply to the filtered output. Use a value of 1.0 to apply no gain.
|
||||
*/
|
||||
public PolyphaseFIRDecimatingFilter_RB(float[] coefficients, int decimationRatio)
|
||||
public PolyphaseFIRDecimatingFilter_RB(float[] coefficients, int decimationRatio, float gain)
|
||||
{
|
||||
mDecimationRatio = decimationRatio;
|
||||
mGain = gain;
|
||||
|
||||
createFilterStages(coefficients, mDecimationRatio);
|
||||
mFilterStagePointer = mFilterStages.size() - 1;
|
||||
}
|
||||
@@ -127,7 +131,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
||||
|
||||
if(mFilterStagePointer < 0)
|
||||
{
|
||||
mAssembler.receive(mAccumulator);
|
||||
mAssembler.receive(mAccumulator * mGain);
|
||||
mAccumulator = 0.0f;
|
||||
|
||||
mFilterStagePointer = mFilterStages.size() - 1;
|
||||
@@ -177,7 +181,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
||||
}
|
||||
|
||||
float[] coefficients = designer.getImpulseResponse();
|
||||
PolyphaseFIRDecimatingFilter_RB filter = new PolyphaseFIRDecimatingFilter_RB(coefficients, 6);
|
||||
PolyphaseFIRDecimatingFilter_RB filter = new PolyphaseFIRDecimatingFilter_RB(coefficients, 6, 1.0f);
|
||||
filter.setListener(new Listener<RealBuffer>()
|
||||
{
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user