Moode Forum
volume control by USB keyboard or volume knob - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8)
+--- Thread: volume control by USB keyboard or volume knob (/showthread.php?tid=2154)

Pages: 1 2 3


volume control by USB keyboard or volume knob - mtnbrit - 02-05-2020

Is there a way to control moOde's volume by using standard USB keyboard volume up/down and mute buttons? I am wanting to use one of those DROK USB volume controls that simply emulate the standard keyboard volume and mute keys. USB keyboard/knob plugged in to USB on the rPi.


RE: volume control by USB keyboard or volume knob - mtnbrit - 02-06-2020

Heres the knob im hoping to use on moOde, works very nicely on my Mac.

USB Volume Control, DROK PC Computer Speaker Audio Volume Remote Controller Knob with One Key Mute Function Support Win7 8 10 XP Mac Vista Android
by DROK
Learn more: https://www.amazon.com/dp/B01MV411BR


RE: volume control by USB keyboard or volume knob - normand - 02-06-2020

(02-06-2020, 06:48 PM)mtnbrit Wrote: Heres the knob im hoping to use on moOde, works very nicely on my Mac.

USB Volume Control, DROK PC Computer Speaker Audio Volume Remote Controller Knob with One Key Mute Function Support Win7 8 10 XP Mac Vista Android
by DROK
Learn more: https://www.amazon.com/dp/B01MV411BR

Didn't know something like that existed, I want one if it works!


RE: volume control by USB keyboard or volume knob - mtnbrit - 02-08-2020

So I figured out a quick and dirty solution that works for me.


Code:
sudo apt-get install triggerhappy

$vi /etc/triggerhappy/triggers.d/media.conf
KEY_VOLUMEUP     1 /usr/bin/mpc volume +1
KEY_VOLUMEDOWN   1 /usr/bin/mpc volume -1
KEY_MUTE         1 /usr/bin/mpc toggle

/etc/init.d/triggerhappy restart
Caveats:
1. Mute (knob press) actually pauses and un-pauses the player, which is arguably more useful. Also mpc doesnt include a simple way to toggle mute and un-mute, so it would need some script fu to save the volume setting and state around mute/unmute presses.
2. Volume changes aren't reflected on the web GUI. Would love to know if there is a shell command that can change volume and mute/un-mute mpd while correctly updating the GUI?


RE: volume control by USB keyboard or volume knob - DRONE7 - 02-08-2020

(02-08-2020, 07:29 AM)mtnbrit Wrote: So I figured out a quick and dirty solution that works for me.


Code:
sudo apt-get install triggerhappy

$vi /etc/triggerhappy/triggers.d/media.conf
KEY_VOLUMEUP     1 /usr/bin/mpc volume +1
KEY_VOLUMEDOWN   1 /usr/bin/mpc volume -1
KEY_MUTE         1 /usr/bin/mpc toggle

/etc/init.d/triggerhappy restart
Caveats:
1. Mute (knob press) actually pauses and un-pauses the player, which is arguably more useful. Also mpc doesnt include a simple way to toggle mute and un-mute, so it would need some script fu to save the volume setting and state around mute/unmute presses.
2. Volume changes aren't reflected on the web GUI. Would love to know if there is a shell command that can change volume and mute/un-mute mpd while correctly updating the GUI?

check out Kent's post...
http://moodeaudio.org/forum/showthread.php?tid=1499&pid=11427#pid11427


RE: volume control by USB keyboard or volume knob - mtnbrit - 02-08-2020

Yep thanks, I just found it also. Its a beautiful thing! its now fully working.


Code:
KEY_VOLUMEUP     1 /var/www/vol.sh -up 1
KEY_VOLUMEDOWN   1 /var/www/vol.sh -dn 1
KEY_MUTE         1 /var/www/vol.sh -mute



RE: volume control by USB keyboard or volume knob - DRONE7 - 02-08-2020

Smile excellent !
I'm sure others will be very interested in this !


RE: volume control by USB keyboard or volume knob - Tim Curtis - 02-08-2020

That's pretty cool and a lot easier than installing a rotary encoder. I think I'll attach one to my SIG :-)


RE: volume control by USB keyboard or volume knob - Tim Curtis - 02-08-2020

(02-08-2020, 08:03 AM)mtnbrit Wrote: Yep thanks, I just found it also. Its a beautiful thing! its now fully working.


Code:
KEY_VOLUMEUP     1 /var/www/vol.sh -up 1
KEY_VOLUMEDOWN   1 /var/www/vol.sh -dn 1
KEY_MUTE         1 /var/www/vol.sh -mute

Whats the resource utilization look like for triggerhappy?

Maybe run moodeutl -m or top or htop.


RE: volume control by USB keyboard or volume knob - mtnbrit - 02-08-2020

No noticeable impact from running triggerhappy, the thd process doesnt even appear in top or htop.


CU: 1.4 GHz | LOAD: 3% | TEMP: 54?C | RAM_USED: 22% | DISK_USED: 79% | DISK_FREE: 686M | FPM_POOL: 8 workers 

this is on a 3B+