[Plugin] pirate audio

Hi pirate audio users,

as i have a pirate audio dac hat i wanted to use the display and the 4 buttons, so i wrote a plugin which i would like to share with the community (see plugin section in your volumio gui).

I did further development to add more useful features to the pirate audio plugin, so i released v 0.0.3 (thanks to @balbuze for merging PR):

new features:

  • GPIO PIN of Y Button is now configurable via GUI (as there are different mappings on different pirate audio hats and revisions)
  • longpress on buttons, so you can press and hold volume + to get it louder until you release the button, depending on mode (works for volume +/-, navigate entry up/down)

improved:

  • play functionality after navigating through your musiclibrary via pirateaudio hat
  • display function
  • less entries in userconfig.txt (as they are needed anymore)
  • updated install.sh
  • added translations

Regards

AxLED

1 Like

Thanks a lot for your work !
I installed the plugin yesterday, works really well for me.
I don’t know if this is the right place for it, but here is my list of improvements:

  • I would prefer the B and Y button to be “backward” and “forward”, rather than “Volume” especially using Spotify.
  • I cannot choose a radio station from “my radiostations” using the pirate buttons (says it is “not supported”), would be really cool, if that worked.
    Anyway, thanks again for your work, much appreciated !

@lemmy668

thanks for feedback, to your radio issue:
I guess you mean selection of “Web Radio -> My Web Radios”.

I have to fix this with next release, in the meantime you can fix it yourself by editing
display.py in path /data/plugins/miscellanea/pirateaudio:

  • line 364: replace if nav_array_type[marker] == 'song' or nav_array_type[marker] == 'webradio': by if nav_array_type[marker] == 'song' or nav_array_type[marker] == 'webradio' or nav_array_type[marker] == 'mywebradio':

then it should work.
To your wishes: I dont’t think i implement it because I think volume is more important for most users. Have you ever thought of using a rotary encoder or other gpio buttons for your prev/next feature?

AxLED

1 Like

Nice one, AxLED!
I applied your fix and now it works perfectly!
Cheers!
One more thing, though.
I’m running the pirate audio hat on a raspi 3a.
I am having problems when I try to trigger a button only once, the “timeout” until the service treats the “button-hold” as a second key press is too low.
Maybe this is because it runs on a 3A, so a bit faster than on a Zero or so.
Long story short, is there a parameter, which I could play with to get a “longer” timeout?

Hi AxLED,

don’t worry about my previous comment, I figured it out.
I added a few “time.sleep” in the right places and now it works fine for me.
Thanks!

@lemmy668,

good to hear you helped yourself.

AxLED

@makearne

what software do you mean with “original software”?
MPD for pirate audio dac https://github.com/pimoroni/pirate-audio ?
AxLED

For the volume setting I know it says to set as software, but does the headphone HAT not have a hardware volume mixer?

@SirNut
I dont know, as i have the pirate audio amp hat.
If it is not working with setting “software” on your dac, you have to try out if setting it to “hardware” works.

AxLED

Hi AxLED

Thanks for this great plugin. I’m using it on an Pirate Audio DAC using a Pi Zero W, and find it a bit annoying that the micro USB connector for the Pi comes in to the bottom side. I’ve modified your script a little to include the option to rotate the display 180 degrees, so that it works upside down (with buttons rotated etc). This way I can have the pi sitting on my desk without the USB power stopping it sitting flat. I thought I’d share what I’ve done (I can’t get indents after if statements to come through in this forum, but I’m sure you know where they’re needed!).
config.json:
Added a new boolean config value rotate - I’ve set it to true, but I guess you’d want it false by default.
display.py:
Moved the LCD display initialisation after the json files are read in, and added this after the json read:
rotate = 90
if obj['rotate']['value'] == True:
rotate = 270
changed the first line of the LCD display class creation:
rotation = rotate, # Needed to display the right way up on Pirate Audio
After the declaration of the BUTTONS and LABELS variables:
if rotate == 270:
BUTTONS.reverse()
LABELS.reverse()
In handle_buttons(pin) function, replaced the hard coded reference to button pin numbers in the lines “if pin == 5” etc with “if pin == BUTTONS[0]” and so on with BUTTONS[1], BUTTONS[2] (you already use BUTTONS[3] for the Y button).
This works fine for me and I think it enhances the options for your plugin!

1 Like

@arckuk,

good to hear you like the plugin. I did some more improvements and features and will release a update soon.
So stayed tuned.

AxLED

2 Likes

@AxLED
Thank you very much for your efforts; I got the 3W AMP version running with your default settings.
When I shutdown volumio (either via the buttons or iOS app) the screen stays on. Is this expected behavior in the current version or did I do something wrong?

Does anyone know if it would be possible with the existing pirate audio buttons to wake up the device again or does it always require a power cycle?

this comment is in reply to the “feature request” of @lemmy668:

  • I would prefer the B and Y button to be “backward” and “forward”, rather than “Volume” especially using Spotify.

I completely agree that the volume up and down make sense by default but not always. I’ve got a line-out version of the board on the way which I intend to integrate in a “old” amplified portable speaker (Harman Kardon Go+Play) where I want it to replace the 30 pin apple connector. That box already has a pretty capable amp with both buttons and remote for volume control. In such a setup it would make sense to have the option to assign different functionality to the buttons (like the forward backward that @lemmy668 suggests).

1 Like

@MIJBYC,

good to hear you like it. If you power your pi the display backlight goes on for a second, until gpio settings of boot/config.txt override. If you shutdown the backlight of the display goes off until completely shut down. After shutdown the backlight switches on because the boot/config override dont work anymore after shutdown. As i have a portable volumio with adafruit powerboost it cuts power a few seconds after shutdown.

AxLED

Hi to all “pirates” (pirate audio users),

i did further development to add more useful features to the pirate audio plugin v0.0.4:

new features:

  • added support for spotify plugin
  • added display remaining time of audiotrack
  • added seeking feature +/- 60 seconds
  • added prev/next song feature
  • addes sleep timer feature (time is configurable via volumio GUI) incl. switching display backlight off if selected (backlignht will be reactivated by pressing X button (upper right))

improved:

  • blur filter on background image and shadow text for better readability
  • cleaned some display dialogs by removing and adding some icons
  • text alignment, only short text will be centered
  • some code changes and cleaning
  • changed some code sequences to display something on boot earlier than before
  • GPIO cleanup at disabling or exiting plugin
  • fix for radio by genre

Thanks to @balbuze and volumio team for the fast merging of my pull request.

Regards

AxLED

4 Likes

Great work, thank you @AxLED and all that helped!

I have one question: wich DAC should I choose from the drop-down list in “DAC Model”?

TIA

Hifiberry DAC works for pirate audio dacs

1 Like

Thank you for your great plugin, it is fantastic!

How can I use this feature as I cannot find anything in settings. Is possible the display to turn off after some minutes (or by pressing some key) and reactivate when an action happen (pressing key)?

@antonio1206
Display backlight off will be activared by the sleeptimer and resumes by pressing the upper right button. There is no separate menu or timer, just for display backlight.

AxLED

1 Like

I wanted to say thank you too! Especially for the fast update!
Thanks a lot!

1 Like