earphones are single buttoned. Apparently, some of those simple earphone buttons use a kind of mic signaling mechanism that checks if mic input is "high" (see this post and this post). Using audacity, I was able to verify that clicking the button generated a characterstic peak unachievable by speech (although I haven’t tried screaming!). Looking around the internet, I came up with the following solution using sox’s rec: xorg - Earphone remote in sound jack as X input - Unix & Linux Stack Exchange #!/usr/bin/sh while true; do rec -n stat trim 0 .5 2>&1 | awk '/^Maximum amplitude/ && $3 > 0.89' | grep -q 'M' && play done 6
Bullseye が2.3.1 なので動くはず? sid の2.4.1 でもmpv が見えない → Version の問題ではなさそう altdesktop/playerctl: 🎧 mpris media player command- line controller for vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify and others. playerctl (2.3.1-1) unstable; urgency=medium : - Add mpv to list of controllable players 9
For players supporting the MPRIS D-Bus specification Help Options: -h, --help Show help options Application Options: -p, --player=NAME A comma separated list of names of players to control (defaul -a, --all-players Select all available players to be controlled -i, --ignore-player=IGNORE A comma separated list of names of players to ignore. -f, --format A format string for printing properties and metadata -F, --follow Block and append the query to output when it changes for the m -l, --list-all List the names of running players that can be controlled -s, --no-messages Suppress diagnostic messages -v, --version Print version information Available Commands: play Command the player to play pause Command the player to pause play-pause Command the player to toggle between play/pause stop Command the player to stop next Command the player to skip to the next track previous Command the player to skip to the previous track position [OFFSET][+/-] Command the player to go to the position or seek forward/backward OF volume [LEVEL][+/-] Print or set the volume to LEVEL from 0.0 to 1.0 status Get the play status of the player metadata [KEY...] Print metadata information for the current track. If KEY is passed, print only those values. KEY may be artist,title, album, or any key open [URI] Command for the player to open given URI. URI can be either file path or remote URL. loop [STATUS] Print or set the loop status. 16