Pi Zero W, Pirate Radio and the PhatBeat

oh, yeah, sorry I thought you meant you’d replaced the default.m3u… the ~/.config/vlc/ folder has nothing to do with the vlcd service @gadgetoid has knocked together, it’s just the standard vlc user config folder (which seemed appropriate enough).

and yep, it’s safe, the only time it would get replaced is if you chose to make a new playlist.m3u and dropped it in your /boot partition (in which case that’s the result you’d expect, hopefully).

The only problem with this version is that the default volume seems to be 50% which is deafening! Is there any way to change/save this to a lower level? I’m struggling to find it.

it can be set in the deamon itself… I think it depends what station you got dialed in, thougn I agree it should be set lower, around 35% sounded more comfortable for me.

I’ve now changed the behaviour to reload the volume saved on exit the previous time, while imposing a safe volume when no such pref can be found (so, typically, the very first time you install and use the radio), which is essentially what we were trying to do with the hardcoded volume on startup.

you should be able to get the latest vlcd by running the setup.sh or vlcradio OLI.

That’s a great idea, thanks.
I’ve just run setup.sh, gone all the way through and rebooted but the volume still reverts to ear-bleeding when I reboot though.

My reboot method was just a sudo reboot now - Don’t know if I’m expected to do it any other way to save the setting.

You should use the power button on the pHAT itself to shut down. I can’t guarantee any other way to reboot or poweroff the Pi would cleanly exit the service, which is required for the volume setting to be saved.

That said, it sounds to me like you have another issue as I would not call the volume ‘ear-bleeding’.Try to disconnect the speaker(s), then access vlc over http and see if the volume is at 100%, which I suspect it might be - expected safe level is 35% (previously 50%).

I have made some changes to /usr/bin/phatbeatd so it will remember the last volume settings:

STATEFILE env stores the volumes, and it is put to /home/pi/phatbeatd.json (as /tmp will be purge every reboot)

Changes:
https://github.com/snakewa/phat-beat/commit/8ca1a386b0c9ffc0a0f44129f65de5d55fd0bb3b
https://github.com/snakewa/phat-beat/commit/063ae1952204ea14a6af32dc913a39ff9daeb937

Source file:
https://raw.githubusercontent.com/snakewa/phat-beat/063ae1952204ea14a6af32dc913a39ff9daeb937/projects/vlc-radio/phatbeatd/usr/bin/phatbeatd

@RogueM @Feek

I’ve just done some testing with the web interface open.

I started my Pirate Radio, the volume was at 50%. I reduced it to 15% (which is a good level for listening in my small quiet radio shack) using the volume control on the web interface and then shut down using the button on the top.

When I restarted, it was back to 50% so I reduced the volume using the buttons on the unit itself, shut it down using the button on the top and restarted. Volume was back to 50%.

This was a new Raspbian build, I installed using the curl command and then yesterday did an update using config.sh

@Feek your description is consistent with the initial behavour… are you sure you used a fresh clone of the repository (or alternatively run through a complete install using the OLI)? if you merely run the setup.sh deposited in ~/Pimoroni/phatbeat then you won’t be getting the changes made last night.

I blatted my SD card yesterday evening and ran the OLI which is when I first posted saying the default volume was at 50%. After that I ran setup.sh

It’s no problem, I’ll start again from scratch in a bit and report back :)

well, you don’t have to start from scratch, you can check your /usr/bin/vlcd… if you can see alsa-gain 0.125 then your file is outdated. You can change that value to whatever works for you.

alternatively make sure to run the vlcradio OLI over the top of your current install… granted there could be a bug, it should work and recall the volume saved on exit when you next boot the radio.

Heh, I’d already started the rebuild.

On first boot, it came up at 40% volume. I reduced that to 15% using the web interface, shut down and restarted and it came back at the same value. Thank you!

40% … ah, could well be, I thought I’d use 35%. But no matter, that is only on a first start, thereafter it will be whatever volume was set when you shutdown the radio.

Either way, glad to hear it works… was about to wipe off my SD and start fresh in case I’d missed a trick. Enjoy!

Is there anyway to change the gain (hope thats the correct audio term!) of the vu meters, so I can have great looking vu meters on a low volume ?

1 Like

Right now, no, but I believe @gadgetoid is planning to add a parameter that can be specified in the asound to scale the VU in different ways.

That would be great - the Pirate Radio needs this, shame to waste the Phat Beat on low volume with no visuals !

Not sure if this is useful to anyone, but I made this script for running with Mopidy. Or presumably any mpd?

Basically binds the controls on start up, and loads a default playlist which can be cycled through.

Theres the beginnings of an abstraction for animating the VU meter, but the concerns are a bit mixed up at the moment.

VU doesn’t work for playback, but I assume this has something to do with the fact that I’m streaming? Certainly unrelated to this script.

1 Like

Keep an eye out on Twitter in the next few days… I believe @sandyjmacdonald is brewing a tutorial for the Spotidy (Mopidy with Iris front-end) script we promised a little while ago!

… as for your issue, have you added the mopidy user (or mpd user?) to the gpio group, @wwqrd ?

Go Look here - I think I got the solution for mpd/c ?
http://forums.pimoroni.com/t/phat-dac-scroll-phat-pivumeter/4257/7

right… but it is worth noting that while Scoll pHAT (and Speaker pHAT) is being driven over I2C, pHAT Beat is driven over a SPI-like interfacing, so the relevant group is gpio, not i2c.

… still the principle is correct, any particular service running under a dedicated user would need ad hoc permissions to take control of the interface used to drive the chip.