WRT recording the audio to file you could do something like this.
First and foremost install jack_capture and run JACK and Overwitch as stated above.
Then, let’s see all the JACK ports and how they are connected. My audio interface is a Soundcraft Signature MTK12 (14 inputs and 12 outputs). For the sake of brevity I’ll omit some ports.
$ jack_lsp -c
[...]
system:playback_11
system:playback_12
Digitakt:Main L
Digitakt:Main R
Digitakt:Track 1
Digitakt:Track 2
[...]
Digitakt:Track 7
Digitakt:Track 8
Digitakt:Input L
Digitakt:Input R
Digitakt:Main L Input
Digitakt:Main R Input
[...]
From here, let’s monitor something. I’ll connect the main output to the stereo pair I’m monitoring thru my headphones.
$ jack_connect "Digitakt:Main L" system:playback_11
$ jack_connect "Digitakt:Main R" system:playback_12
And let’s run jack_lsp -c again. We’ll see the connections.
$ jack_lsp -c
[...]
system:playback_11
Digitakt:Main L
system:playback_12
Digitakt:Main R
Digitakt:Main L
system:playback_11
Digitakt:Main R
system:playback_12
Digitakt:Track 1
Digitakt:Track 2
[...]
Digitakt:Track 7
Digitakt:Track 8
Digitakt:Input L
Digitakt:Input R
Digitakt:Main L Input
Digitakt:Main R Input
[...]
Now, let’s just record what we want. For instance, the 8 mono tracks.
$ chrt -f 35 jack_capture -b 16 -c 8 -p "Digitakt:Track 1" -p "Digitakt:Track 2" -p "Digitakt:Track 3" -p "Digitakt:Track 4" -p "Digitakt:Track 5" -p "Digitakt:Track 6" -p "Digitakt:Track 7" -p "Digitakt:Track 8" foo.wav
>>> Warning. Could not set higher priority for a SCHED_OTHER process using setpriority().
>>> Recording to "foo.wav". Press <Return> or <Ctrl-C> to stop.
>>> Please wait while writing all data to disk. (shouldn't take long)
|"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""|
00:|----------- * |
01:|------------- * |
02:|--------------------------- * |
03:| |
04:|------- * |
05:|--------- * |
06:| |
07:| |
Buffer: 4.01s./4.01s Time: 0.28m. DHP: [ ] Overruns: 0 Xruns: 0
Finished.
And there it is. An 8 channel WAVE file directly streamed to disk while monitoring the device mix.
$ sox --i foo.wav
Input File : 'foo.wav'
Channels : 8
Sample Rate : 48000
Precision : 16-bit
Duration : 00:00:28.08 = 1347712 samples ~ 2105.8 CDDA sectors
File Size : 21.6M
Bit Rate : 6.14M
Sample Encoding: 16-bit Signed Integer PCM
By the way, these are the reported latencies. No Xruns.
$ chrt -f 35 overwitch -q 2 -d Digitakt -b 8
Device: Digitakt (outputs: 12, inputs: 2)
JACK sample rate: 48000
JACK buffer size: 64
^CMax. latencies (ms): 3.5, 3.4
Edit: I forgot to mention that I’ve fixed the bug in the device selection.