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.

Problem using VEU component of VOLIB.

Hi,

I am working on a noice cancellation project that would take input, speech samples along with noise, and after reducing the noise output clean(almost) speech samples.

For this i used the audioSample application provided with the DVSDK  biospsp_01_30_01 for C6748. This application takes input from audio line-in and sends output to the audio line-out.

i am able to successfully take the samples from audio in and send them to audio out (i can listen the correct output using headphones).

Now, i want to clean the noise from a speech file (containing noise along with speech) using VEU component of VOLIB. For this, i integrated the VEU component in the audioSample application and provided the input from mcasp to the VEU component to be processed. However, Instead of being depleted it seems that noise has been amplified and at the same time speech is broken.

Could anybody pls guide me on this??? my configuration for the mcasp and aic3106 codec is as follows:

Mcasp_HwSetupData mcaspRcvSetup = {
        /* .rmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
        /* .rfmt     = */ 0x000080F0, /*
                                       * 0 bit delay from framsync
                                       * MSB first
                                       * No extra bit padding
                                       * Padding bit (ignore)
                                       * slot Size is 32
                                       * Reads from DMA port
                                       * NO rotation
                                       */
        /* .afsrctl  = */ 0x00000000,
                                        /* burst mode,
                                       * Frame sync is one bit
                                       * Rising edge is start of frame
                                       * externally generated frame sync
                                       */
        /* .rtdm     = */ 0x00000001, /* slot 1 is active (DSP)               */
        /* .rintctl  = */ 0x00000003, /* sync error and overrun error         */
        /* .rstat    = */ 0x000001FF, /* reset any existing status bits       */
        /* .revtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
        {
             /* .aclkrctl  = */ 0x00000000,
             /* .ahclkxctl = */ 0x00000000,
             /* .rclkchk   = */ 0x00000000
        }
} ;

Mcasp_HwSetupData mcaspXmtSetup = {
        /* .xmask    = */ 0xFFFFFFFF, /* All the data bits are to be used     */
        /* .xfmt     = */0x000080F0,
        /*
                                       * 0 bit delay from framsync
                                       * MSB first
                                       * No extra bit padding
                                       * Padding bit (ignore)
                                       * slot Size is 32
                                       * Reads from DMA port
                                       * NO rotation
                                       */
        /* .afsxctl  = */ 0x00000000,                /* burst mode,
         *                        * Frame sync is one bit
                       * Rising edge is start of frame
                       * externally generated frame sync
                       */
        /* .xtdm     = */ 0x00000001, /* slot 1 is active (DSP)               */
        /* .xintctl  = */ 0x00000007,
                        /* sync error,overrun error,clK error   */
        /* .xstat    = */ 0x000001FF, /* reset any existing status bits       */
        /* .xevtctl  = */ 0x00000000, /* DMA request is enabled or disabled   */
        {
             /* .aclkxctl  = */ 0x00000000,
             /* .ahclkxctl = */0x00000000,
             /* .xclkchk   = */ 0x00000000
        },

};


/* McAsp channel parameters                                  */
Mcasp_ChanParams  mcasp_chanparam[Audio_NUM_CHANS]=
{
    {
        0x0001,                    /* number of serialisers      */
        {Mcasp_SerializerNum_12, }, /* serialiser index           */
        &mcaspRcvSetup,
        TRUE,
        Mcasp_OpMode_TDM,          /* Mode (TDM/DIT)             */
        Mcasp_WordLength_32,
        NULL,
        0,
        NULL,
        NULL,
        1,                        /* number of TDM channels      */
        Mcasp_BufferFormat_1SER_1SLOT,
        TRUE,
        TRUE
    },
    {
        0x0001,                   /* number of serialisers       */
        {Mcasp_SerializerNum_11,},
        &mcaspXmtSetup,
        TRUE,
        Mcasp_OpMode_TDM,
        Mcasp_WordLength_32,      /* word width                  */
        NULL,
        0,
        NULL,
        NULL,
        1,                        /* number of TDM channels      */
        Mcasp_BufferFormat_1SER_1SLOT,
        TRUE,
        TRUE
    }
};

