This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Implementing AER with codecs on omapl138

Other Parts Discussed in Thread: OMAPL138

Hi,

I am currently working on OMAPL138 for a VoIP project where we are using DSP for codec processing of voice data.

Now we are facing echo issues at the net side, means we are calling from IP side to OMAP-TDM side and OMAP-TDM to IP side.

And we are stuck in second case in which we face echo. So for that we are trying to use AER for our problem?

1) Is it right to use AER for our problem?

2) I have merged AER with our application, no problem in merging,.I have followed this steps to create AER instance:-

aerCreate -

aerGetSizes -

siu_alloc_aer_buffs

aerNew

aerOpen

aerControl

Then used aerSendIn to process data to send from OMAP-TDM to IP side using following functions:-

aerSendIn(aec_inst[chan].aec_Inst,(void *)tdm2ip_buff,NULL,(void *)soutBuffer,(void *)ip2tdm_buff,NULL,NULL);

One thing more we are using McBSP for interfacing TDM data and is configured at 8Khz sampling rate.

So we have modified the function accordingly.

We are getting silence in soutbuffer which has to be send to IP side, so net getting success.

Purpose:- To process real time voice data both TX and RX, can you guide us in the proper direction, as this thing is getting very critical for our project.

  • Hi,

    AER is designed to cancel acoustic echo that is caused by the coupling between the speaker and the microphone of a device (e.g. an IP phone) and caused by reverberation in the room. Is that the case in your application?

    Thanks,

    Jianzhong

  • Hi,

    No this is not our case. We are having our own customized boards using OMAPL138 and we are working over VoIP application on that.

    For TDM part we are using McBSP interface using DSP.

    Our Scenario is we are trying to make call between our OMAPL138 system and an IP-Phone and problem is get echo on the IP-Phone side.

    For that we are trying to use the AER library to resolve our issue.

    So can we achieve echo cancellation by doing this.

    -Rishabh

  • Hi,

    No, AER won't be able to cancel echo that comes from the other side.

    Regards,

    Jianzhong

  • HI,

    But in the AER document it is mentioned it can remove the echo from the network side also?what does that mean?

    If we cant use this, so what we should do to achieve it ? can you tell us the desired application to use?

    As already mentioned this issue is very critical for us.

    Please query if anything is not clear from my side.

    Regards,

    Rishabh

  • Rishabh,

    Could you point me to the place in documentation where it says AER can remove echo from the network side? I need to see the context there.

    If I understand your situation correctly, the echo is not generated by your device, right? Since it comes from the network side, it could be caused by the hybrid, or generated by the device at the other end (the IP phone you're calling to).

    It's best to cancel echo where it's generated. It's very difficult to control echo that comes from unknown sources.

    Regards,

    Jianzhong

  • HI Jianzhong,

    I was going through the documentation given in the docs folder of AER i.e. AER_Inetgration_Guide.pdf , page no. 7.

    in which definition of

    • aerReceiveIn() – Processes a frame of data in Rx direction (from net to tele)
    • aerSendIn() – Processes a frame of data in Tx direction (from tele to net)

    In my case echo is not generated at IP-Phone side, we hear echoed voice at IP-phone side i.e. coming from the Analog phone we have connected with our system which is connected at TDM side using McBSP.(Are you clear till here?).

    ----> It's best to cancel echo where it's generated.

    So this is why we are wanting to remove echo from the data/payload we are sending to IP-Phone side.

    Regards,

    Rishabh

  • Rishabh,

    Firstly, the documentation about aerReceiveIn() and aerSendIn() doesn't mean AER can cancel echo from the network side.

    Secondly, in your application, if the IP phone side hears echo, the echo may be generated by the network, or by the analog phone (most likely). Can you capture the signal that OMAPL138 sends to the network and see if echo is present in the capture? If yes, then AER should be able to cancel the echo, but you need to integrate and tune AER properly.

    If possible, please attach a simple block diagram of your system and indicate where AER is located. I can provide better help after understanding your system clearly.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Firstly, the documentation about aerReceiveIn() and aerSendIn() doesn't mean AER can cancel echo from the network side?

    ----> Yes I agree it will not remove the echo from the network side but will remove echo receiving in the data through PCM switch to McBSP then to us.

    Secondly, in your application, if the IP phone side hears echo, the echo may be generated by the network, or by the analog phone (most likely). Can you capture the signal that OMAPL138 sends to the network and see if echo is present in the capture? If yes, then AER should be able to cancel the echo, but you need to integrate and tune AER properly ?

    ----> In our case IP phone side hear echo, which is generated by Analog phone.

            We have checked echo by capturing data at wireshark which omapl138 is sending to IP phone as RTP and played it and in that we can hear echoed voice.

    We need your help in integrating and tune AER properly for that if you need our sample code we are using I can attach that to you.

    Our sampling rate in this is 8Khz, so I have change settings according to that also.

    Please ask for any clarification needed.

    -Regards

    Rishabh Jain

  • Hi,

    PFA of our block diagram in this post, it was not highlighted in the previous one.

    -Regards

    Rishabh Jain

  • Hi Rishabh,

    Thanks for the block diagram. It helps me understand your application. Yes, AER is what you need to cancel echo. A couple of things you need to correct first in order to make AER work properly:

    1. AER operates on 10ms frames, so you'll need to do segmentation and desegmentation.

    2. I do not see where aerReceiveIn is called. It should be called after codec decoding and the output of aerReceiveIn needs to be provided to TDM and aerSendIn.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Thanks for the reply.

    1. AER operates on 10ms frames, so you'll need to do segmentation and desegmentation.

    ----> It means for this I have to give 80 samples(160 bytes) for 10ms data to process.

    2. I do not see where aerReceiveIn is called. It should be called after codec decoding and the output of aerReceiveIn needs to be provided to TDM and aerSendIn.

    ----> I have not used aerReceiveIn function. As we need to process data sending data to IP side as we listen echo at that side.

    Do I have to change parameters setting for various function call of AER, as we are working at 8Khz sampling rate.

    Please tell us if we have to and I will update you with your mentioned changes.

    -Regards

    Rishabh Jain

  • Rishabh,

    Yes, you have to give 80 samples to AER to process.

    You have to call aerReceiveIn which is an inherent part of AER processing.

    Regarding parameters, you'll have to inform AER about the sampling rate through either aerOpen or aerControl. Please refer to simulation code aer/test/siusim/siuaer.c for examples.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Can you help us in this as we are processing data in this manner.

    First as per your saying the output buffer of aerReceiveIn is ip2tdm_buff_out, this has to be feed to aer

    aec_inst[chan].aec_Inst - AER Instance.

    ip2tdm_buff - buffer receive after decoding payload from IP side.

    ip2tdm_buff_out - result buffer of ip2tdm_buff.

    tdm2ip_buff - Buffer received from TDM/PCM side.

    soutBuffer - As this is the result buffer of tdm2ip_buff & ip2tdm_buff_out.

        /** In this we are processing data receiving from IP side */
        aerReceiveIn(aec_inst[chan].aec_Inst,(void *)ip2tdm_buff,(void *)ip2tdm_buff_out,NULL);

        /** In this we are processing data for sending to IP side */
        aerSendIn(aec_inst[chan].aec_Inst,(void *)tdm2ip_buff,NULL,(void *)soutBuffer,(void *)ip2tdm_buff_out,NULL,NULL);

    Please tell us where we need to correct.

    Regards

    Rishabh Jain

  • Hi Rishabh,

    The usage of aerSendIn was incorrect. It should be:

    aerSendIn(aec_inst[chan].aec_Inst,(void *)tdm2ip_buff,(void *)soutBuffer,NULL,(void *)ip2tdm_buff_out,NULL,NULL);

    Please note the prototype of this function is:

    tint aerSendIn (void *aerInst, void *send_in, void *send_out,
                    void *sout_8kHz, void *recv_out_sync, void *sout_pnlp_8kHz,
                    void *trace_buf);

    where sout_8kHz could be used for 16kHz sampling rate, storing 8kHz data before upsampling, and it is not meant for storing output for 8kHz sampling rate. Output buffer must be send_out regardless of the sampling rate.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    Thanks for correcting me in this but I have already done that too. The thing is when I have done that we do not get any voice at the IP side as in result we get just a buzzing tone at IP side but from IP to TDM voice goes smoothly.

    I am attaching the code we are using for Instance creation of AER, please go through it as I have refer AER example for this and tell do I have to make any changes. If yes then tell where.

    For any clarification, please reply.

    -Regards

    Rishabh Jain

    aec_init.c.zip
  • Hi Rishabh,

    A quick glance of your code tells me that the AER may not be enabled due to the following code:

        aer_ctl.modes_0.mask  = aer_CTL0_CLEAR_ALL;
        aer_ctl.modes_0.value = aer_CTL0_CLEAR_ALL;
        aer_ctl.modes_1.mask  = aer_CTL1_INCREASE_MIN_HVEC;
        aer_ctl.modes_1.value = aer_CTL1_INCREASE_MIN_HVEC;

    Please read the API documentation and make sure you understand it in and out. As a debugging method, you may want to capture the signal before and after aerSendIn, disabling AER and then enabling, disabling NLP and then enabling, etc.By doing these, you'll narrow down the problem.

    Regards,

    Jianzhong

  • HI Jianzhong,

    Please tell me what configuration should I do to achieve echo cancellation in our case, as there is no change in the performance of echo even after changing to something like that:

      aer_ctl.modes_0.value =  aer_ctl.modes_0.mask     = aer_CTL0_CLEAR_ALL |
                                    aer_CTL0_CLEAR_FILTER |
                                    aer_CTL0_ENABLE_ECHO_CANCELLER |
                                    aer_CTL0_HALF_DUPLEX;

    Can you tell me what values we should right exactly in this as there is no help getting from the example code.

    But still after making many changes in the configuration we are still getting that buzzing continuously from tdm to IP  side.

    So guide us to any particular point so we can succeed.

    -Regards

    Rishabh Jain

  • Hi Rishabh,

    The example code doesn't have hard coded configuration for modes_0 and modes_1. The configuration is specified in the test configuration file, aersimcfg.txt, which has 0x1887 for modes_0. You can have 0x00C0 for modes_1. You should be able to figure out what they mean according to the API.

    To debug the buzzing noise issue, I suggest the following:

    1. capture the input signal to AER Tx and see if it is present there. If yes, then you need to debug your system and decide where the noise is generated. If no, proceed to step 2.

    2. disable AER and capture the output signal of AER Tx and see if the buzzing noise is there. If yes, you probably have some memory buffer overwritten problem. If not, proceed to step 3.

    3. enable AER and disable NLP by clearing flag aer_CTL0_ENABLE_NLP. Send a signal (e.g. pink noise or CSS) from the far end, and capture the output of AER Tx and see if AER converges (echo is reduced without NLP).

    4. follow the steps given in the tuning guide.

    I'd like to remind you that AER is not a simple component as the codec. It is not something that you plug in and expect to work immediately. You'll need to read the documentation of API, integration guide and tuning guide, and understand them. Otherwise, it would be very difficult for you to succeed.

    Regards,

    Jianzhong

  • Hi Jianzhong,

    We have already gone through documents referred in it but there are many parameters to configure them so I thought you guys might give some reference code or something so one can get idea of it according to their scenarios implementation.

    So I will definitely go through documents properly and will update you on this and in the mean time if you have any update on this, please reply on the same.

    -Regards

    Rishabh Jain

  • Hi Rishabh,

    How is everything going? Have you figured out where the buzzing sound came from? Also, have you verified that AER converges according to #3 in my previous post (quoted below)?

    3. enable AER and disable NLP by clearing flag aer_CTL0_ENABLE_NLP. Send a signal (e.g. pink noise or CSS) from the far end, and capture the output of AER Tx and see if AER converges (echo is reduced without NLP).

    Although there are many parameters of AER, only a few are critical for acceptable performance. Majority of the parameters are for fine tuning AER to get good duplex performance. The first milestone in integration and tuning is to get AER converged as described in the tuning guide. Please make sure you understand the system delay and synchronization between AER Rx out and AER Tx in, as well as gain calibrations for both paths.These are crucial to obtain proper AER operation.

    Regards,

    Jianzhong