Added some basic FIR filter code (2.8 khz SSB filter).
Biggest thing, discovered that I needed to increase AudioMemory to 16 to fix some "motorboating" that seemed to startup anytime I transmitted through USB.
This commit is contained in:
parent
9c1a490963
commit
7aa2cbc1c4
@ -2,6 +2,7 @@
|
|||||||
// audio.ino
|
// audio.ino
|
||||||
//======================================================================
|
//======================================================================
|
||||||
|
|
||||||
|
#include <dynamicFilters.h>
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
extern IOPConfig iopConfig;
|
extern IOPConfig iopConfig;
|
||||||
@ -27,37 +28,41 @@ AudioAnalyzeRMS rmsRX; //xy=383,47
|
|||||||
AudioAnalyzePeak peakRX; //xy=387,98
|
AudioAnalyzePeak peakRX; //xy=387,98
|
||||||
AudioMixer4 mixRX; //xy=444,163
|
AudioMixer4 mixRX; //xy=444,163
|
||||||
AudioMixer4 mixTX; //xy=444,279
|
AudioMixer4 mixTX; //xy=444,279
|
||||||
AudioAmplifier calRxUSB; //xy=634,165
|
AudioFilterFIR filterRX; //xy=577,161
|
||||||
AudioAmplifier calRxSpkr; //xy=638,55
|
AudioAmplifier filterAmp; //xy=700,160
|
||||||
AudioAmplifier calRxLine; //xy=641,112
|
AudioAmplifier calRxUSB; //xy=873,172
|
||||||
AudioAmplifier calTxLine; //xy=653,248
|
AudioAmplifier calRxSpkr; //xy=877,62
|
||||||
AudioAmplifier calTxUSB; //xy=654,305
|
AudioAmplifier calRxLine; //xy=880,119
|
||||||
AudioAnalyzePeak peakTX; //xy=669,378
|
AudioAmplifier calTxLine; //xy=892,255
|
||||||
AudioAnalyzeRMS rmsTX; //xy=683,433
|
AudioAmplifier calTxUSB; //xy=893,312
|
||||||
AudioOutputAnalog outSpkr; //xy=814,55
|
AudioAnalyzePeak peakTX; //xy=908,385
|
||||||
AudioOutputUSB outUSB; //xy=823,255
|
AudioAnalyzeRMS rmsTX; //xy=922,440
|
||||||
AudioOutputI2S outLine; //xy=826,204
|
AudioOutputAnalog outSpkr; //xy=1053,62
|
||||||
|
AudioOutputUSB outUSB; //xy=1062,262
|
||||||
|
AudioOutputI2S outLine; //xy=1065,211
|
||||||
AudioConnection patchCord1(sideTone, 0, mixRX, 2);
|
AudioConnection patchCord1(sideTone, 0, mixRX, 2);
|
||||||
AudioConnection patchCord2(inLine, 0, rmsRX, 0);
|
AudioConnection patchCord2(inLine, 0, rmsRX, 0);
|
||||||
AudioConnection patchCord3(inLine, 0, peakRX, 0);
|
AudioConnection patchCord3(inLine, 0, peakRX, 0);
|
||||||
AudioConnection patchCord4(inLine, 0, mixRX, 0);
|
AudioConnection patchCord4(inLine, 0, mixRX, 0);
|
||||||
AudioConnection patchCord5(inLine, 1, mixTX, 0);
|
AudioConnection patchCord5(inLine, 1, mixTX, 0);
|
||||||
AudioConnection patchCord6(sine2, 0, mixTX, 3);
|
AudioConnection patchCord6(sine2, 0, mixTX, 3);
|
||||||
AudioConnection patchCord7(inUSB, 0, mixRX, 1);
|
//AudioConnection patchCord7(inUSB, 0, mixRX, 1);
|
||||||
AudioConnection patchCord8(inUSB, 1, mixTX, 1);
|
AudioConnection patchCord8(inUSB, 1, mixTX, 1);
|
||||||
AudioConnection patchCord9(sine1, 0, mixTX, 2);
|
AudioConnection patchCord9(sine1, 0, mixTX, 2);
|
||||||
AudioConnection patchCord10(mixRX, calRxSpkr);
|
AudioConnection patchCord10(mixRX, filterRX);
|
||||||
AudioConnection patchCord11(mixRX, calRxLine);
|
AudioConnection patchCord11(mixTX, calTxLine);
|
||||||
AudioConnection patchCord12(mixRX, calRxUSB);
|
AudioConnection patchCord12(mixTX, calTxUSB);
|
||||||
AudioConnection patchCord13(mixTX, calTxLine);
|
AudioConnection patchCord13(mixTX, peakTX);
|
||||||
AudioConnection patchCord14(mixTX, calTxUSB);
|
AudioConnection patchCord14(mixTX, rmsTX);
|
||||||
AudioConnection patchCord15(mixTX, peakTX);
|
AudioConnection patchCord15(filterRX, filterAmp);
|
||||||
AudioConnection patchCord16(mixTX, rmsTX);
|
AudioConnection patchCord16(filterAmp, calRxSpkr);
|
||||||
AudioConnection patchCord17(calRxUSB, 0, outUSB, 0);
|
AudioConnection patchCord17(filterAmp, calRxLine);
|
||||||
AudioConnection patchCord18(calRxSpkr, outSpkr);
|
AudioConnection patchCord18(filterAmp, calRxUSB);
|
||||||
AudioConnection patchCord19(calRxLine, 0, outLine, 0);
|
AudioConnection patchCord19(calRxUSB, 0, outUSB, 0);
|
||||||
AudioConnection patchCord20(calTxLine, 0, outLine, 1);
|
AudioConnection patchCord20(calRxSpkr, outSpkr);
|
||||||
AudioConnection patchCord21(calTxUSB, 0, outUSB, 1);
|
AudioConnection patchCord21(calRxLine, 0, outLine, 0);
|
||||||
|
AudioConnection patchCord22(calTxLine, 0, outLine, 1);
|
||||||
|
//AudioConnection patchCord23(calTxUSB, 0, outUSB, 1);
|
||||||
AudioControlSGTL5000 audioCtrl; //xy=391,443
|
AudioControlSGTL5000 audioCtrl; //xy=391,443
|
||||||
// GUItool: end automatically generated code
|
// GUItool: end automatically generated code
|
||||||
|
|
||||||
@ -66,6 +71,8 @@ RxOutput audioRxOutput;
|
|||||||
TxInput audioTxInput;
|
TxInput audioTxInput;
|
||||||
TxOutput audioTxOutput;
|
TxOutput audioTxOutput;
|
||||||
|
|
||||||
|
short firActive[NUM_COEFFICIENTS];
|
||||||
|
|
||||||
// audioInit()
|
// audioInit()
|
||||||
// Setup the audio subsystem.
|
// Setup the audio subsystem.
|
||||||
void audioInit()
|
void audioInit()
|
||||||
@ -98,13 +105,17 @@ void audioInit()
|
|||||||
audioSelectTxInput(TX_MIC_IN); // superfluous I think
|
audioSelectTxInput(TX_MIC_IN); // superfluous I think
|
||||||
|
|
||||||
//audioCtrl.adcHighPassFilterDisable();
|
//audioCtrl.adcHighPassFilterDisable();
|
||||||
audioCtrl.audioPreProcessorEnable();
|
//audioCtrl.audioPreProcessorEnable();
|
||||||
|
|
||||||
// setup the two-tone generator
|
// setup the two-tone generator
|
||||||
sine1.frequency(700);
|
sine1.frequency(700);
|
||||||
sine2.frequency(1900);
|
sine2.frequency(1900);
|
||||||
sine1.amplitude(0);
|
sine1.amplitude(0);
|
||||||
sine2.amplitude(0);
|
sine2.amplitude(0);
|
||||||
|
|
||||||
|
audioFilter(firActive, NUM_COEFFICIENTS, ID_BANDPASS, W_HAMMING, 300.0, 3100.0); // 2.8 kHz filter
|
||||||
|
filterRX.begin(firActive, NUM_COEFFICIENTS);
|
||||||
|
filterAmp.gain(1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void updateRxRigIn()
|
inline void updateRxRigIn()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "keyer.h"
|
#include "keyer.h"
|
||||||
|
|
||||||
// comment this out to disable debugging code
|
// comment this out to disable debugging code
|
||||||
#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
#define USBDEBUG(x) USBSERIAL.print("IOP: "); USBSERIAL.println(x);
|
#define USBDEBUG(x) USBSERIAL.print("IOP: "); USBSERIAL.println(x);
|
||||||
|
@ -248,7 +248,7 @@ void setup() {
|
|||||||
// put your setup code here, to run once:
|
// put your setup code here, to run once:
|
||||||
initCAT(38400, SERIAL_8N1);
|
initCAT(38400, SERIAL_8N1);
|
||||||
|
|
||||||
AudioMemory(12);
|
AudioMemory(16);
|
||||||
|
|
||||||
micPTT.attach(MIC_PTT_PIN, INPUT_PULLUP);
|
micPTT.attach(MIC_PTT_PIN, INPUT_PULLUP);
|
||||||
micPTT.interval(25);
|
micPTT.interval(25);
|
||||||
|
Loading…
Reference in New Issue
Block a user