Fast-booting Internet Radio
Richard Smith (3198) 2 posts |
There’s a tl;dr in bold at the bottom of the post so I don’t get shouted at too much for rambling! ;) I’ve long wanted an excuse to use RISC OS in a Raspberry Pi project (mainly due to nostalgia – those A3000s in primary school just seemed so magical!) Anyway, I finally got my excuse, and I managed to get it working pretty well, too! (As a bit of background, I’m pretty comfortable in Debian, Ubuntu, MacOS and their respective terminals. I’m okay in RISC OS’s gui, but my star commands leave something to be desired.) So, my father wants an internet radio in his garage. He would like it so he can turn the power on and the local radio station plays, then turn it off without worrying about doing any damage. I figure RISC OS is my safest bet. I also reckoned it would give me the fastest boot time. The house and garage are all kitted out with hard-wired networking, so that’s not an issue. I’ve managed to get Risc OS set up on a RPi2 with NetRadio installed and configured to run on boot and immediately begin playing a stream of our local radio station. I then got the time between flicking the power on and hearing the stream from 40s down to 26s by:
As it is, this is already fit for purpose. However, for my own amusement as much as anything else, I’d like to get this time down to the bare minimum. I’ve seen it suggested online that switching from the class 10 micro SD to a class 4 or 6 may actually speed up boot times, apparently due to class 10 being optimised for large sequential reads, and the class 4s or 6s allegedly being faster for small and random access reads. I’m keen to try this when I can get my hands on more micro SD cards. I couldn’t help but notice that RISC OS Pico boots in just a few seconds on my Pi 2, and wondered if there’s any way to have it play a radio stream. When in normal RISC OS, I noticed I could get it to work by hitting F12 and giving MPlayer the relevant URL (but only after NetRadio had already been used in that session – I guess it does some sort of configuration of MPlayer that I’m failing to give it in the command line. Otherwise, it seems to get the stream and begin playing it successfully, but there’s no sound.) In RISC OS Pico, however, I wasn’t really able to do much of anything. After a quick play around in BASIC, then quitting out to a star prompt, I wasn’t able to launch anything. My suspicion is that MPlayer needs certain modules to be available to it which aren’t currently loaded, but perhaps someone here could advise this noob as to whether my boot-to-radio project is readily achievable in Pico. If not, are there any other ways I could reduce the time between booting and the stream playing? I notice the OS booting takes about half of the 26s (7s to beep, a few more for the gui to appear when running with a monitor, then NetRadio loads, appears to do very little for 5-10 seconds, then springs to life finding and playing the stream). I know it’s a bit of a wordy post for a noob project, so to summarise the actual questions:
Cheers folks! :) |
David Feugey (2125) 2709 posts |
Not sure. I switched to Samsung EVO+ cards… and it’s not slower, but faster than before.
Make your own !Boot. With just minimal things (the needed modules).
Probably buffering sound. |
Richard Smith (3198) 2 posts |
Ah, well. I’ll give it a shot and report back if anything of interest happens, but it’s not the end of the world if I can’t save a few seconds this way.
Sounds like I’ve got some searching to do through the forums! :)
The pause occurs before NetRadio opens a task window and gets the stream. As soon as it begins to do that, it only takes a second or two. |
John Williams (567) 768 posts |
I was intrigued by this, so got Reporter to give me the command NetRadio sends to MPlayer for my preferred listening, Radio 4. The command sent on my set-up was:
which opened up a task window and started playing the stream when invoked from an obeyfile. MPlayer took about 5 seconds to actual sound when started directly in this way. MPlayer doesn’t seem to have any dependencies, and the Taskwindow could be handled by Edit, so perhaps a minimal boot with, say, just a Scrap directory may well work. In the Olden Days on a floppy, just Scrap and System were needed to run most things! |
John Williams (567) 768 posts |
Sorry – of course it does – SharedUnixLibrary! |
Glen Walker (2585) 469 posts |
I was curious so I have just tried NetRadio When NetRadio runs on your machine do you get a TaskWindow with mplayer output or is it hidden? I can actually close NetRadio and the radio station is still playing from the mplayer in the TaskWindow…is this correct? |
John Williams (567) 768 posts |
NetRadio is just a front-end for MPlayer, so can be quit with no immediate effect. MPlayer runs in a task window. It would be possible to redirect this output to Null, but NetRadio doesn’t do this. I resize the task window and put it behind the NetRadio window. It might be handy if NetRadio did this itself. |
Jeffrey Lee (213) 6048 posts |
Don’t forget you can also iconise the window (shift-click on the close icon, or use the iconise button on the window frame if you have that enabled). A future improvement to NetRadio might be to make it implement the TaskWindow protocol so that MPlayer won’t appear in a separate window at all. |
Raik (463) 2061 posts |
I mean you can use mplayer “silent” if you insert the option -msglevel all=0 and no TaskWindow was open. |
John Williams (567) 768 posts |
I tried changing that in the command line I posted earlier: It suppresses the text output, but a blank window still opens. Happily, the streaming is still stopped when the window is closed – otherwise one would have to resort to the Task Manager. |
Raik (463) 2061 posts |
Any time ago… will try after I back at home. I remember I have play around with !Run inside !Mplayer. |
Raik (463) 2061 posts |
You will have a TaskWindow, you get a TaskWindow… The following is “silent” on my machines… Run mplayer -msglevel all=0 -volume 80 -vo none -ao oss http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p (mplayer app is placed in the activ Dir, SharedULib is loaded and !UnixHome was visible for the Filer) If I set -msglevel all=4 … a TaskWindow is visible. [ESC] stop this (all). Back to your first question… 1. I think Pico is a wrong way. You need any “desktop stuff” in background. In 2015 (or before) I try something like this to start Chris Gransdens Mess (EMU) as a MSX machine on my “RISC OS Pandora” without a visible RISC OS Desktop. |