audio in linux (Howto) (3.Try to mail to the Mailingslist, see PS's at Bottom)

Der Lockruf des Kaos Der_Lockruf.des-Kaos at gmx.net
Sun Nov 14 10:41:41 PST 2004


I've found that Wrap Function, was set too 200, it's now adjusted to 72.
What's this Count on other Mailinglists?
Is this always 72?

> Have you considered writing us ordinary mortals a Sound hint? :-)
Like the "KillerBean" would say: "That's how i was planning to do it!"
;)

It took me very much Time too get all this to work.
The initial Intention was, that i had Windows 2000 installed once upon a
Time and only could bypass AC3 Sound from the DVD Drive to my Receiver
over a coaxial Cable with my Soundblaster Platinum. So to say not very
pleasant. Since 2-3 Years i have no Windows on any Partitions. And now i
have a Terratec DMXFire which can playback a AC3 File so that my
Receiver recognize it as AC3 Stream which my Soundblaster never
could.I often reached Points, where only a few People already went, but
this is true for all of us i think. That was the Case for this Problem
too. I always think that under Linux you can make everything at least
as good as under Windows xyz. So i had much Motivation, though it took
me Months too breakthrough. I wasn't sitting everyday on this Problem
but often and gave up several Times and retried it again some Time
later. That's the best Way too learn Things, because you can go two
Steps back and try another or similar Way to reach the Goal. Hm that
said i think it would be a good Start if i post the the Apps i compiled,
how i compiled them and whatfor i need them like the LFS/BLFS Books told
it too me, sort of giving back something to the Community.(It would be
great, if it becomes a useful Howto, to post it not only too this
Mailinglist but somewhere else where People not on this List can make
Use of it. But i don't know where. Any Suggestions? The BLFS Book
doesn't contain such Howto as far as i see, or am i wrong?)

Sadly i doesn't find my Notes, that i wrote down, i at least thought i
wrote it down, but anyway, i of course know what i installed and how and
why. So here we go:

AH, by the Way if you have no AC3 Receiver you can still use all the
Jack-Stuff but instead of ac3jack you only use some other Device, for
example the normal ALSA Device, that works fine too. But for now i will
explain all Things for AC3. ;)


ALSA:
cvs -z3 -d ':pserver:anonymous at cvs.alsa-project.org:/cvsroot/alsa' co -P
.
alsa-driver	(< 2.4 Kernel, contained in 2.6+)
alsa-lib
(alsa-utils)

____________________________
alsa-tools_envy24control:
For my Terratec DMXFire, here i set everything so that the Soundcard
sends the Data over the optical Cable as AC3 Stream.
____________________________
alsa-tools_ac3dec:
This is important i you want too encode some Data too a AC3-Stream.
Hm, ac3dec seems to be something you use to decode a AC3-Stream but this
ac3jack Programm uses it too encode a AC3-Stream and sends it too my
DMXFire. But don't ask my how. ;)
>From the ac3jack Description:
"When streamed to stdout and piped through the ALSA tool 'ac3dec -C',
the AC3 stream can be passed out the SPDIF port on your audio interface
for connection to a multichannel surround receiver."
Where SPDIF means the coaxial/optical Cable i think.
____________________________
JACK:
This is the JACK Sound Server ;)
cvs -z3 -d:pserver:anonymous at cvs.sourceforge.net:/cvsroot/jackit co jack
./autogen.sh --prefix=/usr --enable-posix-shm --enable-optimize
--enable-resize --enable-timestamps --enable-capabilities
--disable-oldtrans --enable-stripped-jackd
--with-default-tmpdir=/mnt/ramfs

--enable-capabilities is important if you want to use Jack with realtime
Privileges --with-default-tmpdir=/mnt/ramfs to give some Ram to Jack
-> Necessary for "Low Latency"
____________________________
ac3jack-0.1.2                   ( ./autogen.sh && ./configure
--prefix=/usr ) This hangs itself in into the JackD as Client as Input
Device and produces the AC3-Stream that  your Soundcard sends to the
Receiver.____________________________
bio2jack                        ( ./autogen.sh --prefix=/usr
--disable-static ) This is useful if you want MPlayer to send his Sound
to the JackD (JackDaemon) It kind of maps "Block Input/Output Devices"
too the Jack. Works pretty well even if you open 4+ MPlayers parallel.
;)____________________________
qjackctl                        ( make -f Makefile.cvs && ./configure
--prefix=/usr/local ) is a so called Patchbay for your Sound Stream. It
connects Output with Input Streams.
Hm Example: With MPlayer you normally playback Stereo Audio, so bio2jack
creats too Ouput Device in Jack, with which you can work. Than you start
ac3jack and you get 6 Input Devices ( Front_L, Front_R, Rear_L, Rear_R,
Center, LFE ). Now if you wouldn't have a Patchbay for Jack you play
something with the MPlayer but you would don't hear something because
the MPlayer Output Devices aren't connected to the Input Devices of
ac3jack. That's the Job of this Programm, i have attached Screenshot of
my running Programms.(Sorry for the 144KB Attachment, i already have
compressed it and reduced the Quality of the jpg to 40%, but you will
get a Clue of how this Stuff interact with each other ) That's in this
Screenshot: Ouput-Ports: xmms, MPlayer (2x bio2jack), jack-rack
(Effect-Processing) Input-Ports: jack-rack (Effect-Processing), alsa
Sound, AC3Jack And a Mass of Connections from A->B ;)
Seems to be really messy, but i've found a Solution for this too, called
"jack.plumbing".____________________________
Jack Connection Daemon (jack.plumbing)
Name is "sw-04" in the Net i guess.
sw-04                           ( sh autogen.sh && ./configure
--prefix=/usr --disable-static )         ( JackVerbindungsDämon ) This
wonderful little Tools recognizes if you just started MPlayer and will
them immediatly connect you MPlayer Ouput-Ports with the Input-Ports of
your AC3Jack in the correct Way, you once set in a Configurationfile.
Example:
# Alles was auf dem Block Input/Ouput was ausgibt kommt über alsa nach
Jack, nun nur noch zum ac3jack umleiten.(connect "bio2jack_.*:out_0"
"AC3Jack:Left")(connect "bio2jack_.*:out_1" "AC3Jack:Right")
I've attached my ConfigurationFile, which you should modify and put into
your $HOME Dir.____________________________
LADSPA
LADSPA is optional, but if you want to mix or manipulate(Effects: Echo,
.... Tons of Effects)  the Sounds which goes to the different Channels
on your AC3-Stream(Front{L,R},Rear{L,R},Center,LFE) without all Channels
sounds the same, you will need it.
You will need three Packages:
http://www.ladspa.org/download/ladspa_sdk_1.12.tgz
http://www.ladspa.org/download/cmt_src_1.15.tgz
http://plugin.org.uk/releases/0.4.11/swh-plugins-0.4.11.tar.gz

ladspa_sdk                      ( cd src && make && make install )
ladspa_cmt                      ( cd src && make && make install )
swh-plugins-0.4.7               ( ./configure --enable-3dnow
--enable-sse )____________________________
jack-rack-1.4.3                 ( ./configure --prefix=/usr/local
--disable-static ) I installed LADSPA Plugins before because the
jack-rack make use of alls this Plugins(Hundreds of Plugins).
You can play with them around til you found the right ones.
You can set the Number of Input and Output Port that should appear in
Jack. Always having a Patchbay open, you can see that if you change this
Number the Ports shortly disappear and new Ports appears directly
afterwards in the correct Ammount. I have slighty boost up my Rear Boxes
with a Stereo Amplifier Plugin. And for the LFE i use a LowPass Filter
;) So i can hear normal Mp3 with AC3 Sound in my Room which sounds much
better then normal Stereo ;) though the Mp3-Source is no AC3 one.
You also can save your Settings/Plugins you choose to a File, but sadly,
i can't get jack-rack to startup with loading such a Configuration File.
It would be fine if i could start the Programm with something like this:
jack-rack <ConfigFile>. Perhaps some of you Guys know how.
____________________________
There are several other optional Programms:
meterbridge-0.9.2               ( ./configure --prefix=/usr/local
--disable-dependency-tracking ) freqtweak                       (
./configure --prefix=/usr/local ) xmms-jack-0.9
jackmix                         ( make -f Makefile.cvs && ./configure
--prefix=/usr --disable-debug )


That are the Programms:
Now to really make use of the "Low Latency" Feature of Jack you need to
compile and load a realtime Security Kernelmodul:
realtime-lsm Kernelmodul                ( make && copy to
/lib/modules/<kernelversion>/misc/  && depmod -a ) modprobe realtime-lsm
IMPORTANT>
This realtime-lsm Modul has some Drawbacks sometimes, which i can't get
Rid of. If i sometimes execute some Programms that try to get these
Privileges (mlock i guess) the will hang the whole System :(
You recognize this because if you just type ls the Command starts to
list the Dir but doesn't come to an End and you can't suspend or
"Strg-C" it. You only can make a su and type "halt -f"  because halt
alone would stuck like ls and your System don't shutdown.
Please if someone of you know how to kill this Progamms please let me
know."kill" and "kill -9" doesn't work!
For xmms MPlayer and 99% of all Apps you need to load the Modul with the
Option to grant the User that starts xmms,MPlayer,... Realtime
Privileges with: modprobe realtime-lsm gid=<pid>
You find this pid of the User in your /etc/passwd. Or you can just type
"id" at the Users Console.
As a Workarround you can do the following:
Execute the Script mentioned below, type
modprobe realtime-lsm gid=<pid>
execute xmms,MPlayer
and rmmod realtime-lsm
Drawback is, you must always load the Modul with these Options 
before you want to start a "soundemmitting-which-wants-to-use-jack"
Programm IMPORTANT<



Now it's very messy to start all this Stuff by Hand, so i wrote a Skript
for this Job. I should say that you can choose which Soundcard should be
used by Jack in the Script.

IMPORTANT>
You must have 2 Soundcards to get AC3 too work, so the Manual says.
But i found out that if you don't have a second Soundcard you can
compile the Dummy Soundcard Modul which you can find in the Kernel.
That's a fine Way.
The need of 2 Soundcards is the following:
Jack needs 1 Soundcard exclusively.
ac3dec needs 1 Soundcard exclusively.
If you only have 1 Soundcard Jack would by started and afterwards ac3dec
starts but hangs up (waits for Access to the already used Soundcard )
IMPORTANT<

The Script must be executed as Root but only does a 
su <user> Programm <Options>

I have so to say 3 Soundcard:
1 Terratec DMXFire	(ice1712)
2 CMedia Onboard Chip	(cmipci)
3 Dummy Modul


____________________________
____________________________
#!/bin/sh       
                
source /etc/sysconfig/rc
source $rc_functions
                
case "$1" in

Now there are severall Possibilities:
Jack + Stereo Output + 1 DMXFire
Jack + Stereo Output + 1 CMedia
Jack + Stereo Output + 1 Dummy	;) Just a Joke

				<For ac3dec>	<ForJack>
Jack + AC3 Output + 1 DMXFire + 1 CMedia
Jack + AC3 Output + 1 DMXFire + 1 Dummy
Jack + AC3 Output + 1 CMedia + 1 DMXFire	(Doesn't make Sense because
DMXFire is far better then CMedia)

Jack + Stereo Output + 1 DMXFire

        T|start_Terratec)
                echo "Starte JackD auf der Terratec DMX Fire..."
                rmmod realtime
                loadproc modprobe -v --first-time realtime gid=101
mlock=1                loadproc su <user> -c 'jackd -R -d alsa -d
ice1712 --hwmon --hwmeter &'

                # Patchbay und jac-rack auch gleich mit laden
                sleep 1
                loadproc su <user> -c 'qjackctl &'
                loadproc su <user> -c 'jack-rack &'
                loadproc su <user> -c 'jack.plumbing &'
                sleep 10
                rmmod -v realtime 
                ;;

Jack + Stereo Output + 1 CMedia

        C|start_CMedia)
                echo "Starte JackD auf dem CMedia Chip..."
                rmmod realtime
                loadproc modprobe -v --first-time realtime gid=101
mlock=1                loadproc su <user> -c 'jackd -R -d alsa -d hw:1
--hwmon --hwmeter &'

                # Patchbay und jac-rack auch gleich mit laden
                sleep 1
                loadproc su <user> -c 'qjackctl &'
                loadproc su <user> -c 'jack-rack &'
                loadproc su <user> -c 'jack.plumbing &'
                sleep 10
                rmmod -v realtime
                ;;


Here comes the interesting Section ;)
This here is the "Weapon of Choice" if you have 2 Soundcards

Jack + AC3 Output + 1 DMXFire + 1 CMedia


        AC3C|start_AC3_cmipci)
                echo "Starte JackD mit AC-3 Unterstützung..."
                rmmod realtime
                loadproc modprobe -v --first-time realtime gid=101
mlock=1                loadproc su <user> -c 'jackd -R -d alsa -d hw:1
--hwmon --hwmeter &'                sleep 1
                # AC3 Encoder starten
                loadproc su <user> -c 'ac3jack --jack-name="AC3Jack" -o
stdout | ac3dec -C &'                
                
                # Patchbay und jac-rack auch gleich mit laden
                sleep 1
                loadproc su <user> -c 'qjackctl &'
                loadproc su <user> -c 'jack-rack &'
                loadproc su <user> -c 'jack.plumbing &'
                sleep 10
                rmmod -v realtime
                #loadproc modprobe -v realtime
                ;;
 


This here is the "Weapon of Choice" if you have 1 Soundcard

Jack + AC3 Output + 1 DMXFire + 1 Dummy


        AC3D|start_AC3_Dummy)
                echo "Starte JackD mit AC-3 Unterstützung..."
                rmmod realtime
                loadproc modprobe -v --first-time realtime gid=101
mlock=1                loadproc su x-lord -c 'jackd -R -d alsa -d hw:2
--hwmon --hwmeter &'                sleep 1                             
                         # AC3 Encoder starten
                loadproc su x-lord -c 'ac3jack --jack-name="AC3Jack" -o
stdout | ac3dec -C &'


                # Patchbay und jac-rack auch gleich mit laden
                sleep 1
                loadproc su x-lord -c 'qjackctl &'
                loadproc su x-lord -c 'jack-rack &'
                loadproc su x-lord -c 'jack.plumbing &'
                sleep 10
                rmmod -v realtime
                #loadproc modprobe -v realtime
                ;;



        aus|stop)
                echo "Stoppe JackD..."
                rmmod -v realtime
                killproc jack.plumbing
                killproc jack-rack
                killproc qjackctl
                killproc ac3dec
                killproc ac3jack
                killproc jackd
                ;;



        *)
                echo "Usage: $0 {<Please fill in the correct Usage>}"
                exit 1
                ;;
esac
____________________________
____________________________
That's the Script, how it works for me.
All Programms are executed as <user> but with Realtime Privileges
 because you always load the Modul before.
____________________________
Huff i just realizes that i'm sitting here for nearly 3 Hours to collect
all this Stuff and write it down.
But it's worth it! ;)

It would be great if someone would give it a Try! :)
I heared you further can Capture Sound with Programms that use Jack. 
Should be fairly simple, the Programm only needs to provide a Input-Port
 to Jack and you only need to connect to to whatever you to record.
My Microfone works to so i can speak into it make some nice 
Effectprocessing ( Flanger Effects are funny ) and connect the Result 
to let's say the Rear Speakers :).
You also can here Music at the front Speakers and let some Messages 
or something like that come from the Rear Speaker.
Ah by the Way Speechsyntesis ( in german "Sprachsynthese" don't know
 if the english Word means this)  works well too, i use Hadifix for this
and plays the produces Wav File with MPlayer ;)
So you can let the Computer speek what someone of your Friends just 
typed in xchat (IRC Client), from the Rear Speakers or Center.

I guess there're endless Possibilities you can use Jack + AC3 for.


I'll hope you Guys aren't scared of this long Mail! :)

My Questions, that i want to make:
- How can i kill Processes that i can't kill (even as root) with "kill"
or "kill -9"?- It would be great, if it becomes a useful Howto, to post
it not only too this Mailinglist but somewhere else where People not on
this List can make Use of it. But i don't know where to. Any
Suggestions? The BLFS Book doesn't contain such Howto as far as i see,
or am i wrong?- Feedback of course, i didn't write much Howtos so far.
:)



Greets (or "Good Night, good Fight") ;)
	Christian


PS: I sent this Mail yesterday, but it didn't appear at the Mailinglist.
I guess the Screenshot was too large 144KB.

PS2: I guess the two smaller ones i made are still too big(25KB and
17KB), so i decided attach only the Configfile for jack.plumbing I hope
this goes through.

PS3: Argl i just must see that the 72 Charakter WordWrap killed my
Script Format and several other Lines that should be one Line. I hope
you can still read the Mail.

--
"Ich bin ein Regenwurm und trinke ein Stück Holz."









-------------- next part --------------
A non-text attachment was scrubbed...
Name: .jack.plumbing
Type: application/octet-stream
Size: 799 bytes
Desc: not available
URL: <http://lists.linuxfromscratch.org/pipermail/blfs-support/attachments/20041114/e316d209/attachment.obj>


More information about the blfs-support mailing list