Created with The GIMP
   


Features

2007 CHLUGger of the Year!
Mailing List
Archive
Help Open Source
Question of the Day

About Us

Mission
Directions to Meetings
Contact Us
Video
Guest Speaker Info
Acceptable Use
Link To Us!

CHLUG Exclusives

Open Office 3.0- New and Enhanced Features New!
Linux Hacking and the Law New!
VOIP with Asterisk
Assessing OSS
Knoppix Ubiquitous Computing
Filesystem Hierarchy
Virtual Hosting
Wesnoth
Xbox/Linux
udev
Emacs Talk Notes
Home Sweet ~
Top 100 CLIs
Device Drivers
Real Time Linux
Network Considerations Part II
Network Considerations Part I
Amanda Presentation
GNU/Linux Calculators Configuring Rio
ReiserFS
Linux Sound
Samba notes
Network time protocol
C programming in Linux
Boot, startup and shutdown
hdparm HOWTO

Friends of CHLUG

Ubuntu NJ LoCo
New!
Cherry Hill Library
RUSLUG
LUG in Princeton
Useful Links

Loads of Linux Links
LinuxToday.com
Art of UNIX Programming
More Links

Agenda

Contact Congress
Why We Use Linux
Companies Using Linux
Linux in Business



Get Linux!


Get Firefox!

Get OpenOffice.org!




Created with The GIMP



Website Designer- jesran.net



Linux Sound:

Notes for the September 10, 2001 meeting by Gerald Neale
<2001-09-06 gneale@chlug.org>

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

Setting up sound on Linux can be fun and informative too. In the end you should get some great sound for a low cost.
Note: The following examples were done on Red Hat, but should be just as easily done on other distros.
---------------

I. Getting sound onto a working Linux machine:
Assuming that you have a machine running Red Hat Linux, get a sound card that works.
We have tested the SoundBlaster 16.
Which is a classic ISA card that can be found used online and at shows for between $5-10.
These cards sound great and are easy to set up.
The other card tested was a Creative Ensoniq AudioPCI.
This card was even easier to set up and was found new at Best Buy for $25.

Ok. The steps are easy. First , shutdown your system, install the card and reboot.
The Red Hat boot program called Kudzu will detect the new hardware, but we want to configure it manually so we will choose the <ignore> option.
Now login as root and run "sndconfig". This is simply done by opening a terminal session and typing
%sndconfig .

This is a good time to put headphones on and plug into the soundcard.
Sndconfig does not automatically detect the SoundBlaster 16 card so choose it from a list.
Now the fun part. Sndconfig let's you configure the I/O port, the IRQ, DMA 1, DMA 2, and MPU I/O.
The details of all of this are beyond the scope of this simple HOWTO
(see Introduction to IRQs, DMAs and Base Addresses for more about addressing).
(see also Resolving Linux PCI Interrupt Problems).
Just be careful of IRQ conflicts by opening another terminal window, doing a cat /proc/interrupts and looking over the results.
% cat /proc/interrupts

           CPU0
  0:   43714849          XT-PIC  timer
  1:     119352          XT-PIC  keyboard
  2:          0          XT-PIC  cascade
  5:    3514680          XT-PIC  eth0
  8:          1          XT-PIC  rtc
 10:          0          XT-PIC  usb-uhci
 11:   17958176          XT-PIC  es1371
 12:    1260679          XT-PIC  PS/2 Mouse
 14:     211524          XT-PIC  ide0
 15:    5043615          XT-PIC  ide1
NMI:          0
ERR:          0
 
After some trial and error, changing the sndconfig default IRQ from 5 to 7 avoided a conflict with another card (a network card I believe).
Now that you put your settings into sndconfig, it will play two sample sounds for you to hear.
Make sure your headphones or speakers are in the appropriate jack.
If you get the samples, you've got sound!

So what happened behind the scenes? Well, Red Hat kernels have Sound Blaster 16 card support built into their stock kernel by means of a module; it's called sb.o to be exact.
It can be found in the /lib/modules/2.4.2-2/kernel/drivers/sound directory.
You can find it and all other soundcard modules by doing a
%ls /lib/modules/2.4.2-2/kernel/drivers/sound

ac97_codec.o  cs4281        maestro.o        pas2.o        trix.o
ac97.o        cs46xx.o      maui.o           pss.o         uart401.o
aci.o         emu10k1       mpu401.o         sb_lib.o      uart6850.o
ad1816.o      es1370.o      msnd_classic.o   sb.o          via82cxxx_audio.o
ad1848.o      es1371.o      msnd.o           sgalaxy.o     v_midi.o
adlib_card.o  esssolo1.o    msnd_pinnacle.o  sonicvibes.o  wavefront.o
aedsp16.o     gus.o         nm256_audio.o    soundcore.o   ymfpci.o
awe_wave.o    i810_audio.o  opl3.o           sound.o
cmpci.o       mad16.o       opl3sa2.o        sscape.o
cs4232.o      maestro3.o    opl3sa.o         trident.o

This may seem like a buried file in an obscure directory, but it is still very important; as all the /lib/modules files and directories are.
Because here are the sound drivers that you can can use later without having to rebuild your kernel.
A little clarification might be neccessary at this point.

