Sound in Linux
I recently bought a Focusrite Scarlett 2i4 to do some audio recording. I decided to buy it because its support for USB Audio. It works on Linux, however there I encountered some initial hiccups.
- Scarlett 2i4 only shows up as an input device: Initially, the device would only appear as having two input channels but no output channels. Although I did not figure out the cause of this problem it went away after attaching it several times. Also starting Audacity helped, but that might be coincidence.
- I can record fine using JACK using the following settings: 48kHz, 512 buffer size, 2 buffers. Any smaller buffer value crashes JACK at starting, higher sampling rates cause xruns.
For recording purposes it is better to use JACK than the default PulseAudio server. JACK provides much lower latency than the latter, although it is still not very fast. The problem with running JACK and PulseAudio at the same time is that PulseAudio automatically claims all ALSA sound interfaces and due to this JACK cannot start. There are two things that need to be done in order to let them peacefully coexist.
- Install JACK support for PulseAudio. In Debian there is a package called
pulseaudio-module-jackthat allows to send PulseAudio streams via the interface claimed by JACK. PulseAudio is configured to load these modules when available, so no further configuration is necessary.
qjackctlto configure the server. Set the interface to your desired interface. It will be claimed and not available to any other sound server anymore.
- To start JACK while PulseAudio is running, use the
pasuspendertool. It halts PulseAudio for the duration of the command running and resumes afterwards. JACK provides a startup command
jack_control startto start the server. Combining the two yields:
pasuspender jack_control start