So here's what I think my DJing toolchain is going to look like:
jackd -R -dalsa -dhw:0,3 -r44100 -p1024 -n2 -P &
ecasound -i jack &
cle
mplayer -ao jack:port=ecasound -af
scaletempo -quiet -slave sometrack.mp3
cle mplayer -ao jack:port=ecasound -af scaletempo -quiet -slave someothertrack.mp3
[...]
JACKd provides the low-latency sound server and signal routing between mplayer and ECAsound. ECAsound will be standing between mplayer and the soundcard; I intend to use it to control the signal routing and mixing between the stereo channels of each mplayer "deck" (of which there can be unlimited numbers, apparently!) and the four output channels - stereo mains, and, of course, stereo headphone monitors. On my cheapo Sound Blaster Live! value, I've got a front and rear stereo surround, so I just split the "front" jack to the speakers, and use the "rear" jack for the headphones. Pie! ECAsound can apply LADSPA effects, if desired (EQs, compressor/limiters, phasers/flangers... etc.) and volume levels, of course, all of which can be controlled in real-time through any MIDI controller.
The reason I'm stuck on Mplayer is because of the scaletempo audio filter, which handles the pitch-moderation necessary to keep a track at the same pitch while changing the playback speed, avoiding the "chipmunk effect". Having it handled at the source, by a native mplayer plugin, instead of having to hack something together later in the output chain should make things much, much easier. Then I can use mplayer's slave mode with a script to control the seeking for cue points and "nudging", and the playback speed for tempo synchronization and beatmatching.
I am pretty happy about this, because I have just put this together and verified that the latency through this chain is TINY, as far as I can tell. I was tapping keys to launch cue points in time with the currently playing track with somewhat better success than I was with Mixxx last night. And I haven't even tried to install
OSSv4 or even a real-time kernel. After spending a few hours frustrated by trying to connect bits with UNIX fifos, this is looking good.
I love ecasound. It helped me out a lot when I was trying to
peel annoying ads off of Magnatune tracks (which they no longer tack on, thankfully), and it is one of the best-documented audio tools I've seen. Nice for an application with no GUI whatsoever - which actually makes it eminently usable to a hacker, because you can script everything. A GUI is a Graphical USER Interface, but a Command Line Interface is, in essence, an Application Programming Interface at the same time as a user interface. That API accessibility is what GUIs have lost for a long time, and are
starting to reclaim with things like Applescript (which is certainly old, but confined to the Mac OS ghetto) and DBus.