02-Nov-2020, 11:23 AM
As per https://www.snakeoil-os.net/forums/Threa...ctionality I have spent way too much time on getting IR blaster working on snakeoil with the squeezelite client and LMS server (v7.9.3). The IR_Blaster LMS plugin for hardware players (via the headphone jack) locks the player volume @100% and any player volume adjustments are blasted to my amp. Works perfectly and is what I was trying to emulate.
Unfortunately while I eventually got it all working, the result was a little underwhelming for me. My plan was to use LIRCD for the IR blasting side and the script from https://github.com/mundschenk-at/squeeze...s/tag/v0.2 to handle the triggering side. See also https://forums.slimdevices.com/showthrea...box-events.
Below are the steps that I used to get this working in case someone else wants to do this.
LIRCD - many hours of playing around I finally got a working config. What I found.
- I purchased a blaster from https://www.jaycar.com.au/single-ir-emit...4/p/AR1811 but in the end was not needed. My old DIY one consisting of an IR emitter wired to a 3.5mm audio plug worked also.
- in lirc_options.conf, I just needed to change the driver to "audio". The detected devices was listed in the syslog after starting it and you could set the device in the lirc_options.conf or as an option in the command. Mine was "ALSA:HDA Intel PCH: ALC283 Analog (hw:0,0)" but "sudo lircd -d ALSA:default@48000" seemed to work just fine as well.
- lirc has a list of remote definitions http://lirc-remotes.sourceforge.net/remotes-table.html - edit something to suit if your remote is not in the list.
- my irsend command to testing has a lot of false negatives - I eventually discovered that it needed multiple pulses to work. My final command was "usr/sbin/irsend -# 3 SEND_ONCE amp AMP_VOL_DOWN" - the #3 gives 3 x repeats.
Next step was the script... which needed micropython to be installed. To save a lot of heartache, dont follow the instructions in the README file, use the wiki instead https://github.com/micropython/micropyth...ng-Started. There were lots of dependencies...
sudo apt install make
sudo apt install build-essential
sudo apt install libffi-dev
sudo apt install pkg-config
sudo apt-get install libreadline-dev
sudo apt-get install gcc-arm-none-eabi
sudo apt-get install libnewlib-arm-none-eabi
Finally install;
git clone --recurse-submodules https://github.com/micropython/micropython.git
then follow up with some makes..
cd ~micropython/mpy-cross
make
cd ~micropython/ports/unix
make
'sudo chmod +x sb-ir-events.py' to make the script executable.
DONE.
Edit/create the json.config as per the example - LMS IP, port, commands and player name (optional). Use your irsend commands in the json for the events. Dont be tempted to remove any events (eg. power off) as the json file wont load. Set the command field to be empty if you dont want to use one.
This IR daemon supports power on/off and volume up/down events. If you want to do volume, you need to install the LMS plugin VolumeLock, which was well hidden in the discussion thread....if you dont install this plugin detecting volume events will not work.
You also need to set the Volume Control within the LMS audio settings of the player to 'volume controls adjust outputs' then execute with something like (I installed the deamon to /opt which may or may not be following protocol).
./micropython /opt/squeezebox-ir-events-0.2/sb-ir-events.py /opt/squeezebox-ir-events-0.2/config.json MyPlayer.
Detected events will appear on the console - I only ever ran it as a command.
Result. While I did eventually get it all working, the result was a little underwhelming for me. Power on/off appeared to work fine but I was only really interested in the volume.
I tested using both the LMS Web GUI and iPeng on my phone.
- It didnt like quick button presses as it sometimes got messed up
- there were some inconsistencies in detecting events, possibly related to above.
- there was sometimes audio interference with the squeezelite player which made it sound awful.
- There are interaction challenges with the VolumeLock plugin. The plugin gives you 3 options -
1. Allow full range of volume control - it adjusts the volume on both the players output and you blast your amp as the same time via the script. Inconsistent in practice
2. Lock player at current volume - worked ok but it was limited as to how much you could increase & decrease the volume. I guess you could play around and get optimum levels of both player and amp but messy
3. Set current vol as max. - combination of the above
Out of curiosity, I did some quick tests using a Duet as the primary player. On the whole this appeared to work much better and I never had any audio issues - limited testing because this is not where I wanted the blasting.
No listening tests outside of the obvious were done.
After all that I am still deciding whether to persist or more likely revert. This adds complexity with stability questions for my use case, with debatable gains. If only you could fix the player output at 100% and still get volume controls as in IR-Blaster plugin.
There is a potential alternative to the ir-events-deamon - see https://www.nexus0.net/pub/sw/lmseventtrigger/ Much simpler to install. The question is whether it can detect volume events (looks like it might - mixer/volume ??) and how the volume adjustments are treated. You may end up in the same situation.
Think that I will also look more closely at replacing the caps in my old SB3.
I will update this thread if there are any advancements.
Hope that someone finds this useful.
Unfortunately while I eventually got it all working, the result was a little underwhelming for me. My plan was to use LIRCD for the IR blasting side and the script from https://github.com/mundschenk-at/squeeze...s/tag/v0.2 to handle the triggering side. See also https://forums.slimdevices.com/showthrea...box-events.
Below are the steps that I used to get this working in case someone else wants to do this.
LIRCD - many hours of playing around I finally got a working config. What I found.
- I purchased a blaster from https://www.jaycar.com.au/single-ir-emit...4/p/AR1811 but in the end was not needed. My old DIY one consisting of an IR emitter wired to a 3.5mm audio plug worked also.
- in lirc_options.conf, I just needed to change the driver to "audio". The detected devices was listed in the syslog after starting it and you could set the device in the lirc_options.conf or as an option in the command. Mine was "ALSA:HDA Intel PCH: ALC283 Analog (hw:0,0)" but "sudo lircd -d ALSA:default@48000" seemed to work just fine as well.
- lirc has a list of remote definitions http://lirc-remotes.sourceforge.net/remotes-table.html - edit something to suit if your remote is not in the list.
- my irsend command to testing has a lot of false negatives - I eventually discovered that it needed multiple pulses to work. My final command was "usr/sbin/irsend -# 3 SEND_ONCE amp AMP_VOL_DOWN" - the #3 gives 3 x repeats.
Next step was the script... which needed micropython to be installed. To save a lot of heartache, dont follow the instructions in the README file, use the wiki instead https://github.com/micropython/micropyth...ng-Started. There were lots of dependencies...
sudo apt install make
sudo apt install build-essential
sudo apt install libffi-dev
sudo apt install pkg-config
sudo apt-get install libreadline-dev
sudo apt-get install gcc-arm-none-eabi
sudo apt-get install libnewlib-arm-none-eabi
Finally install;
git clone --recurse-submodules https://github.com/micropython/micropython.git
then follow up with some makes..
cd ~micropython/mpy-cross
make
cd ~micropython/ports/unix
make
'sudo chmod +x sb-ir-events.py' to make the script executable.
DONE.
Edit/create the json.config as per the example - LMS IP, port, commands and player name (optional). Use your irsend commands in the json for the events. Dont be tempted to remove any events (eg. power off) as the json file wont load. Set the command field to be empty if you dont want to use one.
This IR daemon supports power on/off and volume up/down events. If you want to do volume, you need to install the LMS plugin VolumeLock, which was well hidden in the discussion thread....if you dont install this plugin detecting volume events will not work.
You also need to set the Volume Control within the LMS audio settings of the player to 'volume controls adjust outputs' then execute with something like (I installed the deamon to /opt which may or may not be following protocol).
./micropython /opt/squeezebox-ir-events-0.2/sb-ir-events.py /opt/squeezebox-ir-events-0.2/config.json MyPlayer.
Detected events will appear on the console - I only ever ran it as a command.
Result. While I did eventually get it all working, the result was a little underwhelming for me. Power on/off appeared to work fine but I was only really interested in the volume.
I tested using both the LMS Web GUI and iPeng on my phone.
- It didnt like quick button presses as it sometimes got messed up
- there were some inconsistencies in detecting events, possibly related to above.
- there was sometimes audio interference with the squeezelite player which made it sound awful.
- There are interaction challenges with the VolumeLock plugin. The plugin gives you 3 options -
1. Allow full range of volume control - it adjusts the volume on both the players output and you blast your amp as the same time via the script. Inconsistent in practice
2. Lock player at current volume - worked ok but it was limited as to how much you could increase & decrease the volume. I guess you could play around and get optimum levels of both player and amp but messy
3. Set current vol as max. - combination of the above
Out of curiosity, I did some quick tests using a Duet as the primary player. On the whole this appeared to work much better and I never had any audio issues - limited testing because this is not where I wanted the blasting.
No listening tests outside of the obvious were done.
After all that I am still deciding whether to persist or more likely revert. This adds complexity with stability questions for my use case, with debatable gains. If only you could fix the player output at 100% and still get volume controls as in IR-Blaster plugin.
There is a potential alternative to the ir-events-deamon - see https://www.nexus0.net/pub/sw/lmseventtrigger/ Much simpler to install. The question is whether it can detect volume events (looks like it might - mixer/volume ??) and how the volume adjustments are treated. You may end up in the same situation.
Think that I will also look more closely at replacing the caps in my old SB3.
I will update this thread if there are any advancements.
Hope that someone finds this useful.