1. Hi everyone,

    This forum is now closed for posting! If you require technical support from NI or have a questions about activating your product, please head over to our new Support Community!

    NATIVE INSTRUMENT SUPPORT COMMUNITY

    The Support Community is the new location where you can expect to receive assistance and feedback on technical support, sales or installation issues from our Support Agents and other users.

    Please also note, questions about the status of an order should always be directly sent to our Order Support team HERE.

    Best wishes, 
    The NI Team

invoking jackd, proper syntax

Discussion in 'Technical Issues - KOMPLETE (Archive)' started by rumdog, Nov 11, 2008.

  1. rumdog

    rumdog New Member

    Messages:
    7
    Hello all,

    I have been browsing the forums, and have found them to be quite informative in place of actual documentation, however as someone quite familiar linux, I'm used to it by now.

    My question actually concerns the audio 8 DJ interface, however after perusing the categories for quite some time, I felt this was the requisite place to start the thread.

    I noticed that since we must use alsa's plugin layer, in place of the hardware layer, each time we wish to access the device we must use plughw:DJ,0,x, instead of just hw:DJ. This however complicates both accessing the device from various programs, and invoking jack.

    We could use jack normally (with -d hw:DJ ) to get 2 ins and 2 outs off channel A,, which is identical to to invoking jackd using the plugin layer, like this...

    Code:
     jackd -d alsa -d plughw:DJ,0,0 -n2 -i2 -o2 
    Or we could use the same command in a different way to give us 2 in's and 2 outs off Channel B like this...

    Code:
     jackd -d alsa -d plughw:DJ,0,1 -n2 -i2 -o2 
    But I can't figure out how to invoke jackd to give a route FROM channel A TO channel B. As I know it is impossible to have two simultaneous instances of jack because of how it is made, the answer must be to invoke jackd in such a way as to get all 8 channels, (excluding the mic, and the headphones) up and working in jack. So that I can do

    Code:
    jackd -d alsa ....... -n2 -i8 -o8
    and have that work properly.

    Also, I have figured out that device 0 subdevice x, (x=0,1,2,3) means duplex channels, but what is device 1? and are there any other routing tricks I can use with the plugin layer?

    Sorry to post such a long question, but I'd really appreciate any help somebody could give me.

    Thank you
     
  2. ib0t

    ib0t New Member

    Messages:
    2
    Same Problem here..

    Did You find any solution already?

    bye,
    i.
     
  3. rumdog

    rumdog New Member

    Messages:
    7
    Not yet....

    Well I have to say its a relief to see that I am not alone in this world.

    I'm not really any closer to finding a solution per se... Even after rewriting my .asoundrc again I can still only reroute sound within a given channel, as opposed to from channel to channel on jack.

    Additionally I am having the same problem in PD, because since the only way to get the cards inputs to show up properly is to "slave" them and then give them card0.DJ , card1.DJ , etc... clones within .asoundrc. This is all well and good where making them appear is concerned, but anyone who has ever used PD will know that when we take a route from one virtual card to another PD will not like that, even if their clocks are sync'd.

    Anyway, I'll still be hammering away at it in the meantime.. I'm sure the solution isn't far off....

    Conque (Dave), what do you have to say about this?

    Rumi.
     
  4. rumdog

    rumdog New Member

    Messages:
    7
    SOLVED:: jackd ....

    if anyone is interested... I solved the problem.

    Like I thought, I had to tweak my .asoundrc to accomodate a multiple mapping: ie, using two cards as one. To use this you must have a jack version greater than 0.102.20 , which supports MMAP_COMPLEX.

    here is a copy of my .asoundrc for anyone interested....

    Code:
    
    pcm_slave.DJ0 {
    	pcm "hw:1,0,1" 
    }
    
    
    pcm.usb {
    	type plug
    	slave DJ0
    }
    
    ctl.usb {
    	type plug
    	slave DJ0
    }
    
    
    pcm.multi {
        type multi;
        slaves.a.pcm "hw:1,0,0";
        slaves.a.channels 2;
        slaves.b.pcm "hw:1,0,1";
        slaves.b.channels 2;
        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;
    }
    
    ctl.multi {
        type hw;
        card 0;
    }
    
    pcm.ttable {
        type route;
        slave.pcm "multi";
        ttable.0.0 1;
        ttable.1.1 1;
        ttable.2.2 1;
        ttable.3.3 1;
    }
    
    ctl.ttable {
        type hw;
        card 0;
    }
    
    
    Then to invoke jack simply do....

    Code:
     
    
    jackd -R -r 96000 -d alsa -d ttable -p 1024
    
     
    this configuration will add channel A and channel B inputs in duplex mode. To add more inputs (upto 8) simply extend the codeblocks slave.n.pcm "hw:1,0,x" upto x=4 and create bindings and a ttable entry for each one.

    This configuration was tested with PD, ardour and mixxx (which uses a crappy pulseaudio plugin layer) and works flawlessly.

    Hope somebody finds this helpful...

    Rumi.
     
  5. N_Systems

    N_Systems New Member

    Messages:
    2
    NI Audio 8 DJ :: asoundrc (Plug-n-Play)

    Looks like the hivemind is in effect ;)

    I got my audio 8 two days ago and after some heavy research (mixed with a fair amount of play) managed to put together a fairly comprehensive .asoundrc file that supports USB 'plug-n-play'...

    There are issues with using absolute hardware references ("hw:1,0,0") with USB devices. Lots of things can affect the numeric device ordering of a USB device; moving the device do a different hub, the order in which usb devices are powered on, etc... :( The solution is to reference the card by it's 'official' ALSA card name ("card DJ") and the system will auto-detect the bus ID :cool:

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

    The following .asoundrc file snippet has several definitions for practicality and completeness. The defined devices are as follows:
    • dj_ch_[a-d] -- 1x1 Stereo Devices for Single Channels (A-D)
    • dj_1234 -- 2x2 Stereo Device -- Ports (1-4) -- Channels (A+B)
    • dj_5678 -- 2x2 Stereo Device -- Ports (5-8) -- Channels (C+D)
    • dj_8 -- 4x4 Stereo Device -- Ports (1-8) -- Channels (A+B+C+D)

    ~/.asoundrc
    Code:
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # Native Instruments :: Audio DJ-8 ALSA Configuration
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #
    #    device     channels        ports
    #    --------   ---             ---------
    #    dj_ch_a    2               12xxxxxx
    #    dj_ch_b    2               xx34xxxx
    #    dj_ch_c    2               xxxx56xx
    #    dj_ch_d    2               xxxxxx78
    #
    #    dj_1234    4               1234xxxx
    #    dj_5678    4               xxxx5678
    #
    #    dj_8       8               12345678
    #
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # dj_ch_(a-d) :: Raw 1x1 Stereo Devices
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    pcm.dj_ch_a { type hw; card DJ; device 0; subdevice 0; channels 2; }
    pcm.dj_ch_b { type hw; card DJ; device 0; subdevice 1; channels 2; }
    pcm.dj_ch_c { type hw; card DJ; device 0; subdevice 2; channels 2; }
    pcm.dj_ch_d { type hw; card DJ; device 0; subdevice 3; channels 2; }
    
    
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # dj_1234 :: Multi 2x2 Stereo Device (Ports 1-4, Channels A+B)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    pcm.dj_1234 {
            type multi
    
            # bind hardware devices
            slaves.a.pcm dj_ch_a
            slaves.a.channels 2
            slaves.b.pcm dj_ch_b
            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
    }
    
    
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # dj_5678 :: Multi 2x2 Stereo Device (Ports 5-8, Channels C+D)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    pcm.dj_5678 {
            type multi
    
            # bind hardware devices
            slaves.c.pcm dj_ch_c
            slaves.c.channels 2
            slaves.d.pcm dj_ch_d
            slaves.d.channels 2
    
            # bind channels to virtual device
            bindings.0.slave c
            bindings.0.channel 0
            bindings.1.slave c
            bindings.1.channel 1
            bindings.2.slave d
            bindings.2.channel 0
            bindings.3.slave d
            bindings.3.channel 1
    }
    
    
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # dj_8 :: Multi 4x4 Stereo Device (Ports 1-8, Channels A+B+C+D)
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    pcm.dj_8 {
            type multi
    
            # bind hardware devices
            slaves.a.pcm dj_ch_a
            slaves.a.channels 2
            slaves.b.pcm dj_ch_b
            slaves.b.channels 2
            slaves.c.pcm dj_ch_c
            slaves.c.channels 2
            slaves.d.pcm dj_ch_d
            slaves.d.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
            bindings.4.slave c
            bindings.4.channel 0
            bindings.5.slave c
            bindings.5.channel 1
            bindings.6.slave d
            bindings.6.channel 0
            bindings.7.slave d
            bindings.7.channel 1
    }
    

    To use the 1X1 devices with jack...
    Code:
    jackd -d alsa --device dj_ch_a
    jackd -d alsa --device dj_ch_b
    jackd -d alsa --device dj_ch_c
    jackd -d alsa --device dj_ch_d
    To use the 2X2 devices with jack...
    Code:
    jackd -d alsa --device dj_1234 -i 4 -o 4
    jackd -d alsa --device dj_5678 -i 4 -o 4
    To use the 4X4 device with jack...
    Code:
    jackd -d alsa --device dj_8 -i 8 -o 8
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Hopefully all the new Audio 8 DJ Linux users will find all this useful.

    Djoma Agoro-Ombaka
    Project Manager

    N-Systems Software


    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PS: If the NI support staff are reading this;

    Come on guys? How hard would it have been for the NI dev team to work this out and post it to the ALSA wiki or this forum? If a single 3rd party pro-dev can work out a portable solution in a few hours, without any prior experience with ALSA or .asoundrc files. I would think that NI's team of pro-devs could have done this for all of the 'linux supported' products in an hour or two...

    That being said;
    I absolutely love my new DJ 8! I also really appreciate NI's contributions to the ALSA and Kernel code bases. As a developer, native hardware support was a major factor in my purchasing decision. I would just like to see a tiny bit more end user support :D

    Hmmm... If NI is willing to send me some gear to test I'll gladly do some linux dev as barter... just a thought :D
     
    Last edited: Nov 23, 2008
  6. rumdog

    rumdog New Member

    Messages:
    7
    nicely done.....

    Word,

    All very pertinent points....

    But have you noticed that unless you switch the sampling rate calling....

    Code:
    jackd -D plughw:x,x,x  -r [SAMPLING RATE] 
    
    to switch the internal clock on the card, you end up getting huge Xruns, followed by a message to the effect of "delay of at least xxxx nS"


    I suppose what I'm asking is: Short of invoking and then killing jackd to change the rate, is there some way I can use alsactl to switch the rate on the card?

    Or have you even encountered this problem?

    Cheers,

    and thank you for posting your .asoundrc, I'm sure it will help many would be users in the future ;) .....

    Rumi.
     
  7. N_Systems

    N_Systems New Member

    Messages:
    2
    The settings I'm using to start JACK are:
    Code:
    /usr/bin/jackd -p128 -dalsa -r44100 -p128 -n8 -D -Cdj_8 -Pdj_8 -S -i8 -o8
    With that startup string I don't receive any xruns. Although, I did encounter the soft xrun issues you're talking about when I was starting JACK by addressing the hardware directly 'hw:2,0,0' or 'plughw:2,0,0'.

    Mind you, that with my .asoundrc if I don't specify 44100Hz and 16bit JACK will not start.

    As for the question about changing the card rate... I'm not sure I understand what the end goal of starting jack to change the rate and then shutting it down is?


    Hmmmm.... I'm not sure my reply is all that usefull :eek:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Djoma Agoro-Ombaka
    Project Manager

    N-Systems Software
     
  8. DJ_Saku

    DJ_Saku New Member

    Messages:
    2
    Thank you N_Systems. You have helped me out greatly. Your asoundrc file works... almost.

    I just have a problem now with the channels. I am using the latest build of Mixxx and I ran into problems getting it to work, but mostly because of the channels.

    It seems that channel 7/8 is used for the headphones only, however, with channel a, when the song is playing, the output for 1/2 lights up and when I scratch, the input for 1/2 lights up, but nothing happens. Also, I would need to set up my asoundrc to also use the built in sound card, too. Also, my mixer doesn't seem to work either. Moving the slider does nothing. Is that a Mixxx problem or do I need to further tweak the asoundrc file?
     
  9. rryan

    rryan New Member

    Messages:
    1
    Rumi, PortAudio is different from PulseAudio. PortAudio is a cross-platform audio API which Mixxx relies on to have reliable low-latency audio in Linux, Mac, and Windows. PulseAudio, on the other hand, is an audio daemon for Linux, similar to ESD or Arts. Mixxx has nothing to do with PulseAudio.
     
  10. ib0t

    ib0t New Member

    Messages:
    2
    rumdog & N_Systems: its so cool you figured out the solution! THX a lot!

    I was really in a bad mood about really trying to buy some piece of Hardware which is in the compatibility-chart and than don't find any hint how to configure it well.

    - ib0t
     
  11. rumdog

    rumdog New Member

    Messages:
    7
    Sorry, ive been out of the loop for so long, I've been busy with finals ;)

    N_Systems, I am equally perplexed by that xrun problem, I have used many unconventional jackd and asound settings and have never before encountered such a problem, but thank you very much for your input, it is always much appreciated.

    Sorry rryan, you are quite right, that was a typo. It should have read PortAudio.

    Regards,

    rumdog
     
  12. DJ_Saku

    DJ_Saku New Member

    Messages:
    2
    I finally got it working with the help copper from ALSA's IRC channel. He wanted me to make sure to let you guys know that the asoundrc file is slightly wrong.

    You should always call it with 'type plug' instead of 'type hw'. He gave me this snippet and it just worked beautifully.
    Code:
    pcm.djA { type plug; slave.pcm "hw:1,0,0"; }
    pcm.djB { type plug; slave.pcm "hw:1,0,1"; }
    pcm.djC { type plug; slave.pcm "hw:1,0,2"; }
    pcm.djD { type plug; slave.pcm "hw:1,0,3"; }
    However, I did still have a problem when closing Mixxx, but that is either a portaudio issue or mixxx issue and it's not that big of a problem.
     
  13. Jayden

    Jayden New Member

    Messages:
    1
    Hi everyone,

    I am having difficulties to use AK1 with jackd in Windows XP environment, does anyone know how to invoke jackd in windows environment? thanks in advance
     
  14. triune

    triune NI Product Owner

    Messages:
    97
    b e a utiful

    After mucking around with getting this to work for a few days, I thought I'd share my work here to show what I did to get teh A8DJ going in Ubuntu Lucid:

    1) add these values to /etc/security/limits.conf at the end of the file:

    @audio - rtprio 95
    @audio - memlock 512000
    @audio - nice -19

    2) added myself to the audio group.

    3) made this .asoundrc:

    pcm_slave.DJ0 { pcm "hw:1,0,1" }

    pcm.usb {
    type plug
    slave DJ0
    }

    ctl.usb {
    type plug
    slave DJ0
    }


    pcm.multi {
    type multi;

    slaves.a.pcm "hw:1,0,0";
    slaves.a.channels 2;

    slaves.b.pcm "hw:1,0,1";
    slaves.b.channels 2;

    slaves.c.pcm "hw:1,0,2";
    slaves.c.channels 2;

    slaves.d.pcm "hw:1,0,3";
    slaves.d.channels 2;

    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;

    bindings.4.slave c;
    bindings.4.channel 0;
    bindings.5.slave c;
    bindings.5.channel 1;

    bindings.6.slave d;
    bindings.6.channel 0;
    bindings.7.slave d;
    bindings.7.channel 1;
    }

    ctl.multi {
    type hw;
    card 0;
    }

    pcm.ttable {
    type route;
    slave.pcm "multi";

    ttable.0.0 1;
    ttable.1.1 1;

    ttable.2.2 1;
    ttable.3.3 1;

    ttable.4.4 1;
    ttable.5.5 1;

    ttable.6.6 1;
    ttable.7.7 1;
    }

    ctl.ttable {
    type hw;
    card 0;
    }


    4) made sure my device was plugged into a port on the pc, not on a port from a hub (if your on a hub... you'll get loads of crackles/pops)

    5) invoked jack with this command:

    /usr/bin/jackd -r -nDJ8 -dalsa -r 96000 -p256 -i8 -o8 -dttable


    There you go... 2.7ms latency, 4x4 channels to play with and no xruns :)
     
  15. Keir @ NI

    Keir @ NI Community, man NI Team

    Messages:
    2,638
    Thread re-opened by request of Schprocket.
     
  16. Schprocket

    Schprocket New Member

    Messages:
    17
    Thanks Keir!

    I'd been struggling to find information on how to set up my Kore Controller 1 interface in linux.

    I can (at the moment) only get the two input channels and only one pair of the device's output channels exclusively, as opposed to selectively choose between 1&2 Out or 3&4 out within an app as one can in Windows and OSX.

    I'm hoping to be able to reverse-engineer the .asoundrc files posted above to work with the Kore 1 and then post the result here.

    The intent of the thread being sticky is so that any other linux user wanting to find or post how to setup JACK for their particular piece of NI hardware only have to go to one spot in the NI forum, rather than trawl through using search and some hit-or-miss terms.
    As an example, I only found this thread by typing linux + JACK in the search - linux + Kore Controller wasn't as helpful.

    If anybody has already got an .asoundrc file for a particular piece of NI hardware cranking (especially for Kore 1! :) ), please feel free to share it here!

    Cheers,

    Schprocky
     
  17. Schprocket

    Schprocket New Member

    Messages:
    17
  18. Schprocket

    Schprocket New Member

    Messages:
    17
    Kore Controller 1 under linux - finally!

    Finally, over nearly a week, with help from trulan over at the AV Linux forum, paul, seablade and oof over at ardour, this forum, and the .asoundrc how-to, I've cobbled together an .asoundrc file that I'm satisfied with for use with Mixbus under linux.

    Code:
    # create a device called multi to combine the separate devices
    pcm.multi {
            type multi;
            # bind the 'separate' Kore hardware devices
            slaves.a.pcm "hw:0,0,0"
            slaves.a.channels 2
            slaves.b.pcm "hw:0,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 needs to 'see' a mixer defined for a device
    # even when there isn't a software mixer as is the case with this device
    ctl.multi {
    	type hw
    	card 0
    }
    
    # this is the bit of magic... defining the 'card' we're going to use!
    pcm.jack2x4 {
         # "asym" allows for different handling of in/out devices
         type asym
         playback.pcm {
              # route for mmap workaround
              type route
              slave.pcm "multi"
              ttable.0.0 1
              ttable.1.1 1
              ttable.2.2 1
              ttable.3.3 1
         }
         capture.pcm {
              # 2 channels only
              type hw
              card 0
         }
    }
    
    # define a non-functioning mixer for jack2x4 for JACK's benefit
    ctl.jack2x4 {
         type hw
         card 0
    }
    
    To invoke this setup through qjackctl:
    1. Modify the alsa-base.conf file in etc/modules.d so that the Kore Controller is always card 0. This is most important!
    2. Save the code above to a file called .asoundrc in your home directory.
    3. Open qjackctl, click on setup, look for the word Interface: and in the space next to it type jack2x4
    4. Close the setup dialog and press Start on the main qjackctl panel. Check the messages - there should be no warnings.


    It's not pretty in terms of naming convention, but say if you wanted to call Kore in JACK instead of jack2x4 (two-by-four.. geddit?:p ), just substitute every instance of jack2x4 with Kore in the .asoundrc file.
     
  19. triune

    triune NI Product Owner

    Messages:
    97
    Nice to see others with working NI hardware in Linux!

    So, I upgraded to 12.04 from 10.04 and I found my old .asoundrc no longer worked. The reason for this is that I was using hw1:0 and in 12.04, the newer version of ALSA creates a loopback device on that hardware device, so instead you have to use hw2:0.

    Here's my updated .asoundrc for my Audio8DJ :

    pcm.multi {
    type multi;

    slaves.a.pcm "hw:2,0,0";
    slaves.a.channels 2;

    slaves.b.pcm "hw:2,0,1";
    slaves.b.channels 2;

    slaves.c.pcm "hw:2,0,2";
    slaves.c.channels 2;

    slaves.d.pcm "hw:2,0,3";
    slaves.d.channels 2;

    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;

    bindings.4.slave c;
    bindings.4.channel 0;
    bindings.5.slave c;
    bindings.5.channel 1;

    bindings.6.slave d;
    bindings.6.channel 0;
    bindings.7.slave d;
    bindings.7.channel 1;
    }


    ctl.multi {
    type hw;
    card 0;
    }


    pcm.ttable {
    type route;
    slave.pcm "multi";

    ttable.0.0 1;
    ttable.1.1 1;

    ttable.2.2 1;
    ttable.3.3 1;

    ttable.4.4 1;
    ttable.5.5 1;

    ttable.6.6 1;
    ttable.7.7 1;
    }


    ctl.ttable {
    type hw;
    card 0;
    }
    ---
    Oh yeah, and I almost forgot... if you're going to all this length to setup your hardware, you may as well use some superb software to control your hardware. In that case, I would recommend using Gladish to setup and maintain your jackd client and manage all your jack routing/connections. This app is 100x better than qjackctl.
     
  20. jeffo

    jeffo NI Product Owner

    Messages:
    49
    I'm a Linux beginner - not quite n00b, but close ;)

    I have an audio8, but I have no idea what asoundrc or anything else is. I'm running mint 15, based on Ubuntu 13. Can anyone give me a rec - do I need to copy / paste what code into what file?

    everyone here seems to have different codes going on.

    Thanks!
    Jeff