Go Down

Topic: Playing back audio question (Read 288 times) previous topic - next topic

josev

The Arduino playgraound article http://playground.arduino.cc/PWMAudio/PWMAudio

published a  code where the UART is read at a 62.5 Khz rate in order to playback a wave file.

The computer program in Python is sending the wav file at 1 Mbaud but the UART is being read at a 62.5 Khz rate using a timer overflow interrupt.

Is not a bunch of data loss ? The Python program will sent bytes like crazy at 1 MB one after the other just limited by the computer clock  speed but the Arduino code  is reading the UART at the sampling rate.

The way I've understood this to be done is to set the computer side to send byte by byte at 1MB but at a rate of,  for this example 62.5 Khz , then on the Arduino side,  use the UART rx interrupt. This will synchronize the data in the proper way.

Is there something missing on the code published at above link ( either Arduino or Python)? or what am I missing or not quite understanding ?

Thanks a million in advance for any comments!

Jose

josev

Does nobody experienced this. I will appreciate any comment please !!!!!!!!!!!!!

CrossRoads

Does seem like some flow control is needed to prevent loss of data.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Nick Gammon

#3
Jan 14, 2015, 08:11 am Last Edit: Jan 14, 2015, 08:11 am by Nick Gammon
What is enough, pray?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy