mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 10:37:26 -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
|
static
|
||||||
{
|
{
|
||||||
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
//Band-pass filter to both decimate (48kHz to 8kHz) and block 0 - 300 Hz (LTR signalling).
|
||||||
.sampleRate(48000)
|
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||||
.gridDensity(16)
|
.sampleRate( 48000 )
|
||||||
.passBandCutoff(3000)
|
.stopFrequency1( 150 )
|
||||||
.passBandAmplitude(1.0)
|
.passFrequencyBegin( 300 )
|
||||||
.passBandRipple(0.01)
|
.passFrequencyEnd( 3500 )
|
||||||
.stopBandStart(4000)
|
.stopFrequency2( 4000 )
|
||||||
.stopBandAmplitude(0.0)
|
.stopRipple( 0.0004 )
|
||||||
.stopBandRipple(0.027)
|
.passRipple( 0.008)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
@@ -86,16 +86,12 @@ public class AudioModule extends Module implements IAudioPacketProvider,
|
|||||||
private Listener<AudioPacket> mAudioPacketListener;
|
private Listener<AudioPacket> mAudioPacketListener;
|
||||||
private PolyphaseFIRDecimatingFilter_RB mAudioDecimationFilter;
|
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)
|
public AudioModule(boolean record)
|
||||||
{
|
{
|
||||||
mSourceID = ++UNIQUE_ID;
|
mSourceID = ++UNIQUE_ID;
|
||||||
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
mAudioMetadata = new AudioMetadata(mSourceID, record);
|
||||||
|
|
||||||
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6);
|
mAudioDecimationFilter = new PolyphaseFIRDecimatingFilter_RB(mDecimationCoefficients, 6, 2.0f);
|
||||||
mAudioDecimationFilter.setListener(new Listener<RealBuffer>()
|
mAudioDecimationFilter.setListener(new Listener<RealBuffer>()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -40,37 +40,35 @@ public class FilterViewer extends Application
|
|||||||
*/
|
*/
|
||||||
private float[] getFilter()
|
private float[] getFilter()
|
||||||
{
|
{
|
||||||
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
// FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||||
.sampleRate( 48000 )
|
// .sampleRate( 48000 )
|
||||||
.gridDensity( 16 )
|
// .gridDensity( 16 )
|
||||||
.passBandCutoff( 3000 )
|
// .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 )
|
.passBandAmplitude( 1.0 )
|
||||||
.passBandRipple( 0.01 )
|
.passBandRipple( 0.01 )
|
||||||
.stopBandStart( 4000 )
|
|
||||||
.stopBandAmplitude( 0.0 )
|
|
||||||
.stopBandRipple( 0.027 )
|
|
||||||
.build();
|
.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()
|
// FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||||
// .sampleRate( 8000 )
|
// .sampleRate( 48000 )
|
||||||
// .order( 164 )
|
// .stopFrequency1( 150 )
|
||||||
// .stopFrequency1( 1100 )
|
// .passFrequencyBegin( 200 )
|
||||||
// .passFrequencyBegin( 1200 )
|
// .passFrequencyEnd( 3950 )
|
||||||
// .passFrequencyEnd( 2400 )
|
// .stopFrequency2( 4000 )
|
||||||
// .stopFrequency2( 2500 )
|
// .stopRipple( 0.0005 )
|
||||||
// .stopRipple( 0.01 )
|
// .passRipple( 0.003)
|
||||||
// .passRipple( 0.01 )
|
|
||||||
// .build();
|
// .build();
|
||||||
|
|
||||||
float[] taps = null;
|
float[] taps = null;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
|||||||
private RealToRealBufferAssembler mAssembler;
|
private RealToRealBufferAssembler mAssembler;
|
||||||
private int mDecimationRatio;
|
private int mDecimationRatio;
|
||||||
private float mAccumulator = 0.0f;
|
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
|
* 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.
|
* 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 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;
|
mDecimationRatio = decimationRatio;
|
||||||
|
mGain = gain;
|
||||||
|
|
||||||
createFilterStages(coefficients, mDecimationRatio);
|
createFilterStages(coefficients, mDecimationRatio);
|
||||||
mFilterStagePointer = mFilterStages.size() - 1;
|
mFilterStagePointer = mFilterStages.size() - 1;
|
||||||
}
|
}
|
||||||
@@ -127,7 +131,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
|||||||
|
|
||||||
if(mFilterStagePointer < 0)
|
if(mFilterStagePointer < 0)
|
||||||
{
|
{
|
||||||
mAssembler.receive(mAccumulator);
|
mAssembler.receive(mAccumulator * mGain);
|
||||||
mAccumulator = 0.0f;
|
mAccumulator = 0.0f;
|
||||||
|
|
||||||
mFilterStagePointer = mFilterStages.size() - 1;
|
mFilterStagePointer = mFilterStages.size() - 1;
|
||||||
@@ -177,7 +181,7 @@ public class PolyphaseFIRDecimatingFilter_RB extends FIRFilter implements Listen
|
|||||||
}
|
}
|
||||||
|
|
||||||
float[] coefficients = designer.getImpulseResponse();
|
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>()
|
filter.setListener(new Listener<RealBuffer>()
|
||||||
{
|
{
|
||||||
@Override
|
@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)
|
if (!mLibraryLoadStatusLogged)
|
||||||
{
|
{
|
||||||
mLog.info("JMBE audio conversion library successfully loaded"
|
StringBuilder sb = new StringBuilder();
|
||||||
+ " - P25 audio will be available");
|
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;
|
mLibraryLoadStatusLogged = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user