Randy the new RPi streamer and player on the block

Mr DRONE7
Thanks Gideon and everyone for a great Player i am trying out Ubuntu Server on Pi4 pretty nice !
I too struggle with NAS mounts i have a pi3 with OMV too .
Raspberrypi documentation has great documentation that helped me search cifs that should give you direction
also i think i had too install cifs utils with ubuntu server and basically mkdir /mnt/openmedia or whatever you want too
mount your server too..also my omv password is default "guest"..then hit path too NAS button in randy (/mnt/openmedia) in my case.
No more oops something went wrong your openmedia folder should populate.I have too do this after every reboot now too figure out a
permanent mounting solution i think thats /etc/fstab ?. Im getting close but no cigar yet!
I hope this helps in someway ..and again thanks Gideon this is great the search bar for music is a great idea!

Screenshot (9).png
 
  • Like
Reactions: 1 user
Member
Joined 2023
Paid Member
@Sumaco
Hoping you can help with NAS access.
I have an Open media Vault NAS that is found by other players without problem. (MoOde, Volumio, rPlayer) but not by Randy.
I have configured for guest access with no joy, specified client as Randy IP with no joy, setup smb on Randy for the NAS mount with no joy.
Not sure what I am doing wrong or without but if you could outline the steps you made to configure/access your NAS it would be most appreciated.
(currently all that Randy reports is that "Something went wrong" lol ...must have borrowed that phrase from Redmond !)
Sure, I can give it a try... Ya, nice error descriptor...!

Never did anything special for this configuration then for other rpi OS. I should mention that I do not use the guest accounts anywhere. The account used is an authenticated account with RO privileges on the target NAS share.

Reference variables:
Local Randy mount is /mnt/Music
Library sourced //ajaxnas02/Musid_Dev

Here is my routine:

Software:
sudo apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils

Test:
sudo mount -t cifs //ajaxnas02/Music_Dev /mnt/Music -o user=username,pass=SomeSecretPassword

Check:
username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music



If all good:
sudo umount /mnt/Music

Automate to mount on boot:
Create a credentials file to input for fstab and add two lines:
vi ~/.smbcredentials
username=readOnlyUsernaneOnNAS
password=SomeSecretPassword

Protect:
chmod 600 ~/.smbcredentials

Edit fstab and add the mount info to the end of the file:
sudo cp /etc/fstab ~/fstab.orig
sudo vi /etc/fstab


# SMB mount for Music library:
//ajaxnas02/Music_Dev /mnt/Music cifs credentials=/home/username/.smbcredentials 0 0

Test:
sudo mount -a
username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music

If your all good... test that the mount comes back after a reboot:
sudo shutdown -r now
username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music


Once your done and if your paranoid about security, clear history:
username@randy:~ $ history |grep pass
12 mount -t cifs user=username,pass=SomeSecretPassword //ajaxnas02/Music_Dev /mnt/Music
15 sudo mount -t cifs //ajaxnas02/Music_Dev /mnt/Music -o user=username,pass=SomeSecretPassword
195 history |grep password

username@randy:~ $ history -d 12 && history -d 15


Hope there are no typos in the above! :) Let us know how you get on.
P.S. You may want to check that versions of SMB supported on the NAS share.
Diagnostics > Services > SMB/CIFS for protocol errors and also Under SMB/CIFS > Settings > Advanced Settings check the SMB3 and clear text stuff.
 
  • Like
Reactions: 1 user
Member
Joined 2023
Paid Member
@gideon Update via update.sh and seems the to be current. It did receive the following notice which maybe of interest.
-------------------------------------------
######>>> installing Randy Dependencies
-------------------------------------------
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'drivelist@11.1.0',
npm WARN EBADENGINE required: { node: '>=16 < 19' },
npm WARN EBADENGINE current: { node: 'v20.2.0', npm: '9.6.6' }
npm WARN EBADENGINE }

added 341 packages in 2m

72 packages are looking for funding
run npm fund for details
-------------------------------------------
######>>> starting randy service
-------------------------------------------

Feature suggestions:
* Add current version number to the Settings page and also to the startup sequence in the log:
randy randy-node[7419]: [27.05.2023 10:35.40.440] [LOG] Welcome to Randy version 1.0.1.1 - localhost:80 - !
  • Option to enable or disable autostart playback on startup
  • Somewhere on main screen display current playing track specifications: Format, Sample Rate, Channels, Bits per sample
