How to set up JACK Audio

sudo apt-get install qjackctl pulseaudio-module-jack
enable realtime process priority? yes
sudo usermod -aG audio $USER
optional: sudo apt-get install linux-lowlatency
Note: sometimes jackdbus will freeze, requiring a kill -9 to fix it

fun things:

how to use the blue microphones usb webcam/microphone (no latency):
zita-a2j -d hw:2,0

hmm... how to solve acoustic feedback? get a directional microphone!

--- record screen ---
#!/bin/bash -ex

# Whole screen
#export TOPLEFT=0,0
#export VIDEO_SIZE=$(xwininfo -root | grep geometry | awk '{print $2;}' | awk -F "+" '{print $1;}')

# Partial screen
export TOPLEFT=65,645
export VIDEO_SIZE=662x378

ffmpeg -video_size ${VIDEO_SIZE} -framerate 24 -f x11grab -thread_queue_size 512 -i ${DISPLAY}.0+${TOPLEFT} -f pulse -ac 2 -thread_queue_size 512 -i jack_out.monitor -threads 0 output.mkv

# lossless
# ffmpeg -video_size ${VIDEO_SIZE} -framerate 24 -f x11grab -thread_queue_size 512 -i ${DISPLAY}.0+${TOPLEFT} -f pulse -ac 2 -thread_queue_size 512 -i jack_out.monitor -threads 0 -qscale 0 -vcodec huffyuv grab.avi

--- mp3 encode ---
Depends on "Jack sink (PulseAudio JACK Sink)" volume, which is controlled with the volume buttons.
Can still control speaker volume with "Speakers - Built-in Audio" - yes.
ffmpeg -f pulse -ac 2 -i jack_out.monitor -codec:a libmp3lame -qscale:a 2 output.mp3