Skip to content

SGS SRC ALGORITHM USER GUIDE

REVISION HISTORY

Revision No.
Description
Date
1.0
  • Initial release
  • 09/12/2020
    1.1
  • Modified API
  • 10/15/2020
    1.2
  • Added new low pass filter
  • 06/01/2021
    1.21
  • Added some details about point number
  • 08/18/2022
    1.22
  • Added some details about channel number
  • 12/15/2022
    1.3
  • Add 24kHz sample rate
  • 12/20/2023
    1.31
  • Add Json API description
  • 12/09/2024
    1.32
  • Update file description and copyright
  • 04/24/2025
    1.33
  • Remove copyright
  • 05/14/2025
    1.34
  • Corrected format
  • 10/28/2025
    1.35
  • Add and update description of Chapter 1
  • 11/25/2025

    1. Overview


    1.1. Algorithm Description

    SRC (short for Sample Rate Conversion) is used to convert the sampling frequency from audio stream to obtain different sampling frequencies audio streams.

    Keyword

    Sampling frequency: The number of samples sampled from a continuous signal per second.

    Note

    In order to facilitate debugging and confirm the effect of the algorithm, the user application needs to implement replacement algorithm parameter and grab audio data.


    1.2. Basic Structure

    After the SRC algorithm allocates memory and completes parameter initialization and configuration, it only requires an input signal buffer. The SRC processes this buffer according to the configured setting and algorithm, and outputs the sample-rate-converted result to the SRC output signal buffer.


    1.3. Function Introduction

    SRC :

    Example of downsampling from 16 kHz to 8 kHz:

    Example of upsampling from 16 kHz to 48 kHz:

    For all supported sample-rate conversion options, please refer to SrcConversionMode


    1.4. Application Scenarios

    Convert the sample rate to meet the requirements of the target application, such as resolving sample-rate mismatches between different audio devices.


    1.5. Chip Difference Description

    Across different chip series, the SRC algorithm demonstrates consistent performance with no observable differences.


    1.6. Example Introduction

    Use the SRC API to obtain the memory size required by the SRC algorithm, initialize and configure parameters the SRC algorithm handle, execute the SRC algorithm, and release the SRC algorithm resources.

        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <fcntl.h>
        #include <string.h>
        #include <sys/types.h>
        #include <sys/stat.h>
        #include <sys/time.h>
    
        #include "AudioSRCProcess.h"
    
    
        float AVERAGE_RUN(int a)
        {
            static unsigned int num = 0;
            static float avg = 0;
            if(num == 0) avg = 0;
            num++;
            avg = avg + ((float)a - avg) / ((float)num);
            return avg;
        }
        unsigned int _OsCounterGetMs(void)
        {
            struct  timeval t1;
            gettimeofday(&t1,NULL);
            unsigned int T = ( (1000000 * t1.tv_sec)+ t1.tv_usec ) / 1000;
            return T;
        }
    
        typedef struct{
            char chunkID[4];
            int chunkSize;
            char format[4];
            char subchunk1ID[4];
            int subchunk1Size;
            short audioFormat;
            short numChannels;
            int sampleRate;
            int byteRate;
            short blockAlign;
            short bitsPerSample;
            char subchunk2ID[4];
            int subchunk2Size;
        }WaveHeaderStruct;
    
        WaveHeaderStruct Header_struct;
    
        void SetWaveHeader(int newSampleRate, char newBitDepth, char newNumChans)
        {
        // set all the ASCII literals
        memcpy(Header_struct.chunkID, "RIFF", 4);
        memcpy(Header_struct.format, "WAVE", 4);
        memcpy(Header_struct.subchunk1ID, "fmt ", 4);
        memcpy(Header_struct.subchunk2ID, "data", 4);
    
        // set all the known numeric values
        Header_struct.audioFormat = 1;
        Header_struct.chunkSize = 36;
        Header_struct.subchunk1Size = 16;
        Header_struct.subchunk2Size = 0;
    
        // set the passed-in numeric values
        Header_struct.sampleRate = newSampleRate*1000;
        Header_struct.bitsPerSample = newBitDepth;
        Header_struct.numChannels = newNumChans;
    
        // calculate the remaining dependent values
        Header_struct.blockAlign = Header_struct.numChannels * Header_struct.bitsPerSample / 8;
        Header_struct.byteRate = Header_struct.sampleRate * Header_struct.blockAlign;
        }
    
        void WaveHeaderUpdate(int numBytes)
        {
            Header_struct.subchunk2Size = numBytes;
            Header_struct.chunkSize = Header_struct.subchunk2Size + 36;
        }
    
        void WaveHeaderInfo(int* dataArray)
        {
        memcpy(dataArray, &Header_struct, (char) sizeof(Header_struct));
        }
    
        int GetHeaderResult(int numBytes, int* dataArray)
        {
            WaveHeaderUpdate(numBytes);
            WaveHeaderInfo(dataArray);
            return 0;
        }
    
        int GetSrcOutSampleRate(SrcConversionMode mode)
        {
            int outsamplerate;
            switch (mode)
            {
            case SRC_8k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_8k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            case SRC_8k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_16k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_16k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            case SRC_16k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_32k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_32k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_32k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_48k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_48k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_48k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            }
            return outsamplerate;
        }
        int main(int argc, char *argv[])
        {
            //For file I/O
            char infile_name[512],outfile_name[512];
            // char old_header[100],
            char new_header[100];
            FILE *fin, *fout;
            int total_size = 0, counter = 0;
            int WaveOut_srate = 0;
            ALGO_SRC_RET ret = 0;
            unsigned int T0, T1;
            float avg = 0;
            unsigned int frame_size = (256); // Support 256, 512, 1024 and 2880
    
            //For Lib usage
            char *working_buf_ptr;
            short audio_input[frame_size*2], audio_output[frame_size*12];
            int OutputSampleNum;
            unsigned int buf_size;
            SRCStructProcess src_struct;
    
            /*Specify input/output file */
            if (argc > 1)
                strcpy(infile_name, argv[1]);
            else
                sprintf(infile_name, "./../sample/data/Sweep_48000_6s_stereo.wav");
    
            fin = fopen(infile_name, "rb");
            if (!fin)
            {
                fprintf(stderr, "Error opening file: %s\n", infile_name);
                return -1;
            }
    
            /* SRC parameter setting */
            src_struct.WaveIn_srate = SRATE_48K;
            src_struct.channel = 2;
            src_struct.mode = SRC_48k_to_8k;
            src_struct.order = ORDER_HIGH;
            src_struct.point_number = frame_size;
            printf("Supported sample rate : 8k, 16k, 32k, 48k Hz\n");
    
    
            //Set output file header
            WaveOut_srate = GetSrcOutSampleRate(src_struct.mode);
            SetWaveHeader(WaveOut_srate,16,src_struct.channel);
            printf("output sample rate = %dk\n",WaveOut_srate);
            if(src_struct.channel ==2)
                sprintf(outfile_name, "./SRC_Out_%d_%dK_stereo.pcm",src_struct.WaveIn_srate, WaveOut_srate);
            else
                sprintf(outfile_name, "./SRC_Out_%d_%dK_mono.pcm"  ,src_struct.WaveIn_srate, WaveOut_srate);
    
            fout = fopen(outfile_name, "wb");
            if (!fout)
            {
                fprintf(stderr, "Error opening file: %s\n", outfile_name);
                return -1;
            }
    
            /* SRC init */
            buf_size = IaaSrc_GetBufferSize(src_struct.mode);
            working_buf_ptr = malloc(buf_size);
            SRC_HANDLE handle = IaaSrc_Init(working_buf_ptr, &src_struct);
    
            //main process
    
            fread(audio_input, sizeof(char), 44, fin);
            while(fread(audio_input, sizeof(short), frame_size*src_struct.channel, fin))
            {
                counter++;
                /* Run SRC process */
                T0  = (long)_OsCounterGetMs();
                ret = IaaSrc_Run(handle, audio_input,audio_output, &OutputSampleNum);
                T1  = (long)_OsCounterGetMs();
                avg += (T1 - T0);
                if(ret != 0)
                {
                    printf("Error occured in Sampling rate converter\n");
                    return -1;
                }
                //write output file information
                total_size += src_struct.channel*OutputSampleNum*sizeof(short);
                fwrite(audio_output, sizeof(short), src_struct.channel*OutputSampleNum, fout);
            }
            GetHeaderResult(total_size,(int*)new_header);
            fseek(fout,0,SEEK_SET);
            fwrite(new_header, sizeof(char),44, fout);
            avg /= counter;
            printf("AVG is %.2f ms\n",avg);
    
            fclose(fin);
            fclose(fout);
            IaaSrc_Release(handle);
            free(working_buf_ptr);
            printf("SRC done\n");
        return 0;
        }
    

    Use the SRC API to read parameters from the SRC JSON file, obtain the memory size required for SRC algorithm execution, initialize and configure parameters the SRC algorithm handle, execute the SRC algorithm, and release the SRC algorithm resources.

        #include <stdio.h>
        #include <stdlib.h>
        #include <unistd.h>
        #include <fcntl.h>
        #include <string.h>
        #include <sys/types.h>
        #include <sys/stat.h>
        #include <sys/time.h>
    
        #include "AudioSRCProcess.h"
    
    
        float AVERAGE_RUN(int a)
        {
            static unsigned int num = 0;
            static float avg = 0;
            if(num == 0) avg = 0;
            num++;
            avg = avg + ((float)a - avg) / ((float)num);
            return avg;
        }
        unsigned int _OsCounterGetMs(void)
        {
            struct  timeval t1;
            gettimeofday(&t1,NULL);
            unsigned int T = ( (1000000 * t1.tv_sec)+ t1.tv_usec ) / 1000;
            return T;
        }
    
        typedef struct{
            char chunkID[4];
            int chunkSize;
            char format[4];
            char subchunk1ID[4];
            int subchunk1Size;
            short audioFormat;
            short numChannels;
            int sampleRate;
            int byteRate;
            short blockAlign;
            short bitsPerSample;
            char subchunk2ID[4];
            int subchunk2Size;
        }WaveHeaderStruct;
    
        WaveHeaderStruct Header_struct;
    
        void SetWaveHeader(int newSampleRate, char newBitDepth, char newNumChans)
        {
        // set all the ASCII literals
        memcpy(Header_struct.chunkID, "RIFF", 4);
        memcpy(Header_struct.format, "WAVE", 4);
        memcpy(Header_struct.subchunk1ID, "fmt ", 4);
        memcpy(Header_struct.subchunk2ID, "data", 4);
    
        // set all the known numeric values
        Header_struct.audioFormat = 1;
        Header_struct.chunkSize = 36;
        Header_struct.subchunk1Size = 16;
        Header_struct.subchunk2Size = 0;
    
        // set the passed-in numeric values
        Header_struct.sampleRate = newSampleRate*1000;
        Header_struct.bitsPerSample = newBitDepth;
        Header_struct.numChannels = newNumChans;
    
        // calculate the remaining dependent values
        Header_struct.blockAlign = Header_struct.numChannels * Header_struct.bitsPerSample / 8;
        Header_struct.byteRate = Header_struct.sampleRate * Header_struct.blockAlign;
        }
    
        void WaveHeaderUpdate(int numBytes)
        {
            Header_struct.subchunk2Size = numBytes;
            Header_struct.chunkSize = Header_struct.subchunk2Size + 36;
        }
    
        void WaveHeaderInfo(int* dataArray)
        {
        memcpy(dataArray, &Header_struct, (char) sizeof(Header_struct));
        }
    
        int GetHeaderResult(int numBytes, int* dataArray)
        {
            WaveHeaderUpdate(numBytes);
            WaveHeaderInfo(dataArray);
            return 0;
        }
    
        int GetSrcOutSampleRate(SrcConversionMode mode)
        {
            int outsamplerate;
            switch (mode)
            {
            case SRC_8k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_8k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            case SRC_8k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_16k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_16k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            case SRC_16k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_32k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_32k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_32k_to_48k:
                outsamplerate = SRATE_48K;
                break;
            case SRC_48k_to_8k:
                outsamplerate = SRATE_8K;
                break;
            case SRC_48k_to_16k:
                outsamplerate = SRATE_16K;
                break;
            case SRC_48k_to_32k:
                outsamplerate = SRATE_32K;
                break;
            }
            return outsamplerate;
        }
        int main(int argc, char *argv[])
        {
            //For file I/O
            char infile_name[512],outfile_name[512];
            // char old_header[100],
            char new_header[100];
            FILE *fin, *fout;
            int total_size = 0, counter = 0;
            int WaveOut_srate = 0;
            ALGO_SRC_RET ret = 0;
            unsigned int T0, T1;
            float avg = 0;
            // unsigned int frame_size = (256); // Support 256, 512, 1024 and 2880
    
            //For Lib usage
            char *working_buf_ptr;
            int OutputSampleNum;
            unsigned int buf_size;
            SRCStructProcess src_struct;
    
            char src_para_json_file[512];
            sprintf(src_para_json_file,"%s","./../sample/data/SrcParamJson.json");
            unsigned int src_para_buffersize = IaaSrc_GetJsonFileSize(src_para_json_file);
            char *src_para_json_buf_ptr = (char*)malloc(src_para_buffersize);
    
            memset(&src_struct,0,sizeof(SRCStructProcess));
            ret = IaaSrc_StructReadFromJson(&src_struct, src_para_json_buf_ptr, src_para_json_file, src_para_buffersize);
    
            short audio_input[src_struct.point_number*2], audio_output[src_struct.point_number*12];
            /*Specify input/output file */
            if (argc > 1)
                strcpy(infile_name, argv[1]);
            else
                sprintf(infile_name, "./../sample/data/Sweep_16000_6s.wav");
    
            fin = fopen(infile_name, "rb");
            if (!fin)
            {
                fprintf(stderr, "Error opening file: %s\n", infile_name);
                return -1;
            }
    
    
            //Set output file header
            WaveOut_srate = GetSrcOutSampleRate(src_struct.mode);
            SetWaveHeader(WaveOut_srate,16,src_struct.channel);
            printf("output sample rate = %dk\n",WaveOut_srate);
            if(src_struct.channel ==2)
                sprintf(outfile_name, "./../sample/data/SRC_Out_%d_%dK_stereo.wav",src_struct.WaveIn_srate, WaveOut_srate);
            else
                sprintf(outfile_name, "./../sample/data/SRC_Out_%d_%dK_mono.wav"  ,src_struct.WaveIn_srate, WaveOut_srate);
    
            fout = fopen(outfile_name, "wb");
            if (!fout)
            {
                fprintf(stderr, "Error opening file: %s\n", outfile_name);
                return -1;
            }
    
            /* SRC init */
            buf_size = IaaSrc_GetBufferSize(src_struct.mode);
            working_buf_ptr = malloc(buf_size);
            SRC_HANDLE handle = IaaSrc_Init(working_buf_ptr, &src_struct);
    
            //main process
    
            fread(audio_input, sizeof(char), 44, fin);
            while(fread(audio_input, sizeof(short), src_struct.point_number*src_struct.channel, fin))
            {
                counter++;
                /* Run SRC process */
                T0  = (long)_OsCounterGetMs();
                ret = IaaSrc_Run(handle, audio_input,audio_output, &OutputSampleNum);
                T1  = (long)_OsCounterGetMs();
                avg += (T1 - T0);
                if(ret != 0)
                {
                    printf("Error occured in Sampling rate converter\n");
                    return -1;
                }
                //write output file information
                total_size += src_struct.channel*OutputSampleNum*sizeof(short);
                fwrite(audio_output, sizeof(short), src_struct.channel*OutputSampleNum, fout);
            }
            GetHeaderResult(total_size,(int*)new_header);
            fseek(fout,0,SEEK_SET);
            fwrite(new_header, sizeof(char),44, fout);
            avg /= counter;
            printf("AVG is %.2f ms\n",avg);
    
            fclose(fin);
            fclose(fout);
            IaaSrc_Release(handle);
            free(working_buf_ptr);
            printf("SRC done\n");
        return 0;
        }
    

    2. API Reference


    2.1. API List

    API name Features
    IaaSrc_GetBufferSize Get the memory size required for Src algorithm running
    IaaSrc_Init Initialize Src algorithm
    IaaSrc_Run Src algorithm processing
    IaaSrc_Release Release Src algorithm resources
    IaaSrc_GetJsonFileSize SRC get size of json file
    IaaSrc_StructReadFromJson Set json parameter into SRC structure.

    2.2. IaaSrc_GetBufferSize

    • Features

      Get the memory size required for Src algorithm running.

    • Syntax

      unsigned int IaaSrc_GetBufferSize(SrcConversionMode mode);
      
    • Parameters

      Parameter Name Description Input/Output
      SrcConversionMode mode Sample rate conversion type Input
    • Return value

      Return value is the memory size required for Src algorithm running.

    • Dependency

      • Header: AudioSRCProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a

    • Note

      This interface only returns the required memory size. To apply and release the memory, you need to use other APIs.

    • Example

      Please refer to the Example Introduction


    2.3. IaaSrc_Init

    • Features

      Initialize Src algorithm.

    • Syntax

      SRC_HANDLE IaaSrc_Init(char *workingBufferAddress,
      SRCStructProcess *src_struct);
      
    • Parameters

      Parameter Name Description Input/Output
      working_buffer_address Memory address used by Src algorithm Input
      SRCStructProcess Src algorithm initialization structure pointer Input
    • Return value

      Return value Result
      Not NULL Successful
      NULL Failed
    • Dependency

      • Header: AudioSRCProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a

    • Example

      Please refer to the Example Introduction


    2.4. IaaSrc_Run

    • Features

      Src algorithm processing.

    • Syntax

      ALGO_SRC_RET IaaSrc_Run(SRC_HANDLE handle, short *audio_input, short
      *audio_output, int* output_size);
      
    • Parameters

      Parameter Name Description Input/Output
      handle Src algorithm handle Input
      audio_input Data pointer before resampling Input
      audio_output Resampled output data pointer Output
      output_size Resampled output data length. According to SRC mode and point_number, this data length will increase or decrease with the ratio of sampling rate change.
      Example: if the SRC mode is convert 8K to 48K, the output_size will be 6 times of point_number.
      Output
    • Return value

      Return value Result
      0 Successful
      Non-zero Failed, refer to Error code
    • Dependency

      • Header: AudioSRCProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a

    • Note

      • The buffer stored in audio_output needs to be passed in by the application

      • Npoints range: ≤1536

    • Example

      Please refer to the Example Introduction


    2.5. IaaSrc_Release

    • Features

      Release Src algorithm resources.

    • Syntax

      ALGO_SRC_RET IaaSrc_Release(SRC_HANDLE handle);
      
    • Parameters

      Parameter Name Description Input/Output
      handle Src algorithm handle Input
    • Return value

      Return value Result
      0 Successful
      Non-zero Failed, refer to Error code
    • Dependency

      • Header: AudioSRCProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a

    • Example

      Please refer to the Example Introduction

    2.6. IaaSrc_GetJsonFileSize

    • Features

      SRC get size of json file.

    • Syntax

      unsigned int IaaSrc_GetJsonFileSize(char* jsonfile);
      
    • Parameters

      Parameter name Description Input/Output
      jsonfile name of json file Input
    • Return value

      Return value is the memory size required for decoding json file.

    • Dependency

      • Header: AudioSrcProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a

    2.7. IaaSrc_StructReadFromJson

    • Features

      Set json parameter into SRC structure.

    • Syntax

      ALGO_SRC_RET IaaSrc_StructReadFromJson(SRCStructProcess* src_struct, char* jsonBuffer, char* jsonfile, unsigned int buffSize);
      
    • Parameters

      Parameter name Description Input/Output
      src_struct src parameter structure Input
      jsonBuffer json buffer memory address Input
      jsonfile name of json file Input
      buffSize size of json file Input
    • Return value

      Return value Result
      0 Successful
      Non-zero Failed, refer to Error code
    • Dependency

      • Header: AudioSrcProcess.h

      • Library: libSRC_LINUX.so/ libSRC_LINUX.a


    3. SRC Data Type


    3.1. SRC data type list

    DATA TYPE Description
    SrcConversionMode Src algorithm sampling rate conversion type
    SRCStructProcess Src algorithm initialization parameter structure type
    SrcInSrate Src algorithm sampling rate type
    SRC_HANDLE Src algorithm handle type
    SrcFilterOrder Define low pass filter order

    3.2. SrcConversionMode

    • Description

      Define Src algorithm sampling rate conversion type.

    • Definition

      typedef enum{
      
          SRC_8k_to_16k,
      
          SRC_8k_to_32k,
      
          SRC_8k_to_48k,
      
          SRC_16k_to_8k,
      
          SRC_16k_to_32k,
      
          SRC_16k_to_48k,
      
          SRC_32k_to_8k,
      
          SRC_32k_to_16k,
      
          SRC_32k_to_48k,
      
          SRC_48k_to_8k,
      
          SRC_48k_to_16k,
      
          SRC_48k_to_32k,
      
          SRC_24k_to_8k,
      
          SRC_24k_to_16k,
      
          SRC_24k_to_32k,
      
          SRC_24k_to_48k,
      
          SRC_8k_to_24k,
      
          SRC_16k_to_24k,
      
          SRC_32k_to_24k,
      
          SRC_48k_to_24k
      
      }SrcConversionMode;
      
    • Member

      Member name Description
      SRC_8k_to_16k 8K resampling to 16K
      SRC_8k_to_32k 8K resampling to 32K
      SRC_8k_to_48k 8K resampling to 48K
      SRC_16k_to_8k 16K resampling to 8K
      SRC_16k_to_32k 16K resampling to 32K
      SRC_16k_to_48k 16K resampling to 48K
      SRC_32k_to_8k 32K resampling to 8K
      SRC_32k_to_16k 32K resampling to 16K
      SRC_32k_to_48k 32K resampling to 48K
      SRC_48k_to_8k 48K resampling to 8K
      SRC_48k_to_16k 48K resampling to 16K
      SRC_48k_to_32k 48K resampling to 32K
      SRC_24k_to_8k 24K resampling to 8K
      SRC_24k_to_16k 24K resampling to 16K
      SRC_24k_to_32k 24K resampling to 32K
      SRC_24k_to_48k 24K resampling to 48K
      SRC_8k_to_24k 8K resampling to 24K
      SRC_16k_to_24k 16K resampling to 24K
      SRC_32k_to_24k 32K resampling to 24K
      SRC_48k_to_24k 24K resampling to 24K
    • Related data types and interfaces

      IaaSrc_GetBufferSize


    3.3. SRCStructProcess

    • Description

      Define Src algorithm initialization parameter structure type.

    • Definition

      typedef struct{
      
          SrcInSrate WaveIn_srate;
      
          SrcConversionMode mode;
      
          unsigned int channel;
      
          SrcFilterOrder order;
      
          unsigned int point_number;
      
      }SRCStructProcess;
      
    • Member

      Member name Description
      WaveIn_srate Sampling frequency of source data
      mode Sampling frequency conversion mode, please choose according to the sampling frequency of source data and output data.
      channel Source data channels. Support 4 channel data.
      order Low pass filter order
      point_number Input data point number. Defult value must smaller than 1536, and it must be integer after conversion. User can use following command to check:
      strings libSRC_LINUX.so | grep PN
    • Related data types and interfaces

      IaaSrc_Init

      IaaSrc_StructReadFromJson


    3.4. SrcInSrate

    • Description

      Define Src algorithm sampling rate type.

    • Definition

      typedef enum{
      
          SRATE_8K = 8,
      
          SRATE_16K = 16,
      
          SRATE_32K = 32,
      
          SRATE_48K = 48,
      
          SRATE_24K = 24
      
      }SrcInSrate;
      
    • Member

      Member name Description
      SRATE_8K 8K sampling frequency
      SRATE_16K 16K sampling frequency
      SRATE_32K 32K sampling frequency
      SRATE_48K 48K sampling frequency
      SRATE_24K 24K sampling frequency
    • Related data types and interfaces

      SRCStructProcess


    3.5. SRC_HANDLE


    3.6. SrcFilterOrder

    • Description

      Define low pass filter order.

    • Definition

      typedef enum{
          ORDER_LOW   =   0,
          ORDER_HIGH  =   1
      }SrcFilterOrder;
      
    • Member

      Member name Description
      ORDER_LOW Low order
      ORDER_HIGH High order
    • Related data types and interfaces

      SRCStructProcess


    4. Error Code

    SRC API error codes are shown as follow:

    Error code Definition Description
    0x00000000 ALGO_SRC_RET_SUCCESS Successful
    0x10000601 ALGO_SRC_INIT_ERROR Not initialized
    0x10000602 ALGO_SRC_RET_INVALID_MODE Parameter setting is invalid
    0x10000603 ALGO_SRC_RET_INVALID_HANDLE HANDLE is invalid
    0x10000604 ALGO_SRC_RET_INVALID_CHANNEL Channel number doesn`t support
    0x10000605 ALGO_SRC_RET_INVALID_POINT_NUMBER Points per frame doesn`t support
    0x10000606 ALGO_SRC_RET_INVALID_SAMPLE_RATE Sampling frequency doesn`t support
    0x10000607 ALGO_SRC_RET_API_CONFLICT Other APIs are running
    0x10000608 ALGO_SRC_RET_INVALID_CALLING Incorrect order of calling API
    0x10000609 ALGO_SRC_RET_INVALID_JSONFILE SRC Json related error