void analyse_one_frame(struct CODEC2 *c2, MODEL *model, short speech[]);
void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model,
- COMP Aw[]);
+ COMP Aw[], float gain);
void codec2_encode_3200(struct CODEC2 *c2, unsigned char * bits, short speech[]);
void codec2_decode_3200(struct CODEC2 *c2, short speech[], const unsigned char * bits);
void codec2_encode_2400(struct CODEC2 *c2, unsigned char * bits, short speech[]);
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/* update memories for next frame ----------------------------*/
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/* update memories for next frame ----------------------------*/
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/* update memories for next frame ----------------------------*/
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/* update memories for next frame ----------------------------*/
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/*
for(i=0; i<4; i++) {
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
/* update memories for next frame ----------------------------*/
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD_LOW, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
#ifdef DUMP
aks_to_M2(c2->fftr_fwd_cfg, &ak[i][0], LPC_ORD_LOW, &model[i], e[i], &snr, 0, 0,
c2->lpc_pf, c2->bass_boost, c2->beta, c2->gamma, Aw);
apply_lpc_correction(&model[i]);
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw);
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], Aw, 1.0);
}
#ifdef DUMP
for(i=0; i<M; i++) {
- synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], &HH[i][0]);
+ /* 700C is a little quiter so lets apply some experimentally derived audio gain */
+ synthesise_one_frame(c2, &speech[c2->n_samp*i], &model[i], &HH[i][0], 1.5);
}
}
\*---------------------------------------------------------------------------*/
-void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, COMP Aw[])
+void synthesise_one_frame(struct CODEC2 *c2, short speech[], MODEL *model, COMP Aw[], float gain)
{
int i;
PROFILE_VAR(phase_start, pf_start, synth_start);
synthesise(c2->n_samp, c2->fftr_inv_cfg, c2->Sn_, model, c2->Pn, 1);
+ for(i=0; i<c2->n_samp; i++) {
+ c2->Sn_[i] *= gain;
+ }
+
PROFILE_SAMPLE_AND_LOG2(synth_start, " synth");
ear_protection(c2->Sn_, c2->n_samp);