Audio_ChannelConfig audioChanParamsIN =
{
    /*  channel 0 (RX)                         */
    (Ptr)&mcasp_chanparam[0],
    {   /* codec [0]                           */
        {
            8000, /* sampling rate for codec */
               50,  /* gain (%) for codec      */
             0x00,
             0x00
        }
    }
};

Audio_ChannelConfig audioChanParamsOUT =
{        
    /*  channel 1 (TX)                         */
    (Ptr)&mcasp_chanparam[1],      
    {
        /* codec [1]                           */
        {
            8000,
            //44100,  /* sampling rate           */
             70,    /* gain (%) for codec      */
             0x00,
             0x00
        }
    }
};

configuration of veuConfig that is passed to veuOpen is:

veuConfig.frame_size      = frame_size;
  veuConfig.config_bitfield =  veu_CTLM_VEU;
  veuConfig.anr_level       = 12;   /* set ANR max attenuation to 12dB */
  veuConfig.alc_send_level  = -15;  /* set ALC target level to -15dBm0 in Send path*/
  veuConfig.alc_recv_level  = -15;  /* set ALC target level to -15dBm0 in Recv path*/
  veuConfig.bulk_delay      = 162;  /* set bulk delay to 162ms */
  veuConfig.waepl           = 36;   /* set WAEPL to 36dB */
  veuConfig.fgc_send_gain   = 0;    /* set FGC gain to 0dB in Send path */
  veuConfig.fgc_recv_gain   = 0;    /* set FGC gain to 0dB in Recv path */

configuration of ctl passed to veuControl is :

ctl->ctl_code = veu_CTL_MODE;
ctl->u.mode_ctl.bit_masks = 0x121;
ctl->u.mode_ctl.bit_values = 0x121;

Thanks in advance..

Regards,

