2020-09-17 04:15 AM
Hi,
I am using STM32L476G-DISCO Board, I want to interface its mic and read audio , process it and transmit it on audio jack, to listen audio,
can any body help me or provide me code to do this.
Thanks
Regards
2020-09-17 04:29 AM
Review Projects/Examples in CubeL4.
JW
2020-09-17 11:09 PM
I got it, and it fulfill my requirement.
Thank you so much :)
2020-09-17 11:12 PM
Mr. wclawek.jan now I want to encrypt audio stream, how I can do this...?
this is code main body code
int main(void)
{
uint32_t i;
/* STM32L4xx HAL library initialization:
- Configure the Flash prefetch
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the system clock to have a frequency of 80 MHz */
SystemClock_Config();
/* Configure LED4 */
BSP_LED_Init(LED4);
/* Initialize DFSDM channels and filter for record */
DFSDM_Init();
/* Initialize playback */
Playback_Init();
/* Start DFSDM conversions */
if(HAL_OK != HAL_DFSDM_FilterRegularStart_DMA(&DfsdmFilterHandle, RecBuff, 2048))
{
Error_Handler();
}
/* Start loopback */
while(1)
{
if(DmaRecHalfBuffCplt == 1)
{
/* Store values on Play buff */
for(i = 0; i < 1024; i++)
{
PlayBuff[2*i] = SaturaLH((RecBuff[i] >> 8), -32768, 32767);
PlayBuff[(2*i)+1] = PlayBuff[2*i];
}
if(PlaybackStarted == 0)
{
if(0 != audio_drv->Play(AUDIO_I2C_ADDRESS, (uint16_t *) &PlayBuff[0], 4096))
{
Error_Handler();
}
if(HAL_OK != HAL_SAI_Transmit_DMA(&SaiHandle, (uint8_t *) &PlayBuff[0], 4096))
{
Error_Handler();
}
PlaybackStarted = 1;
}
DmaRecHalfBuffCplt = 0;
}
if(DmaRecBuffCplt == 1)
{
/* Store values on Play buff */
for(i = 1024; i < 2048; i++)
{
PlayBuff[2*i] = SaturaLH((RecBuff[i] >> 8), -32768, 32767);
PlayBuff[(2*i)+1] = PlayBuff[2*i];
}
DmaRecBuffCplt = 0;
}
}
}
2020-09-18 01:00 AM
This is where incoming samples are copied into the output buffer:
> PlayBuff[2*i] = SaturaLH((RecBuff[i] >> 8), -32768, 32767);
So, presumably, this is where you add your encryption, whatever it is
PlayBuff[2*i] = YourEncryption(SaturaLH((RecBuff[i] >> 8), -32768, 32767));
I have no idea what do you expect from this - it will play back nothing but noise - but I also am not interested.
JW
2020-09-22 11:22 PM
Dear JW,
I want to encrypt audio stream,
let me explain to you....!
let suppose I have two stm32l4-discovery board "a" and "b", board "a" get voice from its mic and send to controller, controller encrypt it and send to audio jack, this audio jack is connected to board "b" (instead of mic on board "b") , controller(of board "b") get this encrypted audio decrypt it and transmit to audio jack of of board "b", and here we can hear audio by using handsfree to this jack, I hope you have understand...!
Thanks
Regards
2020-09-23 02:51 AM
You can't encrypt the analog audio, encryption does not work in this way.
You would need to take the digital audio, encrypt it, then encode that digital signal into analog using something similar that the olde phone modems did (see V.23/V.22/V.32 etc.), convert into analog, on the other end convert back to digital and decode, then decrypt and convert into the analog audio signal. That requires nontrivial DSP processing and/or a significantly higher transfer bandwidth than you'd think.
JW
2020-09-24 03:35 AM
ok thanks dear.
tell me this can be possible by using STM32L4-DISCO board????
2020-09-24 03:45 AM
I don't know.
JW
2020-09-24 04:09 AM
Ok thank you so much ....!