Hi Team,
I want to play audio clips over I2S like short audio clips - Connected to device , Disconnected etc, so. I converted.wav file to C- code(Im using WAVtoC software to convert C-code)and stored in flash memory. Below I attached the .wav to c code file.
I'm usingDA7212 Codecto play these audio clips over I2S.
These Audio clips has 8k sampling rate, 16bit bits per sample. Total number of samples around 3500.
I tried with interrupt method to transmit data of 512bytes each, pls check below code
- Number of elements are defined 3500 samples
- Unsigned short PowerOndata[NUM_ELEMENTS] = {--------- }; contains the 3500 samples values ,
- uint16_t *firstarray=STEREO_AUD_DATA; // data is stored Stereo format
- unsigned short STEREO_AUD_DATA[2*NUM_ELEMENTS];
void ConncetAUD(){
int i=0;
// store data in stereo format
for(int i=0;i
STEREO_AUD_DATA[(i*2)] = PowerOndata[i]; //left
STEREO_AUD_DATA((我* 2)+ 1)= PowerOndata [i]; //right
}
firstarray=STEREO_AUD_DATA;
while(i < 15){
if(HAL_I2S_GetState(&CODEC_I2S) == HAL_I2S_STATE_READY){
HAL_I2SEx_TransmitReceive_IT(&CODEC_I2S,firstarray,rxBuffer, 512); // will get callback event here-HAL_I2SEx_TxRxCpltCallback
Display(("voice prompt :%d\n",*firstarray));
i++;
osDelay(200);
}
}
}
3. update data in call back function.
void HAL_I2SEx_TxRxCpltCallback(I2S_HandleTypeDef *hi2s){
firstarray += 512;
}
I'm sure that I configured codec registers properly, I can able to play music and all, which is connected to BT. I'm using stm32f4 series microcontroller, the DA7212 is connected to this controller.
下午,
Have attached a setup file of the Registers writes to do I2C to HP using "These Audio clips has 8k sampling rate, 16bit bits per sample."
Regards,
thank you for replying,
Initial setup was similar to mine registers set up. I have tested with voice prompt like "POWER ON ", but it is not working.
which data you have tested? or you tested with tone generation?
It was tested with a Music File.
okay,
the music file was stored in sd card through i2s you are able to play. Is my understading is correct?
But I want to play the audio clips over i2s through array of samples which is stored in flash memory.
It sounds this is software related rather than the operation of the DA7212.
yeah, it would be issue in the firmware. let you know once i try