mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
Merge remote-tracking branch 'origin/heterodyne_channelizer' into heterodyne_channelizer
# Conflicts: # src/main/java/io/github/dsheirer/dsp/filter/design/FilterViewer.java
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
package io.github.dsheirer.dsp.filter.design;
|
package io.github.dsheirer.dsp.filter.design;
|
||||||
|
|
||||||
|
import io.github.dsheirer.dsp.filter.FilterFactory;
|
||||||
import io.github.dsheirer.dsp.filter.fir.FIRFilterSpecification;
|
import io.github.dsheirer.dsp.filter.fir.FIRFilterSpecification;
|
||||||
import io.github.dsheirer.dsp.filter.fir.remez.RemezFIRFilterDesigner;
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class FilterViewer extends Application
|
public class FilterViewer extends Application
|
||||||
{
|
{
|
||||||
private final static Logger mLog = LoggerFactory.getLogger(FilterViewer.class);
|
private final static Logger mLog = LoggerFactory.getLogger(FilterViewer.class);
|
||||||
@@ -41,27 +39,16 @@ public class FilterViewer extends Application
|
|||||||
*/
|
*/
|
||||||
private float[] getFilter()
|
private float[] getFilter()
|
||||||
{
|
{
|
||||||
FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
|
||||||
.sampleRate(25000)
|
|
||||||
.gridDensity(16)
|
|
||||||
.passBandCutoff(6000)
|
|
||||||
.passBandAmplitude(1.0)
|
|
||||||
.passBandRipple(0.01)
|
|
||||||
.stopBandStart(6700)
|
|
||||||
.stopBandAmplitude(0.0)
|
|
||||||
.stopBandRipple(0.03)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
// FIRFilterSpecification specification = FIRFilterSpecification.lowPassBuilder()
|
||||||
// .sampleRate(100)
|
// .sampleRate(8000)
|
||||||
// .gridDensity(16)
|
// .gridDensity(16)
|
||||||
// .oddLength(true)
|
// .oddLength(true)
|
||||||
// .passBandCutoff(21)
|
// .passBandCutoff(300)
|
||||||
// .passBandAmplitude(1.0)
|
// .passBandAmplitude(1.0)
|
||||||
// .passBandRipple(0.01)
|
// .passBandRipple(0.01)
|
||||||
// .stopBandStart(29)
|
// .stopBandStart(500)
|
||||||
// .stopBandAmplitude(0.0)
|
// .stopBandAmplitude(0.0)
|
||||||
// .stopBandRipple(0.01)
|
// .stopBandRipple(0.03) //Approximately 60 dB attenuation
|
||||||
// .build();
|
// .build();
|
||||||
//
|
//
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
// FIRFilterSpecification specification = FIRFilterSpecification.highPassBuilder()
|
||||||
@@ -74,15 +61,15 @@ public class FilterViewer extends Application
|
|||||||
// .passBandRipple(0.01)
|
// .passBandRipple(0.01)
|
||||||
// .build();
|
// .build();
|
||||||
|
|
||||||
// FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
FIRFilterSpecification specification = FIRFilterSpecification.bandPassBuilder()
|
||||||
// .sampleRate(8000)
|
.sampleRate(8000)
|
||||||
// .stopFrequency1(1000)
|
.stopFrequency1(1000)
|
||||||
// .passFrequencyBegin(1100)
|
.passFrequencyBegin(1100)
|
||||||
// .passFrequencyEnd(1900)
|
.passFrequencyEnd(1900)
|
||||||
// .stopFrequency2(2000)
|
.stopFrequency2(2000)
|
||||||
// .stopRipple(0.000001)
|
.stopRipple(0.000001)
|
||||||
// .passRipple(0.00001)
|
.passRipple(0.00001)
|
||||||
// .build();
|
.build();
|
||||||
|
|
||||||
float[] taps = null;
|
float[] taps = null;
|
||||||
|
|
||||||
@@ -96,38 +83,37 @@ public class FilterViewer extends Application
|
|||||||
// mLog.error("Error");
|
// mLog.error("Error");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
|
||||||
|
|
||||||
if(designer.isValid())
|
|
||||||
{
|
|
||||||
taps = designer.getImpulseResponse();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(FilterDesignException fde)
|
|
||||||
{
|
|
||||||
mLog.error("Filter design error", fde);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(taps == null)
|
|
||||||
{
|
|
||||||
throw new IllegalStateException("Couldn't design filter");
|
|
||||||
}
|
|
||||||
|
|
||||||
// try
|
// try
|
||||||
// {
|
// {
|
||||||
// taps = FilterFactory.getSincM2Synthesizer(0.25, 2, 9);
|
// RemezFIRFilterDesigner designer = new RemezFIRFilterDesigner(specification);
|
||||||
// taps = FilterFactory.getSincM2Channelizer(12500.0, 2, 9, true);
|
|
||||||
// taps = FilterFactory.getSincM2Synthesizer( 25000.0, 12500.0, 2, 9);
|
|
||||||
//
|
//
|
||||||
|
// if(designer.isValid())
|
||||||
|
// {
|
||||||
|
// taps = designer.getImpulseResponse();
|
||||||
|
// }
|
||||||
// }
|
// }
|
||||||
// catch(FilterDesignException e)
|
// catch(FilterDesignException fde)
|
||||||
// {
|
// {
|
||||||
// e.printStackTrace();
|
// mLog.error("Filter design error", fde);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(taps == null)
|
||||||
|
// {
|
||||||
|
// throw new IllegalStateException("Couldn't design filter");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
mLog.debug(Arrays.toString(taps));
|
try
|
||||||
|
{
|
||||||
|
// taps = FilterFactory.getSincM2Synthesizer(0.25, 2, 9);
|
||||||
|
// taps = FilterFactory.getSincM2Channelizer(12500.0, 2, 9, true);
|
||||||
|
taps = FilterFactory.getSincM2Synthesizer( 25000.0, 12500.0, 2, 9);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(FilterDesignException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
return taps;
|
return taps;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user