We have all heard that one of the strengths of Linux is that the kernel is "modular", but what does that do for us?
To answer, let's explain the kernel as a binary "blob" that gets put into memory on boot and sits there as long as the system is running.
It handles all bottom line functioning; inputs and outputs (and more).
Listening and talking to soundcards being amongst the kernel's reponsibilities.
But the software code to talk to a SoundBlaster 16 card ,the sb.o file, is large and not always neccesary.
How often does your system need to be making sound?
Not very often, especially if your Red Hat system is a server of some sort.
So to keep the sound code out of the system's memory where it uses valuable resources, the sb.o driver has been compiled into this kernel as a "module" by the nice people at Red Hat.
In fact, most of the tons of Linux drivers have been precompiled into  Linux kernels as modules in the stock Red Hat Linux kernel.
You can see which modules are available to you by just perusing through the /lib/modules subdirectories.
So anyway, what we had done previously with the sndconfig program is tell our system that we want to use the SoundBlaster 16 driver.
So it will now put it in memory at boot as part of the kernel.
Also with sndconfig, we in effect told the system what address we want to use for our SB 16 card thereby avoiding I/O, IRQ and DMA conflicts.

Ok, cool so now we're peering under the hood a bit.
So lets take this opportunity to look at what sndconfig did to our /etc files (where the configuration scripts are kept).
Looking here might be of use later when trying to add hardware or filessystems with modules.

The key file is /etc/modules.conf.
%cat /etc/modules.conf

alias eth0 3c59x
alias parport_lowlevel parport_pc
alias usb-controller usb-uhci
alias sound-slot-0 sb
post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L >/dev/null 2>&1 || :
pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -S >/dev/null 2>&1 || :
options sound dmabuf=1
alias synth0 opl3
options opl3 io=0x388
options sb io=0x220 irq=7 dma=0 mpu_io=0x330

The new lines added by sndconfig are:
1) alias sound-slot-0 sb
That line tells the kernel to load in the sb.o driver module on boot.

2) options sb io=0x220 irq=7 dma=0 mpu_io=0x330
That line tells the kernel where we want to address the soundcard.

We could have just as easily edited this file by hand and rebooted instead of using sndconfig, but that would have been with making alot of assumptions.
Sndconfig is nice visual tool that will hide some of the obscure details of Linux from you, but still offers a behind the scenes glimpse for the curious types.
Another nice thing is that it is a very small, "ncurses" based program, so it will run over a network.
Basically that's it, to set up Linux sound.
We now have successfully added sound to our Linux box for about $7 and we peered behind the scenes too.
Isn't Linux fun?
If you have a problem, chances are good that the official linux sound howto faq covers it.
There are many programs to help you enjoy your Linux soundsystem and we'll get into them next.
-------------------------------------------------------------

II. Ripping CDs:

A. Grip-
 Grip is the program you want to run to rip from your CD collection in a nice Gnome X environment.
This program is just an X-windows layer to a program called cdparanoia.
It's function is to take the tracks from a CD in the CD tray, look them up in an online database, name them, and write them as .wav files onto your hardrive.
But wait. They're not MP3s?
No, that's he one little complication with this scheme.
You must "encode" the .wav files to make them MP3s.
.wav files, though sounding great, are enormous.
A typical song is 25MB.
Compare that to a typical .mp3 song file which is 3MB and you see why .mp3 has become the standard.
This saved space is especially important when networking sound; when using gnutella (a new, maybe better, napster).
So to activate mp3 "encoding" with you're ripper, grip, you must download and install an encoder.
The best of which I found was one called Lame.

B. Lame-
It seems that any mp3 encoding software is hard to find nowadays secondary to licensing fees.
Look for the Lame encoder at http://freshrpms.net/ under multimedia.
If not there then just do a google search for "Lame RPM".
Then just download and install the RPM with the typical command, like
%rpm -Uvh http://place.with.lamerpm.com

and your ripper, Grip, is now able to rip and mp3 encode your CDs.

Using Grip is a cinch.
It's all X-Windows based.
Just remember to choose "rip + encode" to get MP3s in the end.



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

III. Playing MP3s:

Now this is the really fun part.
You've jacked up sound on your Linux box.
You've ripped you're favorite CDs onto your hardrive.
You might have even downloaded hundreds of MP3s from a gnutella file sharing network (or something similar) using a file sharing program like Limewire or GTK-Gnutella.
You're ready for some Linux sound.

XMMS-
The X-MultiMedia Soundsystem is a tremendous MP3 player that is included with your Red Hat distro CDs and installed by default.
It looks great and works great.
It's so easy to use that to write about it is pointless but here is a great article about it ( Getting the Most Out of XMMS ).
Just play with it.
For starters, try internet radio at www.somafm.com
or at www.mostlyclassical.com
or at www.shoutcast.com
or at http://www.digitallyimported.com
or at www.peercast.org.



Also, for an alternate mp3 player check out the Realplayer rpms here.

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

IV. Burning CDs:

K3B or Xcdroast is the program you want.