Soundcards How To use Input and Output from your soundcard with almost zero latency/Over/Underruns
  • I am prompted to do this  post based on the numbers of previous questions on how to do a Live Show form your Line In on your soundcard
    The post is not for the faint and require minimal skill.,but if you do not understand it  do not Attempt.


     The procedure for using your sound-card as both input and output in Airtime can be trivial if you are willing to get your hands a bit dirty.
      
    You will need

    To purchase a Linux compatible Soundcard or Mixer (My preference is almost any model from Behringer)

    I will be Using this mixer  X1222usb or my tutorial (the mixer is on the left).

    If you want to just use a second soundcard then any model from the UAC 202 Audio Interface (the Audio interface is on the right) will be good.    

    Do not skimp and buy those cheap less than $10 soundcards from the computer store,although these cost twice more ,they are well worth it

    Behringer make an effort to ensure its products are compatible with All Operating systems and more matter what anyone say,the little loss you incur from behringer products can be made up with plugins and other accessories 

    I have Used Alesis products I have a M-Audio Pro and An Alesis Mixer

    Now lets do some coding 

    Step 1

    First you need to assign a card index number to the USB device (mixer or Audio) interface

    All I did was pick up the vendor and product Id  

    by using the commands

    [ubuntu >14.04]
    aplay -l and usb-devices  

    [ubuntu <14.04]
    aplay -l and lsusb 

    I found this information using usb-devices

     Vendor=08bb ProdID=2902 Rev=01.00
     Manufacturer=Burr-Brown from TI              
     Product=USB Audio CODEC 

    DON'T ASK ME TO EXPLAIN IT  ALL I WANT is vendor and product Id


    Step 2

    DO NOT DO THIS UNLESS YOU BACK UP THE FILE YOU ARE ABOUT TO EDIT.IF YOU DONOT KNOW HOW TO BACK UP THIS IS NOT FOR YOU

    gksu gedit /etc/modprobe.d/alsa-base.conf

    I Then Follow the instructions and  place the following at the bottom of alsa-base conf

    # USB Magic, part 1
    alias snd-card-0 snd-hda-intel
    alias snd-card-1 snd-usb-audio

    options snd-usb-audio index=1 vid=0x08bb pid=0x2902


    Step 3

    Look for the following line:

    options snd-usb-audio index=-2 

    and comment it out.There is two of them you need to comment both

    EXIT and Save (Ctrl+X)

    I found a nice feature here if you remove or have to replace the mixer it normally works with almost any other mixer or interface.However I would advise to make the updated code ASAP




    234 x 216 - 14K
    300 x 300 - 8K
    Post edited by Voisses Tech at 2016-01-05 04:10:26
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • 2 Comments sorted by


  • Step 4
    DO NOT DO THIS UNLESS YOU BACK UP THE FILE YOU ARE ABOUT TO EDIT.IF YOU DO NOT KNOW HOW TO BACK UP THIS IS NOT FOR YOU

    DO NOT REMOVE PULSE AUDIO AS SOME POST WILL TELL YOU.SINCE UBUNTU 12.04 PULSEAUDIO IS intertwine in ubuntu desktop.
    if you want a nightmare then go ahead and remove it.I cannot tell you how to recover,you might find even just removing it may take a day locating all its dependencies and plug-ins for other products


    disabling pulseaudio, 

    you can edit the file /etc/pulse/client.conf and change or add this line:
    autospawn = no

    And kill any running pulseaudio process:
    killall pulseaudio



    Step 5 
     
    DONOT DO THIS UNLESS YOU BACK UP THE FILE YOU ARE ABOUT TO EDIT.IF YOU DONOT KNOW HOW TO BACK UP THIS IS NOT FOR YOU

    for line in

     sudo gedit /usr/lib/airtime/pypo/bin/liquidsoap_scripts/ls_script.liq

    Find somewhere to put your input .I prefer to fall it back from  the main output (s).
    That way I can talk over anything like schedule,autodj or use it as a line in over the original silence in the Airtime.




    the format is 

    mic =input.alsa(id="line in",bufferize=true,device="hw:1")
    mic=strip_blank(max_blank=1.,threshold=-45.,mic)
    s= fallback(id="out_play_fallback",track_sensitive=false,[mic,s])

    if it complains that the source is falliable just make output(s) safe 


    Step 6

    For line output

    Modify the soundcard output in the ls-script to read

    At this line
    if output_sound_device_type == "ALSA" then

    #comment
    #ignore(output.alsa(s))

    #and put
    ignore(output.alsa(id="studio_output",bufferize=true,device="hw:1",s))


    Step 7

    Finally

    Reboot the machine ans if all is well

    push the USB slider up  and your Main mi and as your machine comes up you should some lovely lights

    THAT'S IT



    Post edited by Voisses Tech at 2015-12-25 19:08:01
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.


  • PREAMBLES

    I USED THIS MODEL


    BECAUSE THE USB OUTPUT IS INDEPENDENT OF THE INPUTS. and may be can answer limited questions on it

    YOU CAN USE THE MAIN OUTPUT FOR YOUR TRANSMITTER

    YOU CAN USE AUX  AND AUX SEND FOR YOUR PHONES

    YOU CAN USE FX FOR RECORDING or to put Ardour etc.

    THE POSSIBILITY ARE ENDLESS LIKE INSTALLING MIX AND ROUTING THROUGH ANOTHER SOUNDCARD OR THE MAIN CARD (INDEX 0) OR PREVIEW ANY APPLICATION WITHOUT AFFECTING OTHERS

    IF YOUR NOT FAMILIAR WITH ROUTING CHECK THIS TUTORIAL


    Disclaimer .
    Whilst I recommend behringer as the product I used,this is in no way that you must use those product.

    I am using what i am comfortable with and which worked for me.it might not work for you


    Note using virtual cards did not work for me since I wanted to use both input and output.
    Liquidsoap is very peculiar  about using the same card as input and output and its best to assigned the card type explicitly.

    In Airtime maybe we need another field to say which card were are assigning like  a drop down box for card 1,2,3 etc.The current code only works for default index card zero

    but assigning the cards with the individual index did.

    Pulse audio did worked for me but one day it just stop and I could not find out why.
    You need to install pavucontrol if you need to use pulse audio

    And since they say Pulse Audio is getting better at combing with Alsa,you might want to read this

    https://wiki.archlinux.org/index.php/PulseAudio
     
    THE BIGGEST ISSUE WITH LIQUIDSOAP AND AIRTIME IS THAT THE CARDS ARE SET AT DEFAULT  (0)

    IF YOU ARE USING ALSA  TRY USING THE CARD INDEX THAT RELATES TO YOUR SOUNDCARD

    IF YOU ARE USING PULSEAUDIO INSTALL THE CONTROL,WITH THIS YOU CAN SET THE DEFAULT CARD AND THEN USE THAT AS THE AIRTIME SOUNDCARD



    Post edited by Voisses Tech at 2015-12-31 04:18:05
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.