/********************************************************************************************************** /* Created by Abdel Rabassa (AHR) * /* This subroutine outputs voice frame size [bytes] and frame duration [seconds] for each of four * * /* fix data rate speech encoding algorithms (G.729, G.711, iLBC 20ms and iLBC 30ms). * /* * /*********************************************************************************************************/ #include using namespace std; /*****************************************/ /* codec_type: */ /* 1. GF.729 */ /* 2. G.711 */ /* 3. iLBC 20ms */ /* 4. iLBC 30ms */ /*****************************************/ double* fix_fr_size_fr_duration (int codec_type) { double *array = new double[2]; int fr_size; // voice frame size [bytes] double fr_duration; // voice frame duration [seconds] if (codec_type==1) //G.729 { fr_size = 10; //G.729 voice frame is 10 bytes long fr_duration = 0.01; //G.729 frame duration is 10ms } else if (codec_type==2) //G.711 { fr_size = 80; //G.711 voice frame is 80 bytes long fr_duration = 0.01; //G.711 frame duration is 10ms } else if (codec_type==3) // ILBC20ms { fr_size = 38; //iLBC 20ms voice frame is 38 bytes long fr_duration = 0.02; //iLBC 20ms frame duration is 20ms } else if (codec_type==4) // iLBC30ms { fr_size = 50; //iLBC 30ms voice frame is 50 bytes long fr_duration = 0.03; //iLBC 30ms frame duration is 30ms } array [0] = fr_size; array [1] = fr_duration; return array; } void main() { int codec; cout<<"Enter the code type [1:G.729, 2:G.711, 3:iLBC20, 4:iLBC30]: "; cin>>codec; double *array = fix_fr_size_fr_duration (codec); cout<< "\nFrame size: "; cout<<*array<<" bytes"<