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

Short Description

Roon Extension to play random tracks or albums

Description

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.

Screenshots

Status:

Settings:

Availability

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.
4 Likes

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ā€.

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!

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ā„¢.

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.

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ā€¦

3 Likes

Version 0.2.0 is now available!

2 Likes

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:

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ā€¦

Thanks, Jan! Thatā€™s what I always missed in Roon.

1 Like

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.

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ā€™.

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

1 Like

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

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?

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?

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.

1 Like

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.

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.

1 Like