Roon Extension: Random Radio v0.2.0 (do the album shuffle)

(Jan Koudijs) #1

Short Description

Roon Extension to play random tracks or albums


Within the Roon Community there are quite regularly queries regarding the randomness of shuffle and the lack of the option to play random albums. After reading about this I asked myself the question if it can be done via the Roon API and I thought it was worth a try. This is what I ended up with, I hope it fills a gap.

Just Random

The extension uses the Browse API to get access to the tracks and albums in your library and uses a random number generator to pick a random entry. This generator is all there is regarding selection. There is no functionality to prevent repetition of artists, or even repetition of songs, it is all defined by the randomness of the generator. As a bit of a gimmick I included the option to select the used generator, I am curious to know if users are starting to like one over the other.

By using a random number generator only, you are going to hear artists that have a lot of tracks in your library more often than artists that only have a single album in your library (just to be clear).

For those who want to know more about the available generators, have a look at the JavaScript module I use:

Tracks and Albums

Besides playing random tracks it is also possible to play random albums. A random album is selected and played completely before a new random album is played. The complete album is added to the Queue and if shuffle is enabled on the queue then the tracks of the album will also be shuffled (according standard Roon behavior).

The random mode can be configured per zone and the available options are:

  • Off
  • Tracks
  • Albums

No need to feed

The Random Radio extension, sort of, competes with the standard Roon Radio functionality. I had to find a way to integrate it in the Roon UI, preventing that you have to go to the extension settings every time you want to play something random.

To start random play for a zone that has the function enabled, you go to the Queue screen for that zone and turn Radio on. The radio button with toggle shortly to indicate that the request is received and Random Radio will start playing, it is not necessary to feed it with a song. While playing, you can stop the random mode by switching radio on again. It will again shortly toggle to give you some feedback and playback will stop when the queue is empty (i.e. at end of track or album).

After turning Random Radio off while still playing, you can turn on Roon Radio by switching radio on again. The switch will stay in the on position to indicate that Roon Radio will start after the queue has finished playing.

Besides explicitly starting Random Radio you can also just play some music and it will take over when the Queue becomes empty and Roon Radio is switched off.





Random Radio can be installed via the Roon Extension Manager, it should appear in the list after the latest repository update has been pulled in by the auto update function.

To learn more about the Roon Extension Manager, visit the Project Wiki or the Forum Post.

There is also a project page on GitHub. Manual installation takes the same steps as manual installation of the Alarm Clock extension.

Important notes!!

  • Use this extension at your own risk!
  • Make regular backups of your Roon database.
  • This extension is in beta status, as is the API it depends on. This means that there can be small or even bigger issues!
  • Using this extension requires some tinkering (as the forum category suggests), the recommended installation method is by using the Roon Extension Manager.

What do you think?

I would like to here from you. If you have questions or suggestions, please let me know.

Album Radio mode
Radio/Shuffle for whole albums
How to: Install Roon Extension Manager on QNAP
(Milton Krueger) #2

Brilliant! Random album is what I’ve always wanted!
A minor niggle - it’s bringing in the tracks to the wrong profile. Instead of “added by Milton” queue shows “added by Lisa” even though the currently selected profile is definitely “Milton”.

(Jan Koudijs) #3

Hi @Milton_Krueger,

Good point, I had not considered profiles.

I created a second profile to see what it brings and how it works. Turns out that the Browse API I depend upon has it’s own profile setting, it is not connected to the profile you selected on your remote. So the current implementation uses the first created profile or something like that.

What I plan to do is add a profile setting to the extension setup. What’s nice about this is that you then can give Random Radio its own profile, allowing you to keep the played tracks in its own history (an opportunity to validate randomness :wink: ).

Thanks for the feedback!

(Ben) #4

Just a note, I believe the profile setting in Roon is a remote level setting. This means that it’s difficult even in principle for the API to have a concept of “the current profile”, we would need something like “the list of current remotes, each of which has a current profile”. The extension would then need to somehow guess from that list what the correct profile is.

Having the extension have a profile setting seems like the Right Thing™.

(Jan Koudijs) #5

Exactly, the extension then becomes a remote on its own. The browse API has its own Settings category so I expect this is the intended use.

(Jan Koudijs) #6

Really nice to see how well thought out the Roon API is, this profile selection works a treat!

I added profile selection to the extension settings:

And I created a new Roon profile named ‘Random Radio’, now all tracks played via the extension end up in the history of this profile:

Shouldn’t take too long for the update to appear…

(Jan Koudijs) #7

Version 0.2.0 is now available!

(Milton Krueger) #8

Thanks Jan! Works fine…
Someday when you don’t have anything to do would it be possible to implement the profile setting on a per zone basis? Just a thought… :smile:

(Jan Koudijs) #9

Just got back to work today after the holidays, so less spare time :frowning:

Your suggestion might be possible, but it will add complexity to the configuration and implementation. Maybe one day…

(Rainer) #10

Thanks, Jan! That’s what I always missed in Roon.

(Rainer) #11

One question: You write:

It seems that with this feature I’ve lost the ability to play some music and stop afterwards. If Radio is turned on, Radio will take over. If Radio is turned off, Random Radio will take over. No possibility of having silence afterwards.

(Jan Koudijs) #12

You can stop Random Radio while it is playing by switching Radio on. The switch will toggle and the queue will finish or you can manually pause playback.

I admit, it requires some ‘getting used to’.

(Rainer) #13

Ah, now I get it. Yes, it’s not easy with only one button available.

(Jan Koudijs) #14

It would be great if the Roon API had facilities to extend the Roon UI. Having only an extension Settings dialog is limited.

(Rainer) #15

One problem remains:
I start with Random Radio turned off in the way you described above. Now I manually select an album and play it, expecting silence afterwards. But Random Radio turns on an plays a random album. Any way to avoid that?

(Jan Koudijs) #16

Every time you start playback Random Radio is activated. So you have to toggle the radio switch for each playback session in order to stop it. You can of course also turn radio off for the current zone via the Settings.

What do you think, should I remove this implicit activation and only use the radio switch to activate/deactivate?

(Rainer) #17

I think it’s better to remove the implicit activation. People will find it just too difficult to understand what’s going on. It’s better to keep it simple.

(Jan Koudijs) #18

You’re right, I will see if I can change this.


When clicking on “Settings” the most times Roon will crash. What could be the reason and how to fix it? I’m running Roon 1.4 (300) with Core on macOS 10.13 and NodeJS 9.5.0.

Settings API can make a remote crash
(Jan Koudijs) #20

Hi @Tekl,

This is a known issue of the Roon API, unfortunately there is no fix yet. Previously I created a thread about this (link is underneath your post), I asked about the status there.