mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 08:37:25 -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:
@@ -46,15 +46,15 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
||||
|
||||
static
|
||||
{
|
||||
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||
.sampleRate(48000)
|
||||
.gridDensity(16)
|
||||
.passBandCutoff(3000)
|
||||
.passBandAmplitude(1.0)
|
||||
.passBandRipple(0.01)
|
||||
.stopBandStart(4000)
|
||||
.stopBandAmplitude(0.0)
|
||||
.stopBandRipple(0.027)
|
||||
//Band-pass filter to both decimate (48kHz to 8kHz) and block 0 - 300 Hz (LTR signalling).
|
||||
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||
.sampleRate( 48000 )
|
||||
.stopFrequency1( 150 )
|
||||
.passFrequencyBegin( 300 )
|
||||
.passFrequencyEnd( 3500 )
|
||||
.stopFrequency2( 4000 )
|
||||
.stopRipple( 0.0004 )
|
||||
.passRipple( 0.008)
|
||||
.build();
|
||||
|
||||
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||
@@ -86,16 +86,12 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
||||
private Listener<AudioPacket> mAudioPacketListener;
|
||||
private PolyphaseFIRDecimatingFilter_RB mAudioDecimationFilter;
|
||||
|
||||
//TODO: remove this -- is being replaced by the DemodulatedAudioFilterModule
|
||||
private RealFIRFilter_R_R mAudioFilter = new RealFIRFilter_R_R(
|
||||
Filters.FIR_BANDPASS_AUDIO_48KHZ.getCoefficients(), 2.0f);
|
||||
|
||||
public AudioModule(boolean record)
|
||||
{
|
||||
mSourceID = ++UNIQUE_ID;
|
||||
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
||||
|
||||
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6);
|
||||
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6, 2.0f);
|
||||
mAudioDecimationFilter.setListener(new Listener<RealBuffer>()
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -152,8 +152,12 @@ public class P25AudioModule extends Module implements Listener<Message>,
|
||||
|
||||
if (!mLibraryLoadStatusLogged)
|
||||
{
|
||||
mLog.info("JMBE audio conversion library successfully loaded"
|
||||
+ " - P25 audio will be available");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("JMBE audio conversion library [");
|
||||
sb.append(library.getVersion());
|
||||
sb.append("] successfully loaded - P25 audio will be available");
|
||||
|
||||
mLog.info(sb.toString());
|
||||
|
||||
mLibraryLoadStatusLogged = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user