![]() |
![]()
| ![]() |
![]()
Namepyradio - a curses Internet radio player. PyRadio BufferingIntroductionWhen a station is slow (or the internet connection is slow), one might get to a situation where the connection timeout will run out before the connection with the station can be established. Even worse, PyRadio will connect to the station, but the sound will be choppy and crackling. The solution is to use a large enough buffer to connect to the station; this will effectively make PyRadio connect to the station and start receiving data, but will not start playback until the buffer is full. All PyRadio supported players support buffering, using a number of command line parameters to actually set it up. PyRadio will remove all this complexity by making is as simple as inserting a single value to the Configuration Window. In addition to that, or instead of that, one can set up a buffering value for any individual station using the “Buffering” window, shown in this image:
The window opens by pressing “\B” while in the Main mode. It will display the current station’s buffer size (0 means no buffering), and will permit to adjust it, or use the previously used value (pressing “r”). How it all worksPyRadio has both a configuration parameter and a station parameter that will be taken into account when trying to determine if a station will use buffering or not.
If used, the station will be updated and the playlist
will be silently saved.
In this case, a string of the form “7@128” will be inserted in the appropriate field of the station definition, “7” being the buffering value in seconds and “128” the bitrate of the station, which is only relevant to MPlayer. In any case, one can enable or disable the use of buffering by pressing “\b”. This value will not be saved and will be set to True whenever a player change occurs. MPlayer bufferingBoth MPV and VLC will directly use the buffering value (expressed in seconds) in order to buffer a stream. This is not the case with MPlayer unfortunately; it has to receive the number of KBytes to buffer. In order to do that in a consistent way, the station’s bitrate must be known beforehand, which is impossible. So, a workaround is being used: the player will trigger a station update (and a silent playlist save), if:
This way, the first time MPlayer is used to buffer the station the buffering will be incorrect (shorter or longer depending on the real bitrate), but subsequent playback of the station will correctly set the number of KBytes that corresponds to the buffering time set. Parameters usedThe following table shows the command line parameters used by PyRadio when the “Buffering” window is used to set up buffering.
User experienceWhen buffering is enabled, and a connection to a station initializes, PyRadio will display a “[B]” at the top left corner of the window, and display “Buffering:” and the name of the station in the status bar, until it get a token that the buffering has stopped.
An example is shown in the image above. Now, this behavior depends on the station, and the data it sends (or does not send) while it is buffering. For example, an ICY title may be received while buffering, which will be displayed in the status bar. It should be noted that, no volume adjustment can be preformed while buffering.
|