TODO
----
+[ ] 48 kHz to and from 8 kHz routines to drive 48 kHz sound card audio
[ ] try interfering sine wave
+ maybe swept
+ does modem fall over?
+ make sure all estimators keep working
[ ] test rx level sensitivity, i.e. 0 to 20dB attenuation
[ ] make fine freq indep of amplitude
- + use angle rather than imag corrd
+ + use angle rather than imag coord
[ ] document use of fdmdv_ut and fdmdv_demod + PathSim
-[ ] more positibe form of sync reqd for DV frames?
- + like using track/acquire bit
+[ ] more positive form of sync reqd for DV frames?
+ + like using coarse_fine==1 to decode valid DV frame bit?
+ when should we start decoding?
[ ] more robust track/acquite state machine?
+ e.g. hang on thru the fades?
Encodes 320 speech samples (40ms of speech) into 48 bits.
The codec2 algorithm actually operates internally on 10ms (80
- sample) frames, so we run the encoding algorithm for times:
+ sample) frames, so we run the encoding algorithm four times:
frame 0: just send voicing bit
frame 1: predictive vector quantisation of LSPs and Wo and E
/* decode integer codes to model parameters */
model.Wo = decode_Wo_dt(delta_Wo_index, prev__Wo);
+ assert(model.Wo >= TWO_PI/P_MAX);
+ assert(model.Wo <= TWO_PI/P_MIN);
model.L = PI/model.Wo;
memset(&model.A, 0, (model.L+1)*sizeof(model.A[0]));
energy = decode_energy(energy_index);
-
+
/* decode frame 4 */
aks_to_M2(ak, LPC_ORD, &model, energy, &snr, 1);
#include "pilot_coeff.h"
#include "fft.h"
#include "hanning.h"
+#include "os.h"
/*---------------------------------------------------------------------------*\
}
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: fdmdv_8_to_48()
+ AUTHOR......: David Rowe
+ DATE CREATED: 9 May 2012
+
+ Changes the sample rate of a signal from 8 to 48 kHz. Experience
+ with PC based modems has shown that PC sound cards have a more
+ accurate sample clock when set for 48 kHz than 8 kHz.
+
+ n is the number of samples at the 8 kHz rate, there are FDMDV_OS*n samples
+ at the 48 kHz rate. A memory of FDMDV_OS_TAPS/FDMDV_OS samples is reqd for
+ in8k[] (see example).
+
+ This is a classic polyphase upsampler. We take the 8 kHz samples
+ and insert (FDMDV_OS-1) zeroes between each sample, then
+ FDMDV_OS_TAPS FIR low pass filter the signal at 4kHz. As most of
+ the input samples are zeroes, we only need to multiply non-zero
+ input samples by filter coefficients. The zero insertion and
+ filtering are combined in the code below and I'm too lazy to explain
+ it further right now....
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_8_to_48(float out48k[], float in8k[], int n)
+{
+ int i,j,k,l;
+
+ for(i=0; i<n; i++) {
+ for(j=0; j<FDMDV_OS; j++) {
+ out48k[i*FDMDV_OS+j] = 0.0;
+ for(k=0,l=0; k<FDMDV_OS_TAPS; k+=FDMDV_OS,l++)
+ out48k[i*FDMDV_OS+j] += fdmdv_os_filter[k+j]*in8k[i-l];
+
+ }
+ }
+}
+
+/*---------------------------------------------------------------------------*\
+
+ FUNCTION....: fdmdv_48_to_8()
+ AUTHOR......: David Rowe
+ DATE CREATED: 9 May 2012
+
+ Changes the sample rate of a signal from 48 to 8 kHz.
+
+ n is the number of samples at the 8 kHz rate, there are FDMDV_OS*n
+ samples at the 48 kHz rate. As above however a memory of
+ FDMDV_OS_TAPS samples is reqd for in48k[] (see example).
+
+ Low pass filter the 48 kHz signal at 4 kHz using the same filter as
+ the upsampler, then just output every FDMDV_OS-th filtered sample.
+
+\*---------------------------------------------------------------------------*/
+
+void fdmdv_48_to_8(float out8k[], float in48k[], int n)
+{
+ int i,j;
+
+ for(i=0; i<n; i++) {
+ out8k[i] = 0.0;
+ for(j=0; j<FDMDV_OS_TAPS; j++)
+ out8k[i] += fdmdv_os_filter[j]*in48k[i*FDMDV_OS-j];
+ }
+}
+