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.

Can I modify ASRC code in C5000 CAF to support 11.025kHz sampling rate?



Hi Champs,

I'm planning to add 11.025kHz sampling rate support to the record and playback ASRC in C5000 Connected Audio Framework.

So, can I modify the ASRC code to support the 11.025kHz sampling rate?
If so, could you please let me know how I should modify it?

Thanks in advance for your cooperation.

Best regards,
j-breeze

  • Hi,

    As a Moderator. it is been assigned to right expert and it will be addressed soon.

    Thanks & regards,

    Sivaraj K

  • Yes you can.

    In the file sample_rate.h, add: #define SAMP_RATE_11_025KHZ          ( 0x2B11 )
    add: #define SAMPS_PER_MSEC_11_025KHZ     ( SAMP_RATE_11_025KHZ / RATE_1KHZ )

    In the file app_asrc.c,
    change: #define AASRC_NUM_SAMP_RATES        ( 7 ) to (8)
    add: SAMP_RATE_11_025KHZ to gsAasrcSampRateHzToIdx[]
    add: #define AASRC_SAMP_RATE_11_025KHZ_IDX   ( 1 ) and accordingly increment other indices

     

    In the file app_asrc.c, add entries for 11.025KHz. Please follow the below mentioned process for the same:

    /* Nominal phase increment table
    Rows: {8, 16, 22.05, 24, 32, 44.1, 48}
    Cols: {8, 16, 22.05, 24, 32, 44.1, 48}
    Entries are row(i)/col(j) in S32Q16
    */
    Each entry in this table is a 32-bit data, lower 16 LSBits form the fractional part, higher 16 MSBits form the integral portion
    Calculation for the first entry 0x00010000:
    8/8 = 1
    Calculation for the second entry 0x00008000:
    8/16 = 0.5, Integer part(16 MSBits)=0x0000, Fractional part (Base16)=0.5x16=80, hence 16 LSBits 0x8000
    Calculation for the third entry 0x00005CE1:
    8/22.05 = 0.36281179138321995464852607709751 Integral part=0x0000,
    Fractional part = 0.36281179138321995464852607709751 x 16 = 5.8049886621315192743764172335601
    0.8049886621315192743764172335601 x 16 = 12.879818594104308390022675736961
    0.87981859410430839002267573696145 x 16 = 14.077097505668934240362811791383
    0.07709750566893424036281179138322 x 16 = 1.2335600907029478458049886621315
    Fractional part from above 4 values viz. 5,12,14,1 : 0x5CE1

    Similarly, the second row in this table is formed as follows:
    16/8 = 0x00020000
    16/16 = 0x00010000
    16/22.05 = 0x0000B9C2 and so on.

    Please insert 11.025, in the rows and columns
    Rows: {8, 11.025, 16, 22.05, 24, 32, 44.1, 48}
    Cols: {8, 11.025, 16, 22.05, 24, 32, 44.1, 48}
    and calculate the additional entries required as explained above.

     Best Regards.

  • Hi Sivaraj and KRaviS,

    Thank you for your prompt support.  I was able to modify the table as below.

    /* Nominal phase increment table
    Rows: {8, 11.025, 16, 22.05, 24, 32, 44.1, 48}
    Cols: {8, 11.025, 16, 22.05, 24, 32, 44.1, 48}
    Entries are row(i)/col(j) in S32Q16
    */
    static const Int32 gsAasrcNomPhsIncr[AASRC_NUM_SAMP_RATES][AASRC_NUM_SAMP_RATES] =
    {
        0x00010000, 0x0000B92C, 0x00008000, 0x00005CE1, 0x00005555, 0x00004000, 0x00002E70, 0x00002AAA,
        0x000160CC, 0x00010000, 0x0000B066, 0x00008000, 0x00007599, 0x00005833, 0x00004000, 0x00003ACC,
        0x00020000, 0x00017384, 0x00010000, 0x0000B9C2, 0x0000AAAA, 0x00008000, 0x00005CE1, 0x00005555,
        0x0002C199, 0x00020000, 0x000160CC, 0x00010000, 0x0000EB33, 0x0000B066, 0x00008000, 0x00007599,
        0x00030000, 0x00022D47, 0x00018000, 0x000116A3, 0x00010000, 0x0000C000, 0x00008B51, 0x00008000,
        0x00040000, 0x0002E709, 0x00020000, 0x00017384, 0x00015555, 0x00010000, 0x0000B9C2, 0x0000AAAA,
        0x00058333, 0x00040000, 0x0002C199, 0x00020000, 0x0001D666, 0x000160CC, 0x00010000, 0x0000EB33,
        0x00060000, 0x00045A8E, 0x00030000, 0x00022D47, 0x00020000, 0x00018000, 0x000116A3, 0x00010000
    }

    Best regards,
    j-breeze