Project Guitar and Linux

From JoBaPedia
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Guitar and Linux

see also Trac Wiki

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.

Install

optionally create virtual environment for it (hint; conda doesn't work because it lacks proper font support)

python -m venv chordsplay
. chordsplay/bin/activate

install with dependencies

pip install https://github.com/joba-1/ChordsPlay

Hi Res

Solution for adapting font size to high dpi displays: abandoning conda and use native python and pip. With conda fonts look very small and thin (especially the song list) because it doesn't include necessary compile options for smooth fonts

Performance

Try these after connect to the sqlite database

pragma journal_mode = WAL;
pragma synchronous = normal;
pragma temp_store = memory;
pragma mmap_size = 30000000000;

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 linux notebook or pc can connect to the Mustang Micro amp via bluetooth with normal gnome interface. Chordsplay can send the music and the micro amp mixes in the optionally distorted guitar and sends it to headphone or usb-c outputs.

Setup for PC Effects

I use "plug" for physically pluggin in and "connect" to virtually connect audio streams with ardour or qpwgraph or similar

  • Plug guitar in one channel of an USB audio interface
  • Plug one output of the USB audio device into the guitar amp
  • Start Ardour
    • create an audio track and connect input from the USB audio guitar input channel and output to master
    • add ardour plugin audio effects like distortion, etc as desired
    • connect master output to USB audio guitar amp output

Setup for Online Play with Jamulus, Mic and Headphones

some details need testing

  • Plug guitar in one channel of an USB audio interface and mic in the other
  • Start Ardour
    • create two audio tracks and connect input from the USB audio guitar and mic input channels and outputs to master
    • add ardour plugin audio effects like distortion, reverb etc. as desired
    • start Jamulus service and gui, connect guis of all players with the service
    • connect ardour master outputs to jamulus inputs
  • connect other audio inputs like backing track vlc for everyone to jamulus inputs as well (or use ardour for mixing)
  • connect jamulus outputs to headphone amp inputs (maybe using USB audio output and plug in headphones there also works)

Using Pulse Audio

The following items are pre pipewire stuff, basically no longer needed:

  • 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 "$fender_source" | \
pacat -p --latency-msec=1 -d "$fender_sink"