Closed glaslos closed 1 year ago
I assume you are using the synchronous version. The fact that buf
is defined as an arg to play
is a MicroPython "trick" which causes the compiler to pre-allocate the buffer. It isn't an invitation to change the size, which is fixed in the device hardware.
I never experimented with online streams. A possible approach might be to use the asynchronous version. A task might maintain a double bytearray
buffer of suitably large size to cope with variations in network performance. A second task would wait until the buffers were full before feeding the player.
I would avoid the "obvious" approach of using my Queue
primitive: this isn't a very efficient way of dealing with bytes.
You should be able to use the stream mechanism for reading the data prior to populating the buffers.
An interesting project.
Closed due to inactivity.
First of all, great library, got it to play audio in no time! I'm using an ESP32, the VS1053 is from LC Technology. I would like to play an online stream. To do so, I open a socket and pass it to the
player.play
function. This works fine and plays the stream as expected, but I get a stutter here an there. I assume the 32 byte buffer might be a bit too small with the network overhead. Changing the length of the buffer causes the VS to garble the audio. I assume the driver is expecting a 32 bytes array and this can't be changed?