A place users can post their projects. If you have a small project and would like your own dedicated place to post and have others chat about it then this is your spot.

User avatar
By Sprite_tm
#20660
armSeb wrote:In fact, the playback speed decreases periodically, when I have latency issues (ie sound cuts).

Yes, that is the clock adjustment feature thing. Basically, because the clock speed between the ESP and whatever server serves up the audio differs, without any adjustment the ESP is going to have too much or too little data. The downside of the current implementation is that sound will be output slower when the audio buffer runs dry. Try fiddling with the ADD_DEL_BUFFPERSAMP define in playerconfig.h, by eg making it 500.


Jorge: You may not be able to use that and I2S simultaneously; I may be wrong but off the top of my head the I2S and HSPI port share some pins. Either you can get an ESP12E or you can pop off the metal top of the ESP12 and piggyback the SPI chip on top of the flash chip.
User avatar
By armSeb
#20697
Sprite_tm wrote:
armSeb wrote:In fact, the playback speed decreases periodically, when I have latency issues (ie sound cuts).

Yes, that is the clock adjustment feature thing. Basically, because the clock speed between the ESP and whatever server serves up the audio differs, without any adjustment the ESP is going to have too much or too little data. The downside of the current implementation is that sound will be output slower when the audio buffer runs dry. Try fiddling with the ADD_DEL_BUFFPERSAMP define in playerconfig.h, by eg making it 500.



OK, I can get a smooth play again by modifying :


//Do the rest of the calculations plusminus every 100mS (assuming a sample rate of 44KHz)
cnt++;
if (cnt<1500) return oldVal;
cnt=0;


To :


//Do the rest of the calculations plusminus every 100mS (assuming a sample rate of 44KHz)
cnt++;
if (cnt<1500) return;
cnt=0;

With the code as this, I can listen webradio for many hours without having play speed issues. I have to make more tests with configuration tweaks.


I am working on several improvements :

- Parse HTTP headers and extract icy-metaint to be able to get song titles.
- Parse mp3 stream to get song title.
- Drive an oled screen (SSD1306). I hope there is enough ram to do that.

I modified synth_stereo.c to be able to compile it. I started from synth.c to do that.

Now can I get stereo sound with pwm output (I guess no because you are using the data output of i2s interface). Even in mono, the audio quality is near of the raspberry audio out quality.

Thank you.