Introduction

There are many type of hardware setups used in broadcasting. Some use one soundcard using a mixer and some use two soundcards. Some have USB mic's and the variations are endless. One of the questions that arise is how do we get these devices into jackaudio. I hope in this tutorial to outline some of the methods I have used and work in both Slackware and Ubuntu. This is by no means exhaustive but it is a basic primer to the bet of my understanding.

Getting the USB Mic into jack

First lets concentrate on getting the usb mic running and we we will build on the setup as we move on and start getting extra sound cards in also

Step 1

If you are using slackware you will need to open the file /etc/set_rlimits.conf
If you are using Ubuntu you will need to open the file /etc/security/limits.d/audio.conf

The add the following 2 lines to that file and save.

@audio /usr/bin/alsa_in -1 80
@audio /usr/bin/alsa_out -1 80

Step 2

The next thing we need to do is find out which card or name our USB mic is situated on so we use the following command.

arecord -l

card 3: Microphone [Logitech USB Microphone], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

That is the output from my USB mic. As we can see it is card number 3 and its name is Microphone as indicated by the second field. Take note of the card and name of your usb mic.

Step 3

Next we want to get that device into jackaudio conection manager so we are going to modify the following command to suit our paticular mic.

If using slackware: set_rlimits /usr/bin/alsa_in -j Microphone -d hw:3 -q 1 2>&1> /dev/null &

If using Ubuntu: /usr/bin/alsa_in -j Microphone -d hw:3 -q 1 2>&1> /dev/null &

-j Microphone is the name that will appear in jack connection manager. hw:3 is as it is because my card was card 3 you will have to change that to paticular card number rusulting from the arecord -l command.

Step 4

You now should be there. If you go to qjackctl and clik on connect on the left hand side you shoud see an entry called Microphone which is the name we gave it when we issued the alsa_in command. You can now connect that device into one of the idjc input ports. Hope this has been of some assistance to you.

Getting an input from a second sound card into jack

This is the same process as the usb mic really. Take the result of the following command.

arecord -l

Now lets get that card into jack.

For slackware: set_rlimits /usr/bin/alsa_in -j alsa_card2_input -d hw:"yourcardnumberorname" -q 1 2>&1> /dev/null &

For ubuntu: /usr/bin/alsa_in -j alsa_card2_input -d hw:"yourcardnumberorname -q 1 2>&1> /dev/null &

Now go to your jackaudio connection manager and check to see alsa_card2_imput listed on the left column

Getting an output from a second sound card into jack

This is the same process as the previous example with a couple of differences. Take the result of the following command.

aplay -l

Now lets get that card into jack.

For slackware: set_rlimits /usr/bin/alsa_out -j alsa_card2_output -d hw:"yourcardnumberorname" -q 1 2>&1> /dev/null &

For ubuntu: /usr/bin/alsa_out -j alsa_card2_output -d hw:"yourcardnumberorname -q 1 2>&1> /dev/null &

Now go to your jackaudio connection manager and check to see alsa_card2_output listed on the right column

Hardware mixing incase your command stops other applications from using the paticular input or output

This is relativly simple alsa can be very funny sometimes and when an application books alsa for a job it locks the sound card to that application till it is finished. To over come this there are two things we can do depending on whether we want to capture or play. If two applications need to have access to the microphone what we can do is the following.

If using slackware: set_rlimits /usr/bin/alsa_in -j Microphone -d dsnoop:"yourcardnumberorname" -q 1 2>&1> /dev/null &

If using Ubuntu: /usr/bin/alsa_in -j Microphone -d dsnoop:"yourcardnumberorname" -q 1 2>&1> /dev/null &

Take notice of the dsnoop part instead of using hw:"yourcardnumberorname"

If we have two applications that need access to the card then we will call the alsa_out in the following way.

For slackware: set_rlimits /usr/bin/alsa_out -j alsa_card2_output -d dmix:"yourcardnumberorname" -q 1 2>&1> /dev/null &

For ubuntu: /usr/bin/alsa_out -j alsa_card2_output -d dmix:"yourcardnumberorname -q 1 2>&1> /dev/null &

Take note of the dmix call there uses instead of hw:"yourcardnumberorname"

Automating the process

Ok we have messed around with all the commands now and we understand the process but we dont want to have to issue the command each time we want to try and broadcast so we do the following.

Create a file in your home directory or anywhere handy where it can be found. Make it executable. In qjackctl go to setup and the options tab. Tick execute script after startup and browse to the file you just created and click ok.

We are now ready to insert the process we wish to start. The best way I can think of showing you is give you a look at my startup script. Study it and then decide how yours is to be set up since everyones setup up will be slightly different. Please take note of the first line.

#!/bin/sh

You need to have that line in your script..

#!/bin/sh # script loop2jack, located in /usr/local/bin # start idjc /usr/local/bin/idjc & # give it a chance to start sleep 2 # loop client creation set_rlimits /usr/bin/alsa_out -j ploop -dploop -q 1 2>&1 1> /dev/null & set_rlimits /usr/bin/alsa_in -j cloop -dcloop -q 1 2>&1 1> /dev/null & #set_rlimits /usr/bin/alsa_in -j Microphone -d dsnoop:Microphone -q 1 2>&1> /dev/null & # give it some time before connection to system ports sleep 1 # cloop ports -> jack -> idjc voip input ports jack_connect cloop:capture_1 idjc_default:ch_in_l jack_connect cloop:capture_2 idjc_default:ch_in_r #jack_connect Microphone:capture_1 idjc_default:ch_in_1 # done exit 0