ASRC
概述
ASRC(Asynchronous Sample Rate Converter,异步采样速率转换器)通过改变离散信号的采样率以获得基础连续信号的新离散表示。
功能特性
ASRC 模块支持:
支持 4 个 ASRC 模块。
支持上行模式或下行模式,下行模式支持 ASRC 经过硬件混音 mixer 模块输出, mixer 模块共 2 个。
上行模式时与其他模块的连接关系图如下所示。
ASRC rx 模式与其它模块连接示意图
硬件混音流程如下, mixer 输入由 data 和 tone 构成, data 来自 music 或者 voice, tone 来自提示音, data 和 tone 的混合比例可调, data 和 tone 可单独播放。
mixer 模块使用示意图
下行模式时与其他模块的连接关系图如下所示。
ASRC tx 模式与其它模块连接示意图
输入数据位宽为 32 bit,支持低 24 bit、低 16 bit、双 16 bit 和高 24 bit 有效
支持对输入数字音频信号进行增益控制,调整精度为 0.1875 dB,范围为 -95.8125 dB ~+ 95.8125 dB。
典型输入采样率: 8 kHz、16 kHz、32 kHz、44.1 kHz、48 kHz、96 kHz 和最大 192 kHz 等多种配置。
典型输出采样率: 192 kHz、200 kHz、384 kHz、400 kHz、768 kHz 和 800 kHz 等多种配置。
支持 PPM 调整,控制数据传输速率。
ASRC0、ASRC1 支持硬件 stream EQ,可以增强或者削弱特定频率范围内信号能量。
单个 EQ 模块支持最大 32 个 biqaud filter, 1 个 DRC。 单个 EQ 模块支持两组参数切换。 单个 EQ 模块支持对输入放大 2^N 倍, N=1~8,支持对输入缩小 2^M 倍, M=1~8。 单个 EQ 模块支持对输出缩小 2^M 倍, M=1~8。 支持典型输入采样率: 8 kHz、16 kHz、32 kHz、44.1 kHz、48 kHz、96 kHz 和 192 kHz 等多种配置。
STREAM EQ 与其他模块的连接关系图如下所示。
STREAM EQ与其它模块连接示意图
结构图
单个 ASRC 的内部结构如下图所示。
ASRC 结构图
单个 STREAM EQ 的内部结构如下图所示。
STREAM EQ 结构图
API 介绍
Enums
-
struct wq_asrc_config
Public Members
-
void *irq_param
asrc interrupt callback function input parameter
-
wq_asrc_int_hook irq_cb
asrc interrupt callback function
-
WQ_ASRC_INT_TYPE irq_type
asrc interrupt type
-
uint32_t freq_in
asrc input data frequency
-
uint32_t freq_out
asrc output data frequency
-
int32_t ppm
asrc ppm to contrl transfer rate
-
WQ_ASRC_MODE mode
asrc work mode, tx or rx
-
WQ_ASRC_LATCH_SRC latch
asrc latch src, see WQ_ASRC_LATCH_SRC
-
WQ_ASRC_TRIGGER_SRC trigger
asrc trigger src, see WQ_ASRC_LATCH_SRC
-
WQ_ASRC_BIT_FORMAT format
asrc input data format, see WQ_ASRC_BIT_FORMAT
-
WQ_AUDIO_TIMER_ID timer_id
trigger timer_id when trigger src choose timer
-
int8_t left_shift
asrc input data left shift bit
-
bool mixer_en
-
bool asrc_drv_by_i2stx_en
not support, must be false
-
void *irq_param
-
struct wq_asrc_eq_switch_coeff_cfg
-
struct wq_asrc_eq_speaker_param
- #include <wq_asrc.h>
q: center frequency / bandwidth bandwidth:sound amplitude -3db attenuated, the frequency corresponding range -3db: refers to the amplitude of the sound decreasing to the 0.707 times of the peak, or the sound power decreasing to 1 / 2 times of the peak
Public Members
-
uint32_t sample_rate
the data frequecy of stream eq for speaker
-
float overall_gain
the overall gain of stream eq for speaker
-
float gain[WQ_ASRC_EQ_SPK_PARAM_MAX]
the gain of of stream eq biquad filter parameter for speaker
-
uint32_t freq[WQ_ASRC_EQ_SPK_PARAM_MAX]
the freq of of stream eq biquad filter parameter for speaker
-
float q[WQ_ASRC_EQ_SPK_PARAM_MAX]
the q of of stream eq biquad filter parameter for speaker
-
uint8_t type[WQ_ASRC_EQ_SPK_PARAM_MAX]
the type of of stream eq biquad filter parameter for speaker
-
uint8_t length
the length of stream eq biquad filter for speaker
-
uint32_t sample_rate
-
struct wq_asrc_eq_music_param
Public Members
-
uint32_t sample_rate
the data frequecy of stream eq for music
-
uint32_t freq[WQ_ASRC_EQ_MUSIC_PARAM_MAX]
the freq of of stream eq biquad filter parameter for music
-
float gain[WQ_ASRC_EQ_MUSIC_PARAM_MAX]
the gain of of stream eq biquad filter parameter for music
-
float q[WQ_ASRC_EQ_MUSIC_PARAM_MAX]
the q of of stream eq biquad filter parameter for music
-
float overall_gain
the overall gain of stream eq for music
-
uint8_t type[WQ_ASRC_EQ_MUSIC_PARAM_MAX]
the type of of stream eq biquad filter parameter for music
-
uint8_t length
the length of stream eq biquad filter for music
-
wq_asrc_eq_switch_coeff_cfg_t switch_coeff
the stream eq coeff switch config, see wq_asrc_eq_switch_coeff_cfg_t
-
uint32_t sample_rate
-
struct wq_asrc_eq_drc_config
Public Members
-
uint32_t fs
drc input data frequency in stream eq
-
float make_up_db
drc make up dB of in stream eq
-
float limiter_threshold_db
drc limiter threshold dB of in stream eq
-
int32_t lm_attack_time
drc lm attack time of in stream eq, uint us
-
int32_t lm_release_time
drc lm release time of in stream eq, uint us
-
int32_t gm_attack_time
drc gm attack time of in stream eq, uint us
-
int32_t gm_release_time
drc gm release time of in stream eq, uint us
-
bool drc_on
drc on or off
-
uint32_t fs