AUDIO KONTROL 1 on Linux

Discussion in 'Technical Issues' started by luxin, Sep 4, 2007.

Thread Status:
Not open for further replies.
  1. luxin

    luxin New Member

    Messages:
    4
    Hi folks,

    I just got to know AUDIO KONTROL 1 via the internet and was amazed by what it can do for this relatively low price.

    Now I would like to buy one, but the problem, or better noteworthiness, is that I am a GNU/Linux user (Ubuntu).
    I neither want to go back in evolution and use Windows, nor do I want to use Macintosh.

    So, I am, of course, highly interested in any experience gained with this product on Linux.

    If there is no experience at all, I will ask NI to give me an AUDIO CONTROL 1 for free, and the I'll check things out for this device on Linux. ;)

    This is gonna be a hopefully small step for a man, but would be a giant leap for mankind, I guess. :D
  2. Plangin

    Plangin NI Product Owner

    Messages:
    1,455
    Hi Linux mate,

    good news for you: NI provides native ALSA drivers in the official kernel sources!

    => http://img143.imageshack.us/img143/8895/nialsajl1.png

    I own an Audio 8 DJ and did not compile it, yet. But will test it this week. Ask me if you have any specific questions.

    Best,
    plangin
  3. luxin

    luxin New Member

    Messages:
    4
    Cool thing!

    That sounds good!

    Tell me, how it works, when you have compiled everything.

    By the way, this is a nice graphical Kernel-Menu!

    Just one more question: Which kernel versions do support NI USB-Devices?
  4. iclavijos

    iclavijos New Member

    Messages:
    3
    Any news on this?

    I recently bought a Kontrol 1 and even if when plugging it in I can see it as a recognized soundcard (asoundconf list shows it as A1), I cannot make it work properly, as sometimes I can configure xmms to use it (and it worked fine) but sometimes not.

    Should I do something else? Is there something I should check?

    I'm using Kubuntu Feisty.

    Thanks a whole lot!

    Ivan
  5. luxin

    luxin New Member

    Messages:
    4
    "News"

    Well, which kernel version are you using?
    If you use the standard 2.6.20-xx, you won't find an NI - device driver, as far as I know.

    2.6.22-xx, however, has that driver listed in the config menu.

    Do you know how to compile your own kernel? If so, simply check out the latest version from kernel.org.
    Should work. But I cannot ensure it, since I still haven't bought the device.

    Have fun! And give us a test report!

    If you have any further questions, simply ask. I will stop by here from time to time.
  6. iclavijos

    iclavijos New Member

    Messages:
    3
    Hi there, linuxer.

    Sorry for being silent for so many days, but life can be a bit tough sometimes :p ;)

    Unfortunately, AK1 is not working properly on Linux.

    Yes, I have a 2.6.22-xx kernel and when I plug it in, it is properly detected. See (sorry, the text is in Spanish, but I think it is pretty understandable):

    Code:
    ivan@rst-server:~$ aplay -l
    **** Lista de PLAYBACK Dispositivos Hardware ****
    tarjeta 0: CMI8738MC8 [C-Media PCI CMI8738-MC8],  ...
    
    tarjeta 1: A1 [Audio Kontrol 1], dispositivo 0: Audio Kontrol 1 [Audio Kontrol 1]
      Subdispositivos: 2/2
      Subdispositivo #0: subdevice #0
      Subdispositivo #1: subdevice #1
    
    
    ivan@rst-server:~/mixxx$ cat /proc/asound/cards
     0 [CMI8738MC8     ]: CMI8738-MC8 - C-Media PCI CMI8738-MC8
                          C-Media PCI CMI8738-MC8 (model 68) at 0xb800, irq 21
     1 [A1             ]: snd-usb-caiaq - Audio Kontrol 1
                          Native Instruments Audio Kontrol 1 (serial SN-9BL40N7XET, usb-0000:02:02.2-2)
    
    So, as you can see, it is properly detected by my Kubuntu 7.10.

    The first problem (and I don't know if it's really a problem) is that no red lights on AK1 are working. Neither the jog nor any of the three buttons are light up when I use them (not even when the AK1 is plugged in). Maybe this is a non issue, but the best thing I can do is to just write it down. ;)

    Once the soundcard is plugged in, I configure my system to use it as the default sound card and reboot it just for the sake of it. Once the system is restarted, all of the system sounds can be listened through AK1, but no sound application (amaroK, xmms, audacity...) can use AK1. The error message usually is that "The device is busy".

    Also, the other problem that I have is that even if the system sounds can be heard, sometimes, after rebooting my computer, there is a kind of "cracking" (hard to express in English, sorry) noise when anything is being reproduced through AK1.

    I will try to upgrade AK1 firmware and see if it makes any difference at all.

    Cheers!
  7. noizquake

    noizquake New Member

    Messages:
    17
    Hello,
    I've been trying to get AUDIO KONTROL 1 to work on my Linux laptop for several months now and today I finally made it.
    A guy from the local university helped me and now (nearly) everything works.

    So, here is what we did (as far as I remember):

    <<<

    First of all, some general requirements and information:

    Operating system: I run Debian Lenny on this computer.

    Kernel version: 2.6.22 or higher. We used a slightly customized 2.6.24 vanilla kernel here. However, you do not necessarily have to change the kernel configuration for being able to use AUDIO KONTROL 1.

    ALSA version: 1.0.15 or higher. We used the 1.0.15 Debian packages here. So, you don't need to build ALSA from source.


    Steps we took:


    1. Configuring the kernel (optional)

    Here I just selected the correct processor family and set the preemption model to "Low-Latency Desktop" to reduce latency.


    2. Setting AUDIO KONTROL 1 as the primary soundcard

    NOTE: The device only works if set as primary soundcard. We think that this may be a bug.

    Open a shell, become root and open the file /etc/modprobe.d/sound with an editor of your choice, e.g.
    Code:
    user@debian:~$ su
    Password:
    debian:/home/user# cd /etc/modprobe.d/
    debian:/etc/modprobe.d# vim sound
    
    In there you should read something like this:
    Code:
    alias snd-card-0 snd-x-y
    alias sound-slot-0 snd-x-y
    
    This is data concerning your internal soundcard, which is, at the moment, set as primary audio device (card 0).

    Now, you will have to add the information for AUDIO KONTROL 1 and "swap" the primary and secondary audio device.
    Therefore, the file should then look approximately like this:
    Code:
    #AUDIO KONTROL 1 (primary device)
    alias snd-card-0 snd-usb-caiaq
    alias sound-slot-0 snd-usb-caiaq
    options snd-usb-caiaq index=0
    
    #internal card (secondary device)
    alias snd-card-1 snd-x-y
    alias sound-slot-1 snd-x-y
    options snd-x-y index=1
    
    Save this file.


    3. Testing the new configuration

    Type
    Code:
    aplay -l
    This command should list the two cards.

    Reboot.

    You need a WAVE file in your home directory for testing the sound cards.

    To check things out, type (in normal user mode)

    Code:
    aplay -D hw:1 [yours].wav
    If you hear something now, your internal audio device (card 1) still works.

    Now, it's time to check out AUDIO KONTROL 1:
    Code:
    aplay -D hw:0 [yours].wav
    If that gives you sound, AUDIO KONTROL 1 (card 0) has been sucessfully installed as your primary audio device. :D

    So, now you can go on solving the next "problem": Making your programs use the soundcard of your choice.


    4. Giving names to your cards (optional)

    This is just something we found useful during the configuration process.
    And it is probably a good thing to do if you have more than 2 cards.

    As I wrote, to test a sound card via aplay, you will have to specify the device (except for the primary one).
    So if you wanted to address the secondary card (card 1), you would have to type
    Code:
    aplay -D hw:1 ...
    Now imagine, you have 5 sound cards. Then it would be more comfortable to be able to simply type
    Code:
    aplay -D AK-1 ...
    or
    Code:
    aplay -D RME ...
    because then you don't have to keep the device numbers in mind.

    For this reason, open a shell and create a file called .asoundrc in your home directory.
    Code:
    user@debian:~$ vim .asoundrc
    In this file you can now specify aliases for you cards.
    Mine looks like this:
    Code:
    pcm.usb {
            type hw
            card 0
            }
    
    ctl.usb {
            type hw
            card 0
            }
    
    pcm.internal {
            type hw
            card 1
            device 0	#i am not really shure about devices
            subdevice 0     #and subdevices, but as far as now, everything works
            }
    
    ctl.internal {
            type hw
            card 1
            device 0
            subdevice 0
            }
    
    So, if I want so address my secondary/internal sound card via aplay, I simply type
    Code:
    aplay -D internal [soundfile]
    >>>

    So far that's it.

    What still doesn't work is the beautiful red light AUDIO KONTROL 1 normally shows.

    I hope this post is useful to people who want to run this card under Linux.
    If you have any problems or hints, simply post back.

    noizquake
  8. iclavijos

    iclavijos New Member

    Messages:
    3
    Thanks a whole lot, noizquake!

    Unfortunately I have my Linux desktop broken (motherboard most probably), but as soon as I get it back, I will follow these steps and report you back my results.

    Thanks again for this (I have started thinking about selling AK1).
  9. conque

    conque Forum Member

    Messages:
    22
    There was an update in the ALSA driver recently which enables all input controllers (as Linux input device) as well as all the LEDs (using ALSA's mixer control interface). So you can go ahead an either write your own applications for those devices or use them to control applications as far as they already suport that. In my tests, I used the jog dial of AK1 to select colors in GIMP :)

    Best regards,
    Daniel
  10. noizquake

    noizquake New Member

    Messages:
    17
    Nice to see the device is working for you!

    I must say that I am facing rather big problems getting my software to use AK1.
    Audacious simply doesn't play anything with it and Audacity even crashes.
    On the other side, all the native GNOME audio software simply uses AK1 without complaining.

    Did you face similar problems? If yes, how did you solve them? (can provide more info on that if needed)

    I also updated ALSA a while ago. I use the 1.0.16 Debian packages now.
    The red light still doesn't work, as well as the jog, i suppose.
    Did you build ALSA from source?

    One more question: Does AK1 work as secondary audio device on your computer oder did you also have to set it as primary?
  11. conque

    conque Forum Member

    Messages:
    22
    Hi,

    Audacity indeed seems to have a problem, yes. But not necessarily with that hardware only - I'll do some more tests.

    What about aplay and arecord? xmms?

    I released another 2 patches the last days on the alsa-devel mailing list. You should either manually install them in case you know how that works or wait until offical kernel versions with that patches are released. Sorry for not offering you a more convenient way.

    Well, it does work. All controls and all LEDs are supported on all NI devices. try this:

    Code:
    $ amixer  controls
    For AK1, this should return

    Code:
    numid=1,iface=HWDEP,name='LED left'
    numid=2,iface=HWDEP,name='LED middle'
    numid=3,iface=HWDEP,name='LED right'
    numid=4,iface=HWDEP,name='LED ring'
    Other devices show different output, of course.
    But for AK1, to switch on the ring, type

    Code:
    $ amixer cset numid=4 1
    to switch it off:

    Code:
    $ amixer cset numid=4 0
    If the above doesn't work, you don't have the most current kernel module running.


    No, it works as both primary and secondary. You simply need to tell your applications which device to use in this ALSA-specific way:

    plughw:0,0,0 means "card 0, device 0, subdevice 0"

    If your AK1 is not card 0 (see /proc/asound/cards), you need to provide a different number as first parameter. For the time being, all NI devices only have one ALSA "device", so the 2nd number is always 0. If you wanna play to the outputs 3&4, choose 1 as last parameter.

    Hope that helps a bit.

    Best regards,
    Daniel
  12. conque

    conque Forum Member

    Messages:
    22
    linux support feedback

    Hi,

    for all further problem reports, please attach an output of the following command (to be entered in a terminal window) to clarify which version of the driver you're actually using:

    Code:
    /sbin/modinfo snd_usb_caiaq | grep ver
    Thanks and best regards,
    Daniel
  13. noizquake

    noizquake New Member

    Messages:
    17
    Hi Daniel,

    first of all thanks for your support.

    I've tested the things you suggested and was partly successful.
    Here's my report:

    First, setting AK1 as the secondary device now works and probably also did before.
    The problem was that I always used hw:1,0,1 instead of plughw:1,0,1 to address the device.
    How come that I have to say "plughw" here?
    I mean, the expression "hw:0" perfectly works for my internal sound card (Intel HDA).
    For example, when I create a dial-up connection with my winmodem (respectively a linmodem now), I tell the programm to use "hw:0,6".

    Second, some of my software is now able to access AK1 for playing or creating music. Things work well for Audacious and Linux Multimedia Studio.
    By the way: Using arecord seemed to work in the first place (the input LED was lighting up), but when I listened to what I recorded, there was just silence.
    I then openened the file with Audacity: Nothing. Just one straight line at 0dB.

    Audacity itself simply doesn't seem to work with AK1. I mean, probably it does, but how do I tell it that AK1 is not "hw:1,0,x" but "plughw:1,0,x"?
    I haven't found a way yet.
    The same holds for Alsa Modular Synth. But I guess these two apps do not run stable on my system at the moment. I'm getting xruns all the time, especially with the synth.
    That even leads to a kernel panic sometimes.
    Hopefully, this problem will be gone after installing my new Debian system.

    Third, I also tried to access the control lights of AK1 as you described but it did not work for me:
    Code:
    noizquake@batman:~$ amixer -D hw:1 controls //plughw didn't work in this case
    noizquake@batman:~$
    
    noizquake@batman:~$ amixer -c 1 controls
    noizquake@batman:~$ 
    
    Last but not least, the driver version info you requested:
    Code:
    description:    caiaq USB audio, version 1.2.0
    vermagic:       2.6.24.2-noizquake SMP preempt mod_unload CORE2
    P.S.: As I don't really know how to patch my kernel, I will simply have to wait for an offcicial version including your updates.
    Any idea how long this going to take?

    noizquake
  14. twistedpickles

    twistedpickles Forum Member

    Messages:
    147
    Oh this is !fantastic! I am a linux N3rd and this seems like a great way to pass my time.
  15. conque

    conque Forum Member

    Messages:
    22
    plugwh enables a certain layer in the ALSA system which cares for conversion of channels and sample formats. If your application uses the same layout for samples than your hardware does, you can go for hw:, otherwise you should choose plughw:.

    what about that command:

    Code:
    arecord -f cd -D plughw:DJ,0,0 | aplay -D plughw:DJ,0,0
    It should capture the input and echo the output straight away without recording to a file. Does that work for you?

    1.2.0 is a version which does not support setting of the controls, sorry. We are at version 1.3.6 at the moment which also corrects the order of input channels (they're twisted in the version you run) as well as sudden lockups of the whole system.

    As patching your own kernel requires quite some inside knowledge, I'd like to ask you to wait until your favorite distribution vendor comes along with a newer version. Not sure yet whether the 1.3.6 version will make it to Linux' official kernel release 2.6.25. You probably have to wait until 2.6.26-rc2 or -rc3. I'll post here as soon as things get merged.

    Daniel
  16. conque

    conque Forum Member

    Messages:
    22
    Ok guys, the most current version of the driver (1.3.6) was included into the current release candidates of Ubuntu 8.04, even though they run Linux kernel 2.6.24. The patches were pushed into their tree manually, not via the official kernel repositories. I guess this driver will become part of 2.6.26-rc1 or -rc2.

    So everyone who does not want to compile an own kernel can just go ahead and install that very piece of software to give it a try. http://www.ubuntu.com/

    Best regards,
    Daniel
  17. noizquake

    noizquake New Member

    Messages:
    17
    Ok, my hardware in this case is AK1. How can I tell an application to use the same sample layout as AK1(generally)?


    That works indeed, BUT:

    1.
    There is a latency of about 1s and every sound I direct through the device get's some kind of a delay effect. (repetitions with declining volume)
    The first issue is probably due to kernel configuration since it occured on all of my computers and they are not running as low latency desktops at the moment.
    But what about the delay?

    2.
    When I plug my guitar amp into AK1, I get some chaotic high frequency noise.
    If I move the cursor over my desktop in addition to that things get totally out of control (in terms of unwanted noise) - just beeping and crackling.
    I tried the same command with the internal soundcard of my desktop computer (cheap intel stuff) and there was nearly nothing to be heard apart from what I played.
    Could that be because of the old driver version I am using?

    Nice to hear that. But still, this really going to take a while, isn't it?
    At the moment, kernel.org states the latest stable kernel version is 2.6.25.

    So well, how do I patch the kernel? I think I really want to try this. ;)

    P.S.: NI should probably update the Linux compatibility page now, telling people either to use the latest Ubuntu, wait until kernel 2.6.26 or patch the kernel by themselves and - most importantly - not to use the driver version included in kernel 2.6.22 and it's follow-ups if they want things to just work.
  18. conque

    conque Forum Member

    Messages:
    22
    That depends on the application. In general, you have to tell the application to use 24bit samples in 3 bytes, little-endian encoded, 2 channels per stream. That's a thing you normally don't want to care about, hence plughw is the better way to go.


    That command is just for testing. It uses your shell's pipe mechanisms which have large buffers, hence the latency. No worries, that's not related to the driver. It is, however, a good setup to test the channel mapping and see whether all inputs and output are functional.

    However, I can't explain the delay you describe. Could you take the efford and record the output for me?

    No, thats not related to the driver version but rather to the rest of your setup. The noise you describe usually comes from bad USB power supply, i.e. noise generated from other components poisioning the power used by the device to drive its input and output stages. You could prevent that by using a powered USB hub, many others have successfully eliminated similar effects by that.

    http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html

    These are the patches to be applied on top of the current 2.6.25 kernel sources (the order matters):

    http://article.gmane.org/gmane.linux.alsa.devel/52464
    http://article.gmane.org/gmane.linux.alsa.devel/52496
    http://article.gmane.org/gmane.linux.alsa.devel/52513

    Daniel
  19. noizquake

    noizquake New Member

    Messages:
    17
    I'll try to get that done in the next days...

    Ok, so I'll just try to fix it that way.

    Just some more questions about those patches:

    1.
    I was just wondering about the file types and names of the downloaded patches: The attachment notes in the articles always state that the file is called something like snd-caiaq-1.3.x.diff. But when you download it, you get something like 52464-001.bin.
    Is that okay? I mean can I simply apply those files as patches like you normally do?
    And second: Can I rename them before just to keep track of the correct order?

    2.
    You probably know about the RT Preemption Patch provided by kernel.org.
    I mean, currently there is none for 2.6.25. But in the near future there will be one, certainly.
    So, if I also want to use that patch, what should I apply first: The caiaq patches or the real time patch?


    Last but not least, another problem with Audacious:
    When I use that audio player with AK 1, it often happens that when I stop one song and immediately start to play another, the whole system totally freezes.
    That error occurs with AK 1 only, not with my internal audio device.
    Any idea why that is?

    Thanks for the support so far!
  20. conque

    conque Forum Member

    Messages:
    22
    Yes. The content matters.

    Yes, the patch utility doesn't care about the name.

    As they touch entirely different files, you can do it both ways around. It's just that the 3 patches I postet depend on each other, so they have to be lined up correctly.

    That is fixed by one of the 3 patches. Shouldn't happen any more as soon as you got your patched kernel up and running. One more motivation, isn't it? :)

    Daniel
Thread Status:
Not open for further replies.

Share This Page