The synthesiser operates on 10ms frames, but in this mode, the
parameters are sent over the channel every 20ms.  So we use linear
interpolation to resample.

Or in maths, if you want to estimate the a sample half way between two
other samples:

x(0.5) = 0.5*x(0) + 0.5*x(1)

- David

On 16/11/20 8:05 pm, Random wrote:
> Hi, David,
> 
> The following is your codec2 source code.
> 
> Why the energy and the LSP need the linear interpolation ?
> 
> Why the interpolation factor is 0.5 ??
> 
> What's the mathematical theory or explanation or formula behind them ?
> 
> Thanks a lot.
> 
> /* interpolate ------------------------------------------------*/
> 
> ?0?2 ?0?2 /* Wo and energy are sampled every 20ms, so we interpolate just 1
> ?0?2 ?0?2 ?0?2 ?0?210ms frame between 20ms samples */
> 
> ?0?2 ?0?2 interp_Wo(&model[0], &c2->prev_model_dec, &model[1]);
> ?0?2 ?0?2 e[0] = interp_energy(c2->prev_e_dec, e[1]);
> 
> ?0?2 ?0?2 /* LSPs are sampled every 20ms so we interpolate the frame in
> ?0?2 ?0?2 ?0?2 ?0?2between, then recover spectral amplitudes */
> 
> ?0?2 ?0?2 interpolate_lsp_ver2(&lsps[0][0], c2->prev_lsps_dec, &lsps[1][0],
> 0.5, LPC_ORD);
> ?0?2 ?0?2 for(i=0; i<2; i++) {
> lsp_to_lpc(&lsps[i][0], &ak[i][0], LPC_ORD);
> aks_to_M2(c2->fft_fwd_cfg, &ak[i][0], LPC_ORD, &model[i], e[i], &snr, 0, 0,
> ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 ?0?2 c2->lpc_pf, c2->bass_boost, 
> c2->beta, c2->gamma, Aw);
> apply_lpc_correction(&model[i]);
> synthesise_one_frame(c2, &speech[N*i], &model[i], Aw);
> ?0?2 ?0?2 }
> 
> 
> _______________________________________________
> Freetel-codec2 mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/freetel-codec2
> 


_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to