Track info: FLAC, 44.1kHz, 2ch, 24bit
 
Thank you @Sumaco and @picman84. Great information and I now have NAS access. I was close but your posts gave the final fixes.

I turned off the Guest access and went back to the User...and realised there was an illegal character in the password. Other players must have the patch that converts these included so rather than modifying the users password and having to reconfigure every other player instances I simply made a new user with a 'legal' password.

The check for mount worked so went ahead and tested. Yet to configure auto-mount and finish but enjoying listening now.

@Sumaco no typos ! :) the only thing missing for anyone else beginning would be to add the command,
sudo mkdir /mnt/Music
and note the Music Source custom path is then /mnt/Music
 
  • Like
Reactions: 1 user
Member
Joined 2023
Paid Member
@Sumaco no typos ! :) the only thing missing for anyone else beginning would be to add the command,
sudo mkdir /mnt/Music
and note the Music Source custom path is then /mnt/Music

Thanks for the feedback and validating. I can't edit the original post but have amended and cleaned up if others can also benefit.
@Moderation Team perhaps you can repost the below to #42 ?



Sure, I can give it a try...

Never did anything special for this configuration then for other rpi OS. I should mention that I do not use the guest accounts anywhere. The account used is an authenticated account with RO privileges on the target NAS share.

Reference variables, adjust to suit your environment:
Local mount path is /mnt/Music
Library //ajaxnas02/Musid_Dev

Here is my routine:

Make the mount directory:
sudo mkdir /mnt/Music

Software:
sudo apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils

Test:
sudo mount -t cifs //ajaxnas02/Music_Dev /mnt/Music -o user=username,pass=SomeSecretPassword

Check:
username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music



If all good:
sudo umount /mnt/Music

Automate to mount on boot:
Create a credentials file to input for fstab and add two lines:
vi ~/.smbcredentials
username=readOnlyUsernaneOnNAS
password=SomeSecretPassword

Protect:
chmod 600 ~/.smbcredentials

Edit fstab and add the mount info to the end of the file:
sudo cp /etc/fstab ~/fstab.orig
sudo vi /etc/fstab

# SMB mount for Music library:
//ajaxnas02/Music_Dev /mnt/Music cifs credentials=/home/username/.smbcredentials 0 0


Test:
sudo mount -a

username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music

If your all good... test that the mount comes back after a reboot:
sudo shutdown -r now

username@randy:~ $ df -h |grep Music
//ajaxnas02/Music_Dev 14T 9.8T 3.6T 74% /mnt/Music


Once your done and if your paranoid about security, clear history:
username@randy:~ $ history |grep pass
12 mount -t cifs user=username,pass=SomeSecretPassword //ajaxnas02/Music_Dev /mnt/Music
15 sudo mount -t cifs //ajaxnas02/Music_Dev /mnt/Music -o user=username,pass=SomeSecretPassword
195 history |grep pass

username@randy:~ $history -d 12 && history -d 15


Hope there are no typos in the above! :) Let us know how you get on.
P.S. You may want to check that versions of SMB supported on the NAS share.
Diagnostics > Services > SMB/CIFS for protocol errors and also Under SMB/CIFS > Settings > Advanced Settings check the SMB3 and clear text stuff.[/I][/I]
 
  • Like
Reactions: 1 user
Tried the x86-64 version today.
HP T-520 Thin client. (Dual core, 4GB ram, 16GD flash storage.)
Installed Ubuntu 22.04 server and ran the install as per your post.
Went well (apart from about a zillion 'what services do you want to restart' messages from the ubuntu server....just tabbed down to the default O.K each time and continued to the final reboot :) )
Followed @Sumaco How-to for NAS access and perfect !!

Excellent work all !! and many thanks for the guidance and code !!

https://www.parkytowers.me.uk/thin/hp/t520/index.shtml
 

Attachments

  • randy.jpg
    randy.jpg
    78.1 KB · Views: 63
Last edited:
Hi all,

Today I had some issues with higher bitrate streams (320k and flac).
Over time memory consumption increased, eventually causing mpv to start to ‘stutter’ and terminate.
It would do so continuously, perhaps respawning every 15 minutes, because Randy would spawn a new instance.
I’m not sure about the cause for this resource leak, but it seems that spawning the process with option shell: true fixes it.
For now it is playing Radio Paradise flac stream for almost 2 hours without memory growth.

