My Native Instrument Audio 4 DJ Experience
* Getting the kernel ready
* Getting the card device up
* Troubleshouting with multiple cards
* playing a bit with Jackd
* Xwaxing your board
* playing a bit with
PulseAudio (draft)
contact: alex (at) dev (dash) edge (dot) org
I'm using Gentoo GNU/Linux. I get this card for some aspects:
- mobility, I can easily swap it from desktop to laptop to pico-itx or whatever.
- I had no more space in my micro-atx tower, taken by the geforce ventirad...
- this USB card offers phono preamp, 24bits samplerate, 2 IN/2 out channels and is solid as a rock. Using turntables I had the choise of buying 2 preamp & a soundcard, or get a little more confort, less cables & power supply to plug in with this card.
- having preamp it's a good point to integrate within an Xwax setup.
Until I get this, I was using a 2.6.29-rt with the motherboard intel-hda internal soundcard.
I soon realised this kernel did not gave access to the usb card, having nothing listed for it under /proc/asound/cards
But devel has evolved and support for A4DJ is made by using a kernel => 2.6.30. I allready had one, so just by rebooting the soundcard appeared listed.
With 2.6.30 I'm able to use the card, but some troubles appears, sometimes the cards number change, having 3 audio devices on my desktop. Since I need realtime for turntablism and beatmatching some loops, I'm getting on 2.6.31-rc8 with RT patch. (-rc8 is the last release candidate before .31 release by Linus Torvald which would occur shortly.). Keep always a stable kernel, because RT patch aim is not for multipurpose desktop activities. It can hang while using some lambda-user tasks. The configuration goal below is made for Gentoo, but with unix knowledge you can apply it too any Linux environment. I will not go deeply in some tasks that are described everywhere on Altavista. I've started to write this tutorial since audio under linux can still be a mess and a kronophage activity. I write this for me, but it can serve others.
Getting the kernel ready
RT patch list can be found
there∞. Then download, copy and untar 2.6.31-rc8 within you /usr/src.
Check patch validity:
cd /usr/src/linux
zcat ../patch-2.6.31-rc8-rt9.gz | patch -p1 --dry-run
Then patch if nothing yell:
zcat ../patch-2.6.31-rc8-rt9.gz | patch -p1
Apply patch..
Now, get your fellow .config back or create a new one. Be sure to have the
RealTime options activated. If lost, linuxmao.org provides a resume on options to check, but you'll have to deal with some french language issues. (
Realtime & Audio important compiling options∞ ).
Makes sure to select the mod_usb_caiaq driver
Device Drivers --->
<*> Sound card support --->
<M> Advanced Linux Sound Architecture --->
[*] USB sound devices --->
<M> Native Instruments USB audio devices
Save your config and compile your new kernel, compile back your graphic card driver if needed, install, reboot.
sudo emerge -av =x11-drivers/nvidia-drivers-190.18
reboot
Note: current nvidia-drivers may provides a nv-linux.h that can't match this current kernel, so patching the sources is needed; create an ebuild in your locale portage tree:
diff -ur usr/src/nv/nv-linux.h my-usr/src/nv/nv-linux.h
--- usr/src/nv/nv-linux.h 2009-09-03 23:05:30.000000000 +0200
+++ my-usr/src/nv/nv-linux.h 2009-09-03 23:05:00.000000000 +0200
@@ -721,7 +721,7 @@
#define nv_up(lock) up(&lock)
#if defined(CONFIG_PREEMPT_RT)
-#define NV_INIT_MUTEX(mutex) init_MUTEX(mutex)
+#define NV_INIT_MUTEX(mutex) semaphore_init(mutex)
#else
#if !defined(__SEMAPHORE_INITIALIZER) && defined(__COMPAT_SEMAPHORE_INITIALIZER)
#define __SEMAPHORE_INITIALIZER __COMPAT_SEMAPHORE_INITIALIZER
In the grabbed ebuild file add in the src_unpack() function
# Use RT kernel patch
epatch "${FILESDIR}"/NVIDIA_rt-kernel.patch
Then rebuild 'ebuild nvidia-drivers-185.18.31.ebuild manifest'; emerge
Getting the card device up
so activating the card into the kernel up is fairly simple if you compiled it as a module just do this, don't pay attention else:
$ dmesg | grep usb
usb 1-8: new high speed USB device using ehci_hcd and address 3
usb 1-8: configuration #1 chosen from 1 choice
$ cat /proc/asound/cards
0 [DJ ]: snd-usb-caiaq - Audio 4 DJ
Native Instruments Audio 4 DJ (serial SN-fe84rg3b, usb-0000:00:04.1-4)
1 [Bt878 ]: Bt87x - Brooktree Bt878
Brooktree Bt878 at 0xd6101000, irq 17
2 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xd6200000 irq 23
$ sudo modprobe snd_usb_caiaq
Notice the driver version number improving through releases:
under 2.6.30:
$ sudo modinfo snd_usb_caiaq
filename: /lib/modules/2.6.30-gentoo-r4/kernel/sound/usb/caiaq/snd-usb-caiaq.ko
license: GPL
description: caiaq USB audio, version 1.3.14
author: Daniel Mack <daniel@caiaq.de>
alias: usb:v17CCp0839d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp0D8Dd*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp1915d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp1978d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp0815d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp4712d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp4711d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp1940d*dc*dsc*dp*ic*isc*ip*
alias: usb:v17CCp1969d*dc*dsc*dp*ic*isc*ip*
depends: snd-pcm,usbcore,snd,snd-rawmidi
vermagic: 2.6.30-gentoo-r4 SMP mod_unload modversions CORE2 4KSTACKS
parm: index:Index value for the caiaq sound device (array of int)
parm: id:ID string for the caiaq soundcard. (array of charp)
parm: enable:Enable the caiaq soundcard. (array of bool)
under 2.6.31-rc8-rt9:
sudo modinfo snd_usb_caiaq
filename: /lib/modules/2.6.31-rc8-rt9/kernel/sound/usb/caiaq/snd-usb-caiaq.ko
license: GPL
description: caiaq USB audio, version 1.3.19
Troubleshouting with multiple cards:
Sometimes devices does not respect the mapping I ask to alsa-driver. It remembered me the things that could happened in the past while upgrading from sysfs to udev, and loosing ethernet cards aliases for newer, until cleaning up the udev tree in /etc
0 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xd6200000 irq 23
1 [Bt878 ]: Bt87x - Brooktree Bt878
Brooktree Bt878 at 0xd6101000, irq 17
2 [Audio4DJ ]: snd-usb-caiaq - Audio 4 DJ
Native Instruments Audio 4 DJ (usb-0000:00:04.1-4)
Indeed, as described on
ALSA webpage∞ you just need to fix the index in front of each cards.
The devices will then have fixed numbers and will not bother you anymore. Edit /etc/modules.d/alsa.conf (or sometimes /etc/modprobes.d depending of how/when you had a gentoo install)
alias snd-card-0 snd-usb-caiaq
alias snd-slot-0 snd-usb-caiaq
alias snd-card-1 snd-bt87x
alias sound-slot-1 snd-bt87x
alias snd-card-2 snd-hda-intel
alias sound-slot-2 snd-hda-intel
options snd-usb-caiaq index=0,1
options snd-hda-intel index=2
options snd-bt87x index=3
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
You can also add alsasound to boot runlevel, but for gentoo since /etc/init.d/alsasound point to /etc/alsa.d and mine was not present, I just created the directory for further investigations & tweaks, leaving it as is for the moment.
sudo mkdir -p /etc/alsa.d
sudo rc-update add alsasound boot
So now, under the 2 kernels a simple alsa playing works well
mplayer -ao alsa somewavoggflacfile
mplayer -ao alsa:noblock:device=plughw=0,0,0 ~/Glenmor-La_mort_de_Lez-Breizh.wav
mplayer -ao alsa:noblock:device=plughw=0,0,1 ~/Xenia_Beliayeva_Hellraiser-OJbJexfs17Q.mp4
playing a bit with Jackd
Playing with Jackd was fairly simple, I just emerged qjackctl which is the most used configuration interface under libqt3. You can make 2 profiles one for Realtime kernel, one for normal kernel by instance. I used a bit mhwaveedit with it for ripping some of my vinyls to focus on xwax tests
Xwaxing your board
0.6 just get released, I made an ebuild but got some segfault in front of some system librairies, I downloaded the executable tarball and it works well, simply launching some 12" recorded in .wav files to check my cabling configuration & those
2 rane toons∞. Now you can hardmix & scratch your KMS & SID records collection without fearing to break the groove.
xwax -a plughw:0,0,0 -a plughw:0,0,1 -l /home/mued/WAV/
Cabling scheme courtesy of
xwax.co.uk∞ website. Notice that the Audio 4 DJ is a blackbox of the 2 audio interfaces & the 2 preamps presented on the figure.
Happy mixin'
--
(draft)
taken from PA mailing list: «On bright side, in the end it is always possible to configure PA manually to use your low-level devices, by adding two lines like these» to /etc/pulse/default.pa or your ~/.pulse/default.pa
load-module module-alsa-sink device=hw:DJ,0,0
load-module module-alsa-sink device=hw:DJ,0,1
aplay
mued@transylvania ~ $ aplay -L
default:CARD=DJ
Audio 4 DJ, Audio 4 DJ
Default Audio Device
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=NVidia
HDA NVidia, ALC885 Analog
Default Audio Device
front:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
Front speakers
surround40:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=NVidia,DEV=0
HDA NVidia, ALC885 Digital
IEC958 (S/PDIF) Digital Audio Output
mued@transylvania ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: DJ [Audio 4 DJ], device 0: Audio 4 DJ [Audio 4 DJ]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
card 2: NVidia [HDA NVidia], device 0: ALC885 Analog [ALC885 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: NVidia [HDA NVidia], device 1: ALC885 Digital [ALC885 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
/.asoundrc
pcm.usb-caiaq {
type hw
card 0
}
ctl.usb-caiaq {
type hw
card 0
}
pcm.bt87x {
type hw
card 1
}
ctl.bt87x {
type hw
card 1
}
pcm.hda-intel {
type hw
card 2
}
ctl.hda-intel {
type hw
card 2
}
pcm.jackplug {
type plug
slave { pcm "jack" }
}
pcm.jack {
type jack
playback_ports {
0 alsa_pcm:playback_1
1 alsa_pcm:playback_2
}
capture_ports {
0 alsa_pcm:capture_1
1 alsa_pcm:capture_2
}
}
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}