Webradio player

Hello,
Thank you all for the excellent work done here !

I would definitely like to be able to play my favorite webradios from my zynth when i’m not playing it, it costs few energy and is already plugged to the speakers.

I made a puredata patch that switches between a few favorites radio using ffplay (ffmpeg) but I found that ffplay won’t output to jack so I now search another way.

Any clue how I could manage to do that ?

Otherwise, is there a “simple” way to create a zynthian interface over a bash or python script ?

Thanks
reg

2 Likes

Hello reg and welcome to the Zynthian community! It would be easier to understand and to help, if you were to post the pd patch.

1 Like

Thanks ronsum for great help, here’s a new version with play/stop control
pd_Radio.zip (11.4 KB)

1 Like

Hi @reg , welcome

I’m interested too :wink:

I found PyRadio:

Don’t know how to integrate PyRadio UI within Zynthian UI and if even it will be possible.
But it looks like it can be scripted:

From what I understand so far, PyRadio use an external player (vlc, mplayer). So if PyRadio has to be run simultaneously with Zynthian, be sure your player is configured to use the jack audio subsystem (and not alsa directly).

Or stream a radio directly using python-vlc:

And PyAir wich looks pretty simple, and maybe adaptable to fits your needs:

Ha, thanks le51, ffplay~ in puredata probably can’t output to jack, just as ffplay in OSes.

I tried the vlc route, with puredata “vlc remote”, but vlc don’t seem to connect to online file/stream since the remote make it listen to localhost for control.

mpv could play a webradio, but from the CLI, and I don’t know how to control it from puredata.

I don’t know how to create a zynthian interface over a python or bash script so I’m forced to DIY.
I guess what I’m missing is an API, that is WIP if I understand correctly

This is could be usefull: writing CUIA scripts that can be launched using the 4 assignable push switches.

Same problem otherwise here: mpv should be able to use Jack audio interface.

It did play thru jack, as I could hear a station from launching mpv via ssh.

“scripts that can be launched using the 4 assignable push switches.”
=> It would be my favorite solution as mpv plays all stations I know.

Where should I start to do that ?
Is there a CUIA script interfacing how to somewhere ?

Cherry on the cake would be to display the output of mpv, as track names appears there

Could you create a PD script to do this? Each MIDI CC control in PD is assigned to an encoder.

I have the pd patch working. I revised your file to include a control to select any of the four radio stations and a volume control. I had to add a PD_LINUX file called ffplay~.pd and a yaml file to get things working.

Here’s the revised file:
Radio.zip (10.6 KB)

Just use the webconf to upload to your zynthian.

Playing webradio on zynthian is nice, thanks for posting the patch. I plan to add more stations to the patch in the near future. Enjoy! :smiley:

3 Likes

Well that works here in the uk!!

Wonderful !
Thank you !

Now I miss the somafm stations, which are in .pls format, that won’t be read by ffplay as I read… :[

Thanks @ronsum for fixing this up. It would be advantageous to see the station name but I guess the Zynthian interface to PD doesn’t support strings, only MIDI CC?

It may be advantageous to be able to stop streaming, e.g. to have the chain loaded ready to use but not consuming too many resources.

2 Likes

Thanks @ronsum ,
I added play/stop control in the patch, uploaded in my 1st comment
@riban, not sure if sending a stop message to ffplay will actually stop consuming data…

1 Like

I did a fork to play backing tracks, with comments, and added speed control.
Will post in a separate thread.

The station names can be shown when selected. I will revise and post.

Here’s the revised radio pd file renamed as
iNetRadio.zip (10.8 KB)

I added five more stations and station names. Selecting the tenth station turns off the streaming.

5 Likes

Very pleasant. Occasional drop out and a little slow in responsiveness to station changes, but I’m sure that’s to be expected. Had it running for over an hour and a half of peaceful piano and only one splat in that period . DAB has done far worse on a thundery day.

Might be an idea to track the implementation of the audioplayer as many of the functions are similar in the two, and a common implementation would unify and simplify audio stream presentation.

Pleasant is the term.
Wonderful arrangement of the boxes in puredata makes a beautiful quarter of a star !