Another (unrelated) thing I see is that in the command line for mpv, script-opts isn’t prefixed with --
That seems related to youtube stuff (I don’t use that) so I have no idea about the impact of that.
Screenshot 2023-05-28 at 21.48.40.png
 
It's been an eventful weekend both in personal life and this thread!

Thanks @Sumaco @DRONE7 @picman84 for helping to get NAS working, I will add the information to the wiki this week as well once I get some time to digest it. @picman84 - where you able to make it work on boot with the latest instructions?

@Sumaco - you can ignore the warning, I am using this cool module from the balena folks which is what they use for etcher to find attached drives.. and seems like they haven't updated their support to nodejs v20 which just came out recently. it works well regardless..
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'drivelist@11.1.0',
npm WARN EBADENGINE required: { node: '>=16 < 19' },
npm WARN EBADENGINE current: { node: 'v20.2.0', npm: '9.6.6' }
npm WARN EBADENGINE }

@DRONE7 - you are welcome - with Raspberry pis becoming an expensive collectors item these days.. thin clients are making a comeback.
Installed Ubuntu 22.04 server and ran the install as per your post.
Went well (apart from about a zillion 'what services do you want to restart' messages from the ubuntu server....just tabbed down to the default O.K each time and continued to the final reboot :) )
Man, I am wondering if I can stop this as well! Ubuntu seems to trigger it every time theres some updated packages, I guessing people using ubuntu in docker images have probably figured it out.
In any case for others trying the same - for now you can just accept these when they come up and move on with the installation script.

1685322340146.png


@PjVervoorn -
I’m not sure about the cause for this resource leak, but it seems that spawning the process with option shell: true fixes it.
For now it is playing Radio Paradise flac stream for almost 2 hours without memory growth.

Another (unrelated) thing I see is that in the command line for mpv, script-opts isn’t prefixed with --
That seems related to youtube stuff (I don’t use that) so I have no idea about the impact of that.
Another great find, when you are running things on such low powered devices it forces you to find optimisations. I actually played around with different spawn options when I worked on this part a few years ago but didn't test the shell: true option. I need to look into it a bit more to make sure there's no artefacts and publish an update if it's all good.
script opts for mpv part - yes this is the option that sets yt-dlp as default instead of youtube-dl which seems to be dormant for the past couple of years. The syntax should be correct, even though not best practice.
I know you are a radio guy (me too), but I use this a lot to play 1-2 hours shows off of mixcloud - https://www.mixcloud.com/discover/fluxfm/ , you can also try links from youtube, soundcloud etc..

1685323710453.png


@Sumaco
Feature suggestions:
* Add current version number to the Settings page and also to the startup sequence in the log:
randy randy-node[7419]: [27.05.2023 10:35.40.440] [LOG] Welcome to Randy version 1.0.1.1 - localhost:80 - !
  • Option to enable or disable autostart playback on startup
  • Somewhere on main screen display current playing track specifications: Format, Sample Rate, Channels, Bits per sample
Track info: FLAC, 44.1kHz, 2ch, 24bit
Noted this together with rescanning the library! I will try to carve out some time this week to put more things out there.

I am wondering also how do you guys feel about:
  • volume control?
  • normalisation (keeping volume of different tracks consistent)
* both may have some effect on sound quality

Good stuff and lots of movement!
Gideon
 
snap...I was about to enquire about a switch for normalisation.
Yes that would be welcome. Not a problem when playing whole albums but for when I leave Randy in random (or is that randyom ?) background mode where tracks from the NAS are variable...often markedly so.

I use a downstream volume control and generally set the fixed output from a player using alsamixer. Those who use powered speakers or direct to a power amplifier may appreciate a volume control.
Yes, plenty of cheap thin clients about currently but as more players offer alternative versions to their RPi version perhaps that supply may dwindle or command higher prices .
Fortuitously, I have a decent number of both Thin clients and Pi for my regular players and experiments.

A suggestion for some feedback or message when the shutdown button is activated.
Randy stops as expected but the web page remains active and can still be switched between Home/Files/Settings giving the impression that Randy is still running. (Firefox...)
 
