How to downsampling from 48K to 16K in remote_mic_tx_raw

Hi, we have successfully implement I2S (not PCM) in remote_mic_tx_raw . we are now trying to interface with an BLUETOOTH module via I2S. but the BLUETOOTH module is 44.1 k or 48k .
can I downsample in RSL10 side to down sample from 48K to 16K ,then sending to wireless,any sample code please

@hfvoip

but the BLUETOOTH module is 44.1 k or 48k .

  1. What is BLUETOOTH module? It is RSL10 bluetooth module?

  2. Can you clarify 44.1K or 48KHz?
    Is this audio sample rate? K – kHz or Kbps?

Our current remote_mic_tx_raw (reaadme_remote_mic__tx_raw.md) is using 16KHz for audio sampling rate (left and right channel).

AI0 and AI1 capture the left and right audio channel data respectively (16 kHz sampling rate) .

Thank you for using our community forum.

48 K is audio sample rate ,48kHz

the bluetooth module (see attached datasheet) is also codec module ,we successfuly test audio function via AUX,SPDIF to RSL10 (remote_mic_tx_raw) via I2S protocol ,sending as 16kHz

we also interested to pass audio from BLUETOOTH to RSL10 ,but not good . when we are testing BLUETOOTH to RSL10,we are sending as 48kHz. I am thinking in rx_DMA_ready_PCM() handling ,I should downsample received data to 16kHz ,below is my code:

in app.h
//20220826 START THIS CONFIG IS for I2S
#define PCM_CFG_RX (PCM_BIT_ORDER_MSB_FIRST |
PCM_TX_ALIGN_LSB |
PCM_WORD_SIZE_16 |
PCM_FRAME_ALIGN_LAST |
PCM_FRAME_WIDTH_LONG |
PCM_MULTIWORD_2 |
PCM_SUBFRAME_DISABLE |
PCM_CONTROLLER_DMA |
PCM_DISABLE |
PCM_SAMPLE_RISING_EDGE |
PCM_SELECT_SLAVE)
//20220826 END

int32_t pcm_buf[4 * SUBFRAME_LENGTH*3];

bool rx_DMA_ready_PCM(void)
{
uint16_t i;
int16_t *left, *right;
int32_t *pcm;
bool status;

/* Effectively using two PCM data buffers to prevent read/write conflicts */
/* Packing ASRC buffer with data received from first part of the PCM RX
 * buffer */


for (i = 0; i < SUBFRAME_LENGTH_LEFT_AND_RIGHT; i +=2 )
{
    *(left++)  = *(pcm++);
    *(right++) = *(pcm++);
    //20220826 BEGIN  IGNORE NEXT 4 int16_t ,because we are downsampling from 48 K to 16K ,
    pcm++;
    pcm++;
    pcm++;
    pcm++;
    //20220826  END 

}

return (status);

}
ATS2853 Datasheet V1.1.pdf (4.9 MB)

@hfvoip

First of all I don’t think it is a good idea to use this Bluetooth audio module to communication with our RSL10 (remote_mic_tx_raw).

Our remote_mic_tx_raw is connectionless. It does broadcast TX only for audio.

Our remote_mic_tx_raw uses G.722 codec for the audio. (I don’t think this Bluetooth module can support this).

Your Bluetooth module supports Low latency SBC decoder and CVSD codec. We don’t know how this module can do code/decode G.722 audio raw data from/to RSL10.

Note: actually, this is Bluetooth classic + BLE module. It only supports Bluetooth Classic audio profile not BLE. (Bluetooth low energy) .

Thank you for using our community forum!