Pankaj Bamola

  • Pankaj,

    Do you have the speech sample capture sent into VEU and output after noise cancellation? And can you let us know the version of the VEU? I can try to reproduce here on VEU part.

    Regards, Eric

     

     

  • Pankaj,

    In veu.h, veuModeControlMask specifies:

    #define veu_CTLM_VEU          0x0001   /**< Enable/disables VEU:
                                                bit value is 1: VEU is enabled;
                                                bit value is 0: VEU is disabled.
                                                Note: this bit does not enable or
                                                disable any individual operation
                                                mode, which has to be enabled or
                                                disabled by the corresponding bit.*/
    #define veu_CTLM_ANR_SEND     0x0002   /**< Enables/disables Noise Reduction
                                                (NR) in the SEND direction.
                                                bit value is 1: NR is enabled;
                                                bit value is 0: NR is disabled.   */
    #define veu_CTLM_ANR_RECV     0x0004   /**< Enables/disables Noise Reduction
                                                (NR) in the RECEIVE direction.
                                                bit value is 1: NR is enabled.
                                                bit value is 0: NR is disabled.   */
    #define veu_CTLM_ALC_HLC_SEND 0x0008   /**< Enables/disables High Level Control
                                                (HLC) in the SEND direction.
                                                bit value is 1: HLC is enabled.
                                                bit value is 0: HLC is disabled.  */
    #define veu_CTLM_ALC_FGC_SEND 0x0010   /**< Enables/disables Fix Gain Control
                                                (FGC) in the SEND direction.
                                                bit value is 1: FGC is enabled;
                                                bit value is 0: FGC is disabled.  */
    #define veu_CTLM_ALC_SEND     0x0020   /**< Enables/disables Automatic Level
                                                Control (ALC) in the SEND direction.
                                                bit value is 1: ALC is enabled;
                                                bit value is 0: ALC is disabled.  */
    #define veu_CTLM_ALC_HLC_RECV 0x0040   /**< Enables/disables High Level Control
                                                (HLC) in the RECEIVE direction.
                                                bit value is 1: HLC is enabled;
                                                bit value is 0: HLC is disabled.  */
    #define veu_CTLM_ALC_FGC_RECV 0x0080   /**< Enables/disables Fix Gain Control
                                                (FGC) in the RECEIVE direction.        
                                                bit value is 1: FGC is enabled;
                                                bit value is 0: FGC is disabled.  */
    #define veu_CTLM_ALC_RECV     0x0100   /**< Enables/disables Automatic Level
                                                Control (ALC) in RECEIVE direction.
                                                bit value is 1: ALC is enabled;
                                                bit value is 0: ALC is disabled.  */

    ....

    Your setting is for ALC:

    ctl->ctl_code = veu_CTL_MODE;
    ctl->u.mode_ctl.bit_masks = 0x121;
    ctl->u.mode_ctl.bit_values = 0x121;

    To set ANR:

    ctl->ctl_code = veu_CTL_MODE;
    ctl->u.mode_ctl.bit_masks = 0x7;
    ctl->u.mode_ctl.bit_values = 0x7;

    Then, you need to set ctl_code to: veu_CTL_ANR_LEVEL or veu_CTL_ALC_SEND_LEVEL or veu_CTL_ALC_RECV_LEVEL and then anr_level to desired value (default 15dB).

    Let me know if this resolved your problem.

    Regards, Eric

     

  • Eric,

    Answers to your questions are :

    Do you have the speech sample capture sent into VEU and output after noise cancellation?

    Yes, I do send the speech samples into the VEU to be processed by veuReceiveIn API. The buffer returned by this API is sent as output to the audio out via mcasp.

    Can you let us know the version of the VEU?

    VOLIB_C64P 2.0.0.3

    Thanks for your quick response..

    Regards,

    Pankaj


  • Thanks for your reply Eric,

    I tried the configuration suggested by you, but it still doesn't work. the result is the same, noise seems to be amplified and speech broken.

    Moreover, i am not able to understand why we have to set ctl_code to veu_CTL_ANR_LEVEL when we have already configured it by specifying the bit_masks and bit_values.

    Is it that i need to pass the speech samples twice to the VEU before sending the processed samples to the audio out? First, after specifying the bit_masks and bit_values and then again after specifying ctl_code to veu_CTL_ANR_LEVEL.

    Regards, Pankaj

  •  

    Pankaj,

    Let us first focus on the VEU component itself, to see if ANR works or not. The test example given in the package is for ALC. If you look at the veusim.c, the veuControl is called three times. The first time is to set control code to 0 (veu_CTL_MODE), this is to enable VEU and to tell what task to do by setting mode_mask and mode_value. The second time is to set control code to 2 (veu_CTL_ALC_SEND_LEVEL), this sets alc_level for Tx path. The third time is to set control code to 3 (veu_CTL_ALC_RECV_LEVEL), this sets alc_level for Rx path.

    This is because struct veuControl_s is mostly a union, so you have to set and call veuControl multiple times. However, you need to pass speech samples ONLY ONCE.

    I created a test case and a test vector for ANR and verified ANR is working on the release you used. I attached them FYI. Please replace:

    1) volib_C64P_2_0_0_3\packages\ti\mas\veu\test\vectors\inp\veu_nb_nb.set with the attached, this is configuration for ANR at 12 dB

    2) volib_C64P_2_0_0_3\packages\ti\mas\veu\test\vectors\inp\ALC_male_sin_8k.pcm with the attached, this is the input file with white noise

    After load the out file (for me test_rel_c64Ple_C64PLE_LE_COFF.out) and run, the output is attached (volib_C64P_2_0_0_3\packages\ti\mas\veu\test\vectors\out\ ALC_male_sout_nb2nb_8k.pcm) FYI. You can see noise is reduced and voice is not broken.

    Let me know if this serves as a working reference for you.

    Regards, Eric0552.anr.zip

  • Thanks a lot Eric,

    I already found out the problem in my application. I was not using the output buffer returned by the veuReceiveIn API as the input to the veuSendIn API. For Now, it seems that everything is working fine.

    Regards, Pankaj