Last edited:
Another great find, when you are running things on such low powered devices it forces you to find optimisations. I actually played around with different spawn options when I worked on this part a few years ago but didn't test the shell: true option. I need to look into it a bit more to make sure there's no artefacts and publish an update if it's all good.
script opts for mpv part - yes this is the option that sets yt-dlp as default instead of youtube-dl which seems to be dormant for the past couple of years. The syntax should be correct, even though not best practice.
I know you are a radio guy (me too), but I use this a lot to play 1-2 hours shows off of mixcloud - https://www.mixcloud.com/discover/fluxfm/ , you can also try links from youtube, soundcloud etc..
It’s good I wrote ‘it seems', because today it wasn’t stable at all.
Even with 192k streams mpv’s memory usage kept growing.
Basically I have no idea what to do to pinpoint the problem, let alone come up with a solution.
 
Thanks @DRONE7 !
my test music library has a wide range of glorious napster trophies and friend of friends music files with as much randyomness I could find and among other oddities the volumes of the tracks have quite a big range... I just want to see whats a good way to do volume+normalisation while keeping the best sound quality.
Also thanks for mentioning the feedback to user when they press shutdown, I will add that into the list as well.. i am thinking a kind of global Randy is offline state which can be shown in different situations where the server side is unreachable.

@PjVervoorn - i tested it as well, with and without the shell: true and both had a similar RAM usage (with fluxfm) both of them peaked at around 290mb-ish as you can see below which may be hitting your devices' RAM limitations.. what I am thinking and will try to explore when I am back home this evening is that mpv has some buffer cache options that we can play around with and see if there is a sweet spot we can find there.
I personally have had radio stations playing non-stop for days on Randy on my 3b+ which has 1gb RAM but I haven't left it running for so long on my Zero2 which has 512MB RAM so its a good opportunity to test it out.

1685407459271.png

1685407472472.png


Gideon
 
I just published a new release :)

I really recommend to use the update script as per instructions in the project readme https://github.com/PapaSimons/Randy (or the one @PjVervoorn posted here).

This is quite an exciting release with lots of new things that came from many ideas from the different forum members.

Randy v1.0.14​

whats new:
  • Added memory optimisations, randy now limits the demuxer cache to 4mb and the stream caching to 8s - @PjVervoorn
  • Added a toast message to show when randy server goes offline (when you power off and others) @DRONE7
  • Added a checkbox in the settings to determine if to auto play the last track when Randy restarts @Sumaco
  • Now showing Format, Sample Rate, Channels, Kpbs for the playing track @Sumaco
    • note: unfortunately mpv doesn’t return a reliable bit depth, I may look into that in the future from file metadata angle
  • Added placeholder images for random albums before they load
  • Added version number in settings @Sumaco
notes on memory issues:
@PjVervoorn and I have been testing the memory issues.
* The latest release added some memory controls which do a great job at taming almost all of the issues
* In some edge situations, we found a music stream that has flacm - FLAC (with metadata) which seems to push the memory and CPU high and this seems to come when older versions of mpv or ffmpeg get installed on the rpi os lite and dietpi via apt-get. on my Ubuntu installations mpv/ffmpeg is latest and its not an issue.
* we will continue to look into it but this is pretty edge right now and shouldn't affect most of the usage of Randy.
if you notice any issues like this on other streams let me know..

notes on bit depth:
while sample rate, number of channels etc.. all come nicely, mpv right now can only return some weird indicators for bit depth which may not be easy to translate to something like 16bit 24bit etc..
But..... the good news is that I can get the kpbs which actually shows the quality of compression in live time!
By looking at kbps you can see how vbr compressed files and audio streams behave when you play them.

I may look for other places to get bit depth like tag metadata but on a bit lower priority since the initial scan doesn't look like its consistently present in tags and I am not sure how trustworthy it is.

note from Ursula - ain't yo punk a$$ release!

1685593804546.png
 
@ppp000 - you are right, mpv will look for what the OS has already as default and use that, for example in macos it will use coreaudio and in linux it will use alsa/pipewire/pulse.
There is also a param you can set to force the driver you want - https://mpv.io/manual/stable/#audio-output-drivers

In Randy on rpi, I am going directly to alsa and instead of mpv->pipewire/pulse->alsa
 
Last edited:
Update went fine. Thanks for the new features !
A little confused by the metadata output...all my 44.1 kHz files are reported as 48kHz. Is there some resampling to facilitate MPV ?
@DRONE7 - this is indeed interesting :) I think you are right..
I am checking some of the mpv github discussions and seems like it's an ALSA thing thats why I couldn't see it on my Mac.
I added a small change in the param to prevent this which I tested on RPI OS..

You can re-run the update script and see if it works. I will try to test it today on Ubuntu as well - works well on ubuntu as well.
 
Last edited: