Ask any DJ about the industry-standard tools of the trade, and it's still a pair of the Matsushita Electric Industrial Company's high-end hi-fi turntables from the early 70s, repurposed as club decks in the disco era and known to all as the Technics SL-1200s or 1210s.

Vinyl offers hands-on control, and because the traditional setup is all analogue, there are no latency problems or pesky software glitches to contend with.

The downside of vinyl is that there's a lot of new music that isn't being released in the format, and unless you owned your own cutting lathe it was never convenient or particularly cost-effective to make one-off remixes on acetate, known as dub plates.

Vinyl is easily damaged, having no error correction built in, and even if it's well looked after, the soft plastic wears eventually under the pressure of the stylus. To top all of that, unless you live in one of the UK's larger towns or cities, you probably don't have access to a decent record shop any more.

In the digital music era, there have been several attempts to snatch the SL-1200's crown, including DJ-oriented CD players, and hybrid embedded systems offering playback of material imported from CDs or flash memory cards.

Windows-based DJ software has a more chequered reputation, partly because a general-purpose operating system is not really what you need for real-time responsiveness, and partly because of all the headaches that come with depending on proprietary software.

You really don't want to be reaching fever pitch on a club stage when a message pops up inviting you to download an update to Windows Media Player, while some mysterious disk thrashing begins in the background. And of course Digital Rights Management is a complete non-starter for DJs, who need to be able to do exactly what they want with the music they purchase, including remix and re-release it.

A question of control

A further limitation of computer-based DJing is that laptops and PCs, being descended from the Victorian typewriter, don't have the same physical controls as the vinyl-based setup. Apart from the hands-on aspect of the vinyl itself, there are the mixer faders and knobs to take into consideration.

One of the first attempts to solve this problem was N2IT's Final Scratch, in which special vinyl with proprietary time-code on it was played into a USB device attached to a laptop. To the DJ, it was meant to feel exactly like playing records, but the actual audio came from files stored on the laptop's hard drive.

Final Scratch was originally developed on BeOS, but by the time it was released under the Stanton brand name, the laptop was running a custom version of Debian. Later, this software was ported to OS X and Windows XP, with mixed results.

Despite legal battles over software patents, a number of me-too products appeared, each featuring incompatible vinyl time-code and hardware. The main drawback to this system is that if you don't already own a pair of turntables and a mixer, proprietary time-coded vinyl or special hardware aren't going to help much.

An alternative approach is to remove the need for traditional analogue equipment by providing a dedicated control surface; essentially a dumb set of faders, knobs and jog wheels. This connects to the host computer via USB, and while it's not exactly the same experience as using vinyl, it does mean less equipment to carry around. These control surfaces are generally supported by one or more proprietary DJing applications for Windows or Apple platforms, often bundled with the hardware.

Mixxxing it up

In the world of free software, the TerminatorX application has offered entertainment by way of scratching and mixing for some time. Cross-platform upstart Mixxx has the edge for the beat-matching style of mixing, and has support for a variety of time-coded vinyl formats and hardware control surfaces too.

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.

If you have a Hercules DJ Console control surface, add the Scons option:
djconsole=1 for the current model MK2 and RMX controllers.
djconsole_legacy=1 for the Control MP3 and original Hercules MK1 controller.

Once compilation is complete, type mixxx into a console window to run the program.

Running Mixxx for the first time

Mixxx needs to know where on the local filesystem you keep your music collection. We've made a directory called /music and put some FLAC and WAV files in it.

Mixxx also supports MP3 and Ogg Vorbis playback, but if your ambition is to play in a club on a decent sound system, you should avoid archiving music in a lossy format. If the only copy of a particular song you have is in MP3 format, you might want to track down a better quality version, particularly if the bitrate of the file is 128kbps or less.

The lower window of the Mixxx GUI, by default in Library view, should now fill with a list of sound files in the directory that you specified. If you want to locate audio files elsewhere on the filesystem, you can click the combo box just above the left-hand side of this window and select Browse. If your music library is on the ungainly side, use the Search box above the window to the right, which will enable you to narrow the list of files to a particular artist, title or keyword.

Use Options > Preferences > Interface > Skin to select a GUI that fits the display you're using. In this tutorial we're going to describe the new Natt skin, which looks very smart indeed. Other skins work more or less the same way, although the layout of the controls can be different.

Double-click any file in the Library view and it will load automatically into the first available player – channel 1 is the lefthand player and channel 2 is on the right. Mixxx will not load a file into a channel where a track is already playing, which is a useful safety feature (for avoiding embarrassing silences on the dance floor). You can also load a track into a specific player by rightclicking it in the Library view.

After a short delay while Mixxx analyses the beginning of the file, calculating the beats-per-minute of the track, the waveform of the audio will be drawn in one of the player windows. Get this file playing by clicking on the appropriate button, or hitting the keyboard shortcut for start/stop (which is D for the channel 1 player).

Mashup time

You'll notice that the crossfader knob, just above the Library view, is sitting in the centre – which is not a good place to start, unless you already know exactly how you're going to mix the first two tracks. Drag it all the way to the left so that only the output from channel 1 is audible. Now load up a second track in channel 2 and start it playing.

If you have a four-channel or secondary audio device set up in Options > Preferences > Sound Hardware > Headphones, hit the headphone cue button; otherwise, you'll have to rely on the waveform in the GUI or your memory of the track to know when to make the fade.

If one track is faster than the other, you can drag the Pitch fader on either player to attempt a match. By default, this control is in vinyl emulation mode, which means that a faster tempo results in a rise in musical pitch; but since this is a digital system, we can also use the CPU to stretch and shrink the timing of audio without changing its pitch. If you want to try this feature, you'll need to enable it under Options > Preferences > Sound Hardware > Pitch behaviour. There are also buttons next to each pitch fader for precise adjustments, permanent or temporary.

The Sync button in this section of the GUI will attempt automatic adjustment between channels, which works on the basis of the previously assessed tempo of each track. This beat detection feature works pretty well for four-to-the-floor dance music like techno or house, but less well for the complex rhythms found in drum 'n' bass.

If beat detection fails and is displayed as 0.0, you have the option to enter the tempo of a track manually. To do this, rightclick on a file in the Library window, and select Properties to open the Track Editor dialog box. With the track in question playing, click the 'Push To Tap Tempo' button in time with the song, which in dance music usually means in time with the kick drum. The better you are at console games like Guitar Hero, the closer the result will be to the actual tempo of the song.

Sometimes beat detection doesn't work because the tempo is outside the range that Mixxx expects (by default, 70 to 140 beats per minute). To correct this for a fast song, use the Track Editor dialog to up the maximum end of the BPM range, perhaps to 150, then click on the Go button to begin detection. If the song has a slow intro that unbalances the result, check the 'Analyze Entire Song' box and try again.

Beat matching

Of course, there's more to mixing than just having two songs playing at the same speed. To enable smooth crossfades, beats and bars have to be lined up in a musical way. While that's largely a matter of the DJ's skill and judgement, Mixxx does allow you full control over the position in the track of the two waveforms.

Click anywhere in the waveform display and drag the mouse – the farther you pull the mouse to the right, the faster Mixxx will scrub through the file. Move the mouse to the left and the track will slow to a stop, then play backwards at progressively greater speed.

Mixxx draws lines on the waveforms to indicate the positions of the beats, but unless you're mixing very similar tracks, these beat lines can be misleading. There's really no substitute for using your ears, and that's where the real fun begins.

You can also play with the built-in equaliser (the knobs labelled High, Mid and Low on each channel) and the flanger effect to make your mixes more creative. When you've practised a bit and you're happy with the results, use Options > Record Mix so you can prove your abilities to the non-believers. And of course, if you create something that you think other people might like, let us hear it!

-------------------------------------------------------------------------------------------------------

First published in Linux Format, Issue 114

Now read The 14 best Linux distros

Sign up for the free weekly TechRadar newsletter
Get tech news delivered straight to your inbox. Register for the free TechRadar newsletter and stay on top of the week's biggest stories and product releases. Sign up at http://www.techradar.com/register