cancel
Showing results for 
Search instead for 
Did you mean: 

How to transmit Audio using UART.

LR.2
Associate III

Hi,

I'm using STM32WB5MM-DK board interfaced with SPH0645LM4H I2S mic for capturing audio. I also connected a playback speaker with the setup I have mentioned. I also configured UART for transmitting the PCM data from STM32WB5MM-DK to PC. When I transfer and convert it to audio file in PC I hear some crackling sound but on the playback speaker I'm not hearing any crackling or noise.

Sample rate: 16KHz; Channel: Stereo; UART baudrate: 460800.

Help me out with this issue.

Thanks in advance.

This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
7 REPLIES 7

> convert it to audio file in PC

How?

JW

Hi JW,

Using python script I'm converting the data to .wav file.

AScha.3
Chief III

>Sample rate: 16Hz ? really? as wav for subsonic recording?

at 460k you can transmit it in ascii , with some comments.

If you feel a post has answered your question, please click "Accept as Solution".

Sorry It's 16KHz.

AScha.3
Chief III

aaa, new game. now you have max. 14 bit/sample (460800/16000/2 = 14,4 ).

so you could use 8 bit resolution without problem. or use compression, something like MP3 .

or go to 1Mb transmission, then 16b would be possible.

If you feel a post has answered your question, please click "Accept as Solution".

Instead of sound from microphone, try to transmit and playback constant data, something easily recognizable, such as sawtooth - that's also easily generated at the mcu side, simply by incrementing a variable.

JW

KnarfB
Principal III

... and later a tone generator like phyphox on your smartphone.

... and a tool like Audacity on the PC that can import raw data in various formats.

Despite of using the UART you may use Semihosting and directly open and write to a file on the host from MCU code. See AN4989 Application note "STM32 microcontroller debug toolbox" for details.

Bandwith is limited, so if you use compression, start with something easy like G.711 or ADPCM.

hth

KnarfB