More Audio 4 DJ tricks

In my DJ setup, I use the JACK sound server to link my mixing program to a bunch of fun effects. It is possible to get JACK to perform at extremely low latencies (~6ms and less) but it’s hard to get all the options just right. For the benefit of others who don’t want to go through the same trial and error I did, here is the command line I’m using to launch jack:

jackd -R -P 99 -p128 --timeout 4500 -d alsa -d AUDIO4DJ -p $size -n $periods -i 4 -o 4 -r 44100

Here’s what all that means:

  • -R: Realtime mode
  • -P 99: Realtime Priority value (maxed out)
  • -p 128: max jack ports
  • –timeout 4500: client timeout in ms. This is very important, because Mixxx might hang for longer than the default 500ms when it’s loading tracks. If that happens, JACK kicks out Mixxx and playback stops
  • -d alsa: Use ALSA backend

(Note, after this argument, the rest of the arguments are ALSA-specific

  • -d AUDIO4DJ: use the AUDIO4DJ alsa device (see my previous post)
  • -p $size -n $periods: These two options are what determines the size of the sound buffer. The first number is the frame size, in bytes (I think). The second is the number of frames. Multiply the two together to get the total size. With a special realtime kernel, I can set this to 64 and 4 (total: 256, or about 6ms). With a standard kernel, it has to be 128 and 3 (total: 384, 9ms). The idea is you want to get the total multiplied number as small as possible without inducing the dreaded XRUN, which happens when your computer can’t feed audio to the sound card fast enough.
  • -i 4 -o 4: 4 inputs, 4 outputs
  • -r 44100: CD-rate audio

Yeah, I know, if I just bought a mac and Traktor or Serato I wouldn’t have to deal with this shit, but I’m cheap and can’t resist a challenge.

Share

Native Instruments Audio 4 DJ on linux

The Native Instruments Audio4DJ is a professional-quality USB soundcard for DJing that is also supported under linux. Like mode devices that are “supported” under linux, however, it can be tricky to set up correctly. In my case, I need the device to work with the JACK sound server, and I needed to do a little extra work.

The first trick is setting up ALSA so that JACK works happily with the card. The problem is that the drivers don’t supply any regular mixer controls for the Audio4DJ, which makes jackd unhappy. So when creating a .asoundrc, it’s necessary to substitute the internal soundcard as the mixer elements for that device. Putting this text in ~/.asoundrc does the trick:

pcm.AUDIO4DJ {
    type multi;
    # bind hardware devices
    slaves.a.pcm "hw:1,0,0";
    slaves.a.channels 2;
    slaves.b.pcm "hw:1,0,1";
    slaves.b.channels 2;
    # bind channels to virtual device;
    bindings.0.slave a;
    bindings.0.channel 0;
    bindings.1.slave a;
    bindings.1.channel 1;
    bindings.2.slave b;
    bindings.2.channel 0;
    bindings.3.slave b;
    bindings.3.channel 1;
}

# JACK will be unhappy if there is no mixer to talk to, so we set
# this to card 0. This could be any device but 0 is easy. 
#note that audio4dj is actually card 1 -- we are faking mixer elements so JACK is happy:

ctl.AUDIO4DJ {
        type hw;
        card 0;
}

The second question is how to change the input mode of the Audio4DJ from phono to line and back. Normally this type of setting would be found in the alsamixer program, but for some reason it’s hidden away. This script makes it easy:

#!/bin/bash

if [ "$1"x == "x" ] ; then
	echo "$0 [phono|line|timecode]"
	exit 1
fi

dev=`aplay -l  | grep Audio4DJ | grep "device 0" | cut -d\  -f 2 | cut -d: -f 1`
if [ "$dev"x == "x" ] ; then
	echo "Audio 4 DJ not connected"
	exit 1
fi

result=0
if [ "$1" == "phono" ] ; then
	amixer -c $dev cset numid=1 2 > /dev/null
	result=$?
elif [ "$1" == "line" ] ; then
	amixer -c $dev cset numid=1 1 > /dev/null
	result=$?
elif [ "$1" == "timecode" ] ; then
	amixer -c $dev cset numid=1 0 > /dev/null
	result=$?
else
	echo "$0 [phono|line|timecode]"
	exit 1
fi

if [ $result -ne 0 ] ; then
	echo "Error setting Audio 4 DJ input"
	exit $result
fi
Share

Black Friday Mixxx Session

This is my mix for November. Black Cat, White Cat is a crazy, awesome track.

  1. Luca Cazzoni & Naila`kil – High spirit (Original Mix)
  2. Catstayslow – bumba
  3. Steve Bug – Look Who’s Stalking
  4. Alyn Sclosa – Organo
  5. Riva Starr – Black Cat, White Cat feat. Noze – Original Mix
  6. Damolh33 – A straw hat
  7. James Wyatt – She’s Got Nic
  8. hermetico – parabolica
  9. Joel – Laufen (Live)
  10. alec troniq – 03 i`m the foolaloof [agaric rmx]
  11. Claude VonStroke – Vocal Chords – Original Mix
  12. JuanMP – Double Block (Bubbaloop Remix)
  13. andre lanine – harp (crispmeister warp mix)
  14. Luca Lozano – Berlinetta – Original Mix
  15. Damolh33 – Innocence
  16. Sis – Dim Dim
  17. alec troniq – 05 i`m the foolaloof [tim susa vs. jan yang rmx]

Black Friday Mixxx Session by ywwg

Share

Mixxx Session 091027

More beats. I always listen to my mixes the day after I make them, because how am I going to know what I’m doing wrong unless I check my work? Often, while actively mixing, something will sound ok, but listening to it later it’ll sound forced or messy. Lives, unexamined and otherwise, relative worth w.r.t. living, etc etc.

Most people do a spooooky halloween special mix, but this isn’t that, really. huh. Maybe I’ll do one today.

  1. Stefny – Flight
  2. Navy b. – S P
  3. Rodrigo Rivera – Despegue programado N2
  4. nemecek – vindaloo jones
  5. Insanek – My last brain (Original Mix)
  6. Ricardo Serapio – Onche
  7. alec troniq – i`m the foolaloof [agaric rmx]
  8. Steve Bug – Swallowed Too Much Bass feat. Paris The Black Fu – Joris Voorn Remix
  9. London Fm – Urbansound – Original Mix
  10. Sis – Nesrib
  11. Drugstore – Nemesis
  12. Hay Dios Mio (Splatter Remix)
  13. Eggbox – Wrongway
  14. Ambivalent – Nineteen – Original Mix
  15. Gabriel Damen – Toy
  16. JuanMP – Double Block
  17. Dintun – Runge Mufasin (Pablo Denegri Remix)
  18. Dennis Shoker – Three In One Apartment

Mixxx Session 091027 by ywwg

Share

Mixxx Session 090918

This one came out pretty well, although there were two stupid mistakes that I covered up with a little post-editing and there a couple transitions that sound sloppy. I’m now hosting files on SoundCloud, which has a really nice interface for listening to tracks and commenting on them.

Tracklist:

  1. unfound43_04_-_minimorph_-_real_place
  2. ldo_benitez_rota_de_nuevo_btb_mix
  3. Tino Boa – Dreisamkeit live
  4. Uniquex_down-draftLabel
  5. Justin Martin, Claude VonStroke – Beat That Bird – Original Mix
  6. Aka Aka – Woody Woodpecker – Original Mix
  7. SIBEGG_FREE
  8. Wighnomy Brothers – Exvola Stupp – Original Mix
  9. SCHUMACHER, Thomas – Sunset
  10. Chris Lake, LYS – La Tromba – Original Mix
  11. unfound40_05_ – unfound40_05_-_olene kadar_-_noflik_bank_sitten
  12. Kaive – Smile
  13. unfound43_02_ – unfound43_02_-_minimorph_-_cubanito
  14. Sis – Nesrib
  15. Jan Hendez – 03 – Orgazmo (Zhao rmx)
  16. Dintun – Runge Mufasin (Pablo Denegri Remix)
  17. Dak_-_Rainmaker_II

090918 by ywwg

(To download, click the little down-pointing arrow on the right, or if you go to the soundcloud web page, click on “More Options,” then “Download”)
Share

Mixxx Session 090825

Here’s another DJ mix I made recently. I think this one came out quite well, with a minimum of mistakes and much better beat-matching than usual. “Yes Ma’am” is one of my favorite tracks right now. Comments welcome.

Tracklist (about an hour):

  1. david bernabe – alflolol
  2. licuadora system – playing with sticks
  3. monokao – destruccion masiva
  4. DJ Chus, Carlos Manaca, Pablo Ceballos – The Strong Rhythm – D-Unity Remix
  5. NDKj – Main Course – Minicoolboyz Remix
  6. Marc Houle – Dirty Dirty – Original Mix
  7. DJ Baldino – Jumping – Original Mix
  8. Ricky Ambilotti – Construkt – Original Mix
  9. Thega – Hay Dios Mio (Sergio Soroa Remix)
  10. Mark Knight, Funkagenda – Flauta Magica – Original Mix
  11. Visti & Meyland – Yes Maam (All Night Long) (Trentemoeller Remix)
  12. Navy b. – Popisowa
  13. david bernabe – palmero inc. (felipe valenzuela remix)
  14. RichVomDorf – Momento A

Mixxx Session 090825 on archive.org

Mixxx Session 090825 mp3 download

Do you not like glitchy, thumpy, electronic music? Sorry, can’t help it. The first CD I ever bought that I really, actually wanted for myself was Rave ‘Til Dawn, because I eagerly wanted to own the track “Fuck You.”

Share

DJing on the cheap

One thing I’d always wanted to try was DJing, because hey, doesn’t everyone? It’s like being a musician but without all that hard work, skill, and practice. I’d never really pursued the interest, though, because being a DJ, even as a hobbiest, had always been an extremely expensive proposition. Good turntables cost 600$ each, a mixer is another $100 or more, and there’s all the vinyl I’d need to buy. I know myself well enough that I didn’t want to risk dropping close to a grand on a hobby that, in all probability, I’d lose interest in after a month.

In recent years, laptop DJing has gotten more popular, but I still didn’t want to spend 500$ on the software and more on the mp3 music. I could have acquired these by bittorrent or whatever, but I don’t like stealing software and also hate rebooting into windows. Ideally I wanted an open source program that would run on linux, but most of the options I found sucked. My dream of being a superstar DJ appeared forever out of reach.

Then one lazy day of clicking around the internet I discovered Mixxx, an open-source DJing application. Amazingly, it doesn’t suck. After some experimentation, it became clear Mixxx not only didn’t suck, but was actually pretty good. Around the same time, I’d also discovered the wide world of netlabel music. There are artists all over the world who are more than happy to share their tracks for free on the internet. Because I’m not stealing the music, it’s easy to preview tracks and download the ones I like. I quickly built up a catalog of a few hundred decent tracks. I was very close to actually being able to mix music! Visions of neon-haired techno girls danced in my head.

So I have software, I have music, and I haven’t spent any money yet! The Mixxx developers recommend the Hercules DJ MP3 as a good cheap controller, so I snagged one off ebay for 70$. I also have a small older version of this M-Audio MIDI keyboard which I got used for 60$ or so1. Lastly, I have an M-Audio Sonica Theater for simultaneous main mix output and headphone preview output2.

With all of that, my setup was complete:

Laptop, sonica multichannel sound card, midi keyboard (for effects), and Hercules DJ MP3
Laptop, sonica multichannel sound card, midi keyboard (for effects), and Hercules DJ MP3

Total cost: ~$150

I got some practice spinning tunes, and quickly discovered all sorts of annoying problems with Mixxx and my setup. The default mixxx theme, for instance, is ugly and doesn’t use screen-space well. I downloaded a cool-looking theme called “Trancer”, but then I wasn’t happy with that so I did what any linux user would do — hacked it and made my own version:

My custom Mixxx theme, which fits nicely on my 1280x800 screen
My custom Mixxx theme, which fits nicely on my 1280x800 screen

I also wanted to have more control over filters and effects, so I set up a JACK pipeline so I could use my MIDI keyboard to select and tweak effects outside of Mixxx itself. I use the jack-rack program to handle the effects, although I had to hack that too. So when I’m mixing, this is what my desktop looks like:

Mixxx on the right, a couple jack-racks on the left, and a little midi notifier at the top left
Mixxx on the right, a couple jack-racks on the left, and a little midi notifier at the top left

And while I was playing some music, I discovered some aspects of the Mixxx music library that I didn’t like. Like, I needed some way of knowing which tracks I’d already played so I wouldn’t accidentally play them again. Also, the search bar also didn’t allow for multiple search terms. So I hacked away at the mixxx source code. Now the search box works right and I know if I’ve played a track as well as how many times I’ve ever played it.

But what type of open-source advocate would I be if I kept this all to myself? So, I present:
Mixxx Trancer theme (DJO remix)
Mixxx 1.7 (DJO remix diff)
jack-rack 1.4.7 (DJO remix diff)

The most important patch is the one for mixxx itself. The library is really hobbled without it.

After all this hacking, I finally have a setup that works well. I’m sure a European jet-set lifestyle is not far behind, but although I’ve been mixing for like, close to two months now, I’m still not a superstar DJ. But I did record one session that I consider post-worthy. I call it, “Mixxx session 090710.” Future mix postings will have a full tracklist, but due to a mistake, this one doesn’t. Enjoy!

Mixxx Session 090710 on archive.org (88 Meg, 1 hour)

  1. I got this when I was playing around with freewheeling, until I realized I don’t play the keyboard []
  2. I also got this from ebay, used. There’s a lot of decent hardware out there that doesn’t really go bad []
Share

Starting a user-controlled streaming radio station

The dream:
I want a streaming radio station for my company that itunes can tune in to, where anyone at work can upload tracks and add them to the playlist.

The ingredients:

Explanation:
MusicPD is an awesome music server that I’ve talked about before, and it would be perfect for setting up my little radio station. Users would be able to add files to the playlist from any browser, and mpd now supports shoutcast, which should make turning it into a streaming station easy.

However, right now mpd only supports shoutcast streaming in OGG Vorbis format, and iTunes can’t play OGG. Since everyone in the office is on iTunes, I need some way of getting mpd to spit out mp3 to icecast.

Enter JACK! Jack is a “pro-audio” subsystem for connecting applications, kind of like shell pipes for audio. It can be kind of daunting to work with, but in this case it’s best to just think of it as glue connecting one program with another.

For instance, mpd has a JACK output plugin, and there’s another program, Darkice, that has a JACK input and sends audio to icecast. I can link mpd and darkice with jack, and that should solve my mp3 problem.

So, to review:
mpd (links via JACK to) darkice (which encodes mp3s for) icecast (which streams to) itunes

The Wrinkle:
Make it work on a mac server. At work we don’t have a recent machine running linux that’s up all the time and that isn’t mission-critical, so I have to make due with one of the mac workstations. Luckily macports will do a lot of the heavy lifting.

A Note:
This took a lot of building, installing, and configuration that I don’t have space to cover here. I’m trying to record everything I did that was abnormal or not obvious. If you’re comfortable installing software on unix and you know how to configure a program based on the examples and READMEs, there should be enough information here to reproduce my work.

Getting the software:

  1. Install macports on the mac
  2. Install the following ports: apache2 faac faad2 flac id3lib mad lame libid3tag libvorbis speex
  3. Install this port: php5 +apache2 +macosx +pear
  4. Install the following by source: curl, jack (do not use “jackosx”, build it from source), icecast, darkice, mpd
  5. Apply my patch to mpd/src/audioOutputs/audioOutput_jack.c to make it work on mac osx.

Details:

JACK:
Built with these options: ./configure --prefix=/opt/local --with-default-tmpdir=/tmp
I just start JACK with jackd -d dummy -r 44100

If I don’t specify a default tmpdir, jack crashes complaining it can’t stat /dev/shm. I don’t need to use a real audio device in jack because I’m not outputting the audio to the speakers.

Icecast:
built with ./configure --prefix=/opt/local
No special configuration needed other than what’s specific to my site.

Darkice:
Built with ./configure --prefix=/opt/local/ --with-lame-prefix=/opt/local/ --with-vorbis-prefix=/opt/local/ --with-faac-prefix=/opt/local/ --with-jack-prefix=/opt/local/
I probably didn’t need all those options, but heck, it works.
I set up the configuration file so that the audio device is jack (no quotes).

MusicPD:
built with ./configure --prefix=/opt/local --with-faad=/opt/local --with-libFLAC=/opt/local --with-mad=/opt/local --with-libvorbis=/opt/local/ --with-id3tag=/opt/local
I set up the configuration file to use jack as a device. I need to tell mpd to connect to darkice when it starts up, but darkice picks its port names based on its pid, so it’s always different. What I did is create mpd.conf.in, with this as the device config:

audio_output {
type "jack"
name "MPDJack"
ports "darkice-REPLACEME:left,darkice-REPLACEME:right"
}

Then I run a script to actually start mpd:
#!/bin/bash
pid=`jack_lsp | grep darkice | cut -d '-' -f 2 | cut -d ':' -f 1 | uniq`
cat mpd.conf.in | eval sed -e 's/REPLACEME/$pid/g;' > mpd.conf
mpd ./mpd.conf

Putting it all together:
Once all of those pieces are in place, I can start the radio station by starting the various programs in this order:

  • Jack first,
  • then icecast,
  • then darkice, (-v 10 for debugging)
  • and finally mpd. (--verbose --stdout --no-daemon for debugging)

That’s it. I can control the mpd server and it plays music. If I run jack_lsp -c -p I can see mpd is connected to darkice. I can tune in to the icecast stream from itunes and hear it. With simple mac file sharing, users can connect to the server and drop music in the database. Then mpd can either rescan every hour or so with cron, or when the user clicks “update db” in pitchfork.

Setting up pitchfork is left as an exercise for the reader.

Share

Ben Folds, The Symphony, and Getting Punched in the Face

Char and I went to see Ben Folds at the opening of the Boston Pops season. It was fun, except for the part where some guy in the second balcony started punching some other guy in the face.

I’m not making this up!

Some guy whose post I found on technorati:

so i’m sitting here in the center on second balcony and to the left of me on the same level in the middle of the sound someone screams and everyone looks over there and it looked like someone was about to fall over the edge or something. then i kept watching and the guy goes up a couple rows and looks like hes talking to this other guy and then all of a sudden punches him. and then proceeds to keep punching him. the people around there try to restrain him and stuff, but it was really intense. and people were kind of screaming, so it even stopped the music for a couple minutes as they got it under control. but seriously who fights at a freaking boston pops concert. anyway.

That’s pretty much the way I remember it, although I missed the part where someone was about to fall off the balcony. I heard a woman’s voice cry out, and I couldn’t figure out where it came from. I thought maybe someone had too much to drink. And then I saw a commotion way over on the left side, and sure enough some guy just starts punching someone else in the face.

In the movies, when things like that happen, there is always the horrified “oh!” of gentle-men and -women in the audience. Funny enough, it actually happens in real life too! People were still mumbling to each other after the orchestra started up again.

Other than that, the concert was excellent. The hall sounded beautiful, and Ben Folds rocked the house. It was quite a meeting of two very different audiences — the regular Pops crowd, and a lot of Ben Folds fans. (Note: the altercation appeared to be between regular-pops-crowd-types, not rowdy young ben-folds-types.)

A night to remember!

Update: the em-ess-em picks up on the story

Update with picture!

This looks like it’s getting a decent amount of play, so you can probably take it from here and search google news for more info.

Share