How to get a NI Traktor Audio 2 sound card work with Mixxx

Thanks, this helped me making my TRAKTOR 2 working with Mixxx, which uses ALSA. For other apps, which mainly use pulseaudio on top of ALSA, it used to work out of the box. But suddenly, after some ubuntu update it stopped working.

I could fix this problem by adding a configuration file to pulseaudio.

As root, go to /usr/share/pulseaudio/alsa-mixer/profile-sets. You will see there are conf files for the audio6, audio8, etc, but nothing for the audio 2. THOUGH, surprisingly, a file named native-instruments-traktor-audio2.conf IS referenced in /lib/udev/rules.d/90-pulseaudio.rules . That's the source of the problem, maybe the file was omitted by the developpers, and pulseaudio complains about not finding it.

It's easy to create this file, i copied the audio6 file and stripped everything about inputs - as the audio2 has outputs only. Then it has to be named exactly : native-instruments-traktor-audio2.conf

Now it works again, and as a bonus I can choose between channels A and B. Formerly i was restricted to channel A in pulseaudio.

Here is my file, hope it can help someone. I guess this omission will be fixed in a pulseaudio update to come.

[General]
auto-profiles = no

[Mapping analog-stereo-a]
description = Analog Stereo Channel A
device-strings = hw:%f,0,0
channel-map = left,right

[Mapping analog-stereo-b-output]
description = Analog Stereo Channel B (Headphones)
device-strings = hw:%f,0,1
channel-map = left,right
direction = output

[Profile output:analog-stereo-all]
description = Analog Stereo Duplex Channels A, B (Headphones)
output-mappings = analog-stereo-a analog-stereo-b-output
priority = 3
skip-probe = yes

[Profile output:analog-stereo-a]
description = Analog Stereo Output Channel A
output-mappings = analog-stereo-a
priority = 1
skip-probe = yes

[Profile output:analog-stereo-b]
description = Analog Stereo Output Channel B (Headphones)
output-mappings = analog-stereo-b-output
priority = 2
skip-probe = yes

Ok, while I still don't understand why Mixxx cannot select the right sound card, I was able to find a solution that works for me in the Mixxx wiki. I've modified the .asoundrc file from there slightly to make it clear which channel I'm choosing, but it's essentially the same config.

In summary, what I did was to create a file named .asoundrc with the contents below and I put it in my home folder.

What works:

  • I can now select each individual channel (A or B) as separate sound devices in Mixxx, sound is output onto each correct channel

What doesn't work:

  • The resulting sound device from the combination of channels (TraktorAudio2ChannelAB) outputs some garbled sound

What I haven't figured out:

  • Why in Mixxx for each individual sound device (e.g. TraktorAudio2ChannelA) I've got a choice of 128 channels (see screenshot below), where I would only expect "Channels 1 - 2"

So any comments or tips appreciated!

enter image description here

ALSA configuration file (~/.asoundrc)

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# Native Instruments :: Traktor Audio 2 ALSA Configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#
#    Device                     Channels        Ports
#    ------                     --------        -----
#    TraktorAudio2ChannelA             2         12xx
#    TraktorAudio2ChannelA             2         xx34
#
#    TraktorAudio2ChannelAB            4         1234

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
# TraktorAudio2Channel{A,B} :: Raw 1x1 Stereo Devices
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
pcm.TraktorAudio2ChannelA { type plug; slave.pcm "hw:TraktorAudio2,0,0"; }
pcm.TraktorAudio2ChannelB { type plug; slave.pcm "hw:TraktorAudio2,0,1"; }

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# TraktorAudio2ChannelAB :: Multi 2x2 Stereo Device (Ports 1-4, Channels A+B)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
pcm.TraktorAudio2ChannelAB {
        type multi

        # Bind hardware devices
        slaves.a.pcm TraktorAudio2ChannelA
        slaves.a.channels 2
        slaves.b.pcm TraktorAudio2ChannelB
        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
}