Project Guitar and Linux: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
Line 34: Line 34:
  fender_sink="bluez_sink.${fender_mac//:/_}.a2dp_sink"
  fender_sink="bluez_sink.${fender_mac//:/_}.a2dp_sink"
  fender_source="alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51.monitor"
  fender_source="alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51.monitor"
 
  echo -e "power on\nquit" | bluetoothctl
  echo -e "power on\nquit" | bluetoothctl
  while ! echo -e "show\nquit" | bluetoothctl | grep 'Powered: yes'; do  
  while ! echo -e "show\nquit" | bluetoothctl | grep 'Powered: yes'; do  

Revision as of 16:44, 24 February 2022

Guitar and Linux

Chordsplay

Chordsplay is my application to play along my favorite songs with the guitar. It scans a given directory for mp3 files with metadata to search for chords and lyrics of these songs. The list of these songs can be filtered and shuffled to play them while the lyrics and chords are displayed.

Separate Linux and Guitar Amps

Old style: Just play the music with chordsplay over the linux amp and play along with the external amp.

  • External Amp and Guitar can be connected wirelessly
  • No earphones because audio mixing happens in the air ;)

Fender Mustang Micro Amp

  • The small amp is plugged into the guitar
  • Connect the amp via bluetooth to linux audio
    • Chordsplay can send the music to the amp via A2DP protocol
pacat -r --latency-msec=1 -d 'alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51.monitor' | \
pacat -p --latency-msec=1 -d 'bluez_sink.84_17_15_15_F0_20.a2dp_sink'
  • Use headphones plugged into the fender amp to hear mixed chordsplay and guitar
  • USB-C out of the amp can be connected to linux for using the linux amp and for recording, e.g. with audacity
    • use pacat to do the connections
pacat -r --latency-msec=1 -d 'alsa_input.usb-FMIC_Fender_Mustang_Micro_396234823131-00.iec958-stereo' | \
pacat -p --latency-msec=1 -d 'alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51'

Unfortunately it is not possible to use normal bluetooth headphones or earpods in this scenario. They have a too long delay. Maybe aptx-ll would be a solution for playing completely wireless?

Script to connect the Fender Mustang Micro to Job4 monitor

Bluetooth is such a pita...

fender_mac='84:17:15:15:F0:20'
fender_sink="bluez_sink.${fender_mac//:/_}.a2dp_sink"
fender_source="alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51.monitor"

echo -e "power on\nquit" | bluetoothctl
while ! echo -e "show\nquit" | bluetoothctl | grep 'Powered: yes'; do 
	echo "wait for power on"
	sleep 1
done 

echo -e "connect $fender_mac\nquit" | bluetoothctl
try=0
while ! pactl list sinks short | fgrep "$fender_sink"; do 
	echo "wait for $fender_sink" 
	try=$((try+1)) 
	if [ $try -gt 5 ]; then 
		echo -e "connect $fender_mac\nquit" | bluetoothctl
		echo "restart device?" 
	fi
	sleep 1; 
done

echo "connect $fender_source to $fender_sink. Ctrl-C to end"
pacat -r --latency-msec=1 -d "alsa_output.usb-0ccd_USB_Audio-00.analog-surround-51.monitor" | \
pacat -p --latency-msec=1 -d "${fender_sink}"