Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By debojitk
#51562
martinayotte wrote:BTW, I forgot to ask :
What is that stream content ? In which direction is it going (in or out going from you Java server) ?
If it MP3 Radio streaming, you should look about VS1053 on ESP solution (no need for Arduino UNO).
Some already ported ReadyToUse firmware for that :
viewtopic.php?p=48287#p48287

Well, its not mp3, its raw pcm bytes. I understand that other shields can be used, but just wondering if the existing module can be used to achieve the functionality.
The raw pcm bytes are sent from java program via a server socket, that is being received by esp, that in turn send the data to arduino via serial. Arduino has a timer to control the frequency of the output.

Thanks,
Debojit
User avatar
By debojitk
#51624 Hi,
I could successfully play a pcm sample on arduino using pwm dac, however there is a confusion. The timer is running at 31250hz at arduino end that is the output sampling rate. So if I transfer a sample recorded at 31250hz it should play correctly. But it seems it is driven by serial speed and not timer speed. In my code I have put the serial speed is 400000 baud, i.e., it can send 50000 bytes/second so, what happens is, when I send a sample of 40000hz it play perfectly on pwm and the ratio of baud rate and sample rate is 50000:40000=1.25. Same things happen when I set the serial speed at 500000 baud and the sample rate is 50000hz, here also serial speed is 62500 (16usec per byte), and the the ratio is 62500:50000=1.25.
More strangely if I decrease the timer interrupt frequency by increasing the OCR2A (say from 64 to 128) the audio quality degrades, i.e., the effective sampling rate gets halved. If i make it 255, the quality gets even lowered but the speed remains same, i.e., the timer speed is not controlling the play speed rather it is driven by serial speed.
Is it occuring due to serial buffer overflow issue because nowhere else in the data path i did any flow control but it is done at the arduino end only. Should I try putting a timer at esp end to synchronize things.

Thanks,
Debojit