Skip to main content

How to mix live music with your Linux laptop

If you've checked out Mixxx before, but decided it wasn't ready to replace an analogue setup, it's well worth looking again at the recent 1.6.0 release. Apart from a whole bunch of new features including native FLAC file support, which is really useful if you care about sound quality, this release contains a patch for real-time ALSA performance.

Combined with a real-time kernel, as found in any good multimedia Linux distro, this feature enables Mixxx to have responsiveness in the low millisecond range, depending on your soundcard and overall system performance.

On our generic HP laptop with a cheap AC97 sound chip on board, we can run Mixxx 1.6.0 reliably with around 16ms latency using the ALSA outputs but 8ms is no problem when connecting via the Jack sound server. However, DJs need a stereo headphone cue output as well as a main stereo output, and Jack can only run on one audio interface at a time. So if you lack an audio interface with four channels or more, you're better off using ALSA mode with a pair of USB headphones as the cue output device.

The kind of USB headphones sold for VoIP and gaming use will do the job, as long as they go loud enough, although specialised USB headphones for DJs are starting to become available.

Getting and building

Mixxx At the time of writing, the only binary package for Mixxx 1.6.0 offered on the project's website is for 32-bit Ubuntu. If your distro of choice does not include an up-to-date Mixxx binary, or it was not built with your preferred options, it's easy enough to build Mixxx from source. Download the source tarball from www.mixxx.org/download.php and unpack the archive. For example:
$ mkdir /mixxx-source
$ cd /mixxx-source
$ wget http://downloads.mixxx.org/mixxx-1.6.0/mixxx- 1.6.0-src.tar.gz
$ tar -xvzf mixxx-1.6.0-src.tar.gz

The Mixxx wiki contains documentation on compilation options. If you're using a Debian or Ubuntu-based distro, you can obtain most of the required libraries and development packages with:
$ sudo apt-get install build-essential
$ sudo apt-get build-dep mixxx

Note that you'll need a source code repository enabled in your APT configuration for the build dependencies to be downloaded. By default, most distros only enable the binary repositories; so if you get an error message about that, you know where to look.

Mixxx is built with the Scons utility, which probably isn't installed on your distro by default. We're also going to check out a fresh copy of the PortAudio library using Subversion. We need a few more development packages too, for Qt 4, Jack and control-surface support:
$ sudo apt-get install scons subversion
$ sudo apt-get install libqt4-dev libjack-dev libdjconsole-dev

Next, we're going to build our up-to-date PortAudio library, which is well worth getting, because it's the library that handles all of the audio I/O in Mixxx:
$ mkdir /portaudio-svn
$ cd /portaudio-svn
$ svn co https://www.portaudio.com/repos/portaudio/trunk
$ cd trunk
$ ./configure
$ make
$ sudo make install

If you don't often compile libraries from source, don't forget to tell the system where it can find new local libraries. Edit the file /etc/ ld.so.conf and add the line:
include /usr/local/lib

In any case, run:
$ sudo ldconfig

so that ld, the dynamic library linker, knows about the new PortAudio library you just compiled. After all that, we're ready to compile Mixxx itself:
$ cd /mixxx-source
$ sudo scons prefix=/usr install

If your distro features GCC 4.2 or later, add tuned=1 to the Scons options, and the binary will be built with optimisations for your CPU. To optimise the binary for the CPU on another machine, for example when building packages on a server, use the following:
optimize=1 for single-core Pentium III and older machines.
optimize=2 for the Pentium 4.
optimize=3 for Intel Core CPUs.
optimize=4 for Core 2 machines.