First, for those of you who don't know, the SoundBlaster Audigy 2 NX is
a usb (2.0) sound device based on the Audigy 2.  Most of the features
don't appear to be supported--for example EAX and CMSS, and probably not
the remote control/IR device.

This device is only supported under ALSA using snd-usb-audio.

I am running on Fedora Core 1, and highly recommend reading the Fedora
Multimedia Installation Howto at
http://www.tldp.org/HOWTO/Fedora-Multimedia-Installation-HOWTO/
and any documentation from the excellent Planet CCRMA site at
http://www-ccrma.stanford.edu/planetccrma/software/ which covers several
important details.  Excerpted from Planet CCRMA is the minimum that I
had to modify from just installing the alsa RPMs to get my device to
work with any consistency:

----- begin excerpt ----
The USB startup code runs very early in the boot sequence, before the
alsasound startup script gets a chance to run. So you have to disable
the automatic load of OSS USB modules that will be detected by the
hotplug subsystem. To do that add these two lines to the
``/etc/hotplug/blacklist'' file: 

audio
usb-midi

This will disable only the USB OSS drivers. You can also add:

snd-usb-audio

so that your USB soundcard will be started with the rest of the ALSA
soundcards (if there are more). Otherwise hotplug will start it early in
the boot sequencer (but there's no harm in that).
----- end excerpt ----

Please note that I am not trying to do anything exotic--I don't have
much used for Surround, as I do almost all my listening via either a
reference-grade headphone amp and Etomotic ER-4S headphones (sweet!) or
through an ancient Sansui 4000 "solid state" receiver and a set of
modest speakers I built in college (based on 8" klipsch drivers, not bad
all told).

However, I do have the desire to record radio programs that are always
on at terribly inconvenient times.  I'll address what I did for that as
well.

Once the appropriate kernel modules are loaded--the relevant portions of
my lsmod are:
snd-usb-audio          56832   0
snd-rawmidi            18080   0  [snd-usb-audio]
snd-seq-device          5976   0  [snd-seq-oss ...]
snd-pcm                84772   0  [snd-pcm-oss ...]
snd-page-alloc          9716   0  [snd-pcm]
snd-timer              19300   0  [snd-seq snd-pcm]
snd                    46020   0  [snd-pcm-oss ...]

you must run an alsa-enabled mixer to unmute the output.  alsamixer
worked fine for me, you may prefer the relatively arcane alsactl.

So I tried to play wave files and mp3s back through xmms, and everything
sounded simply awful.  There was a warbling or poping sound, which I
typically associate with rate problems. The solution to this problem was
pointed to by
http://www.qbik.ch/usb/devices/showdev.php?id=2375 which states the
Audigy 2 NX "works correctly at 22050, 48000 hz sample rate with or
without OSS emulation. Other rates can be up/down sampled using alsa
devices."

Since everything under the sun is sampled at 44.1 KHz, we need to do
enable software resampling. This is accomplished through virtual devices
in ALSA.  The unbelievably poor documentation indemic in the ALSA
programming world (I've seen word that they will be improving soon)
doesn't actually say how to do this with clarity.  I hacked from one of
their example files my ~/.asoundrc to contain
----- begin .asoundrc -----
pcm.48000Hz {
        type plug               # Automatic conversion PCM
        slave {                 # Slave definition
                pcm "hw:0,0"         # Slave PCM name
                rate 48000      # Slave rate (default nearest) or
"unchanged"
        }
        route_policy default        # route policy for automatic ttable
generation
}
---- end .asoundrc -----
which creates a device called 48000Hz that delivers 48KHz sample signal
to (or from?) the sound device.  I am able to read from the device
without trouble, though arecord works fine without any modification as
long as the sample rate is 48000.

Then, install the alsa-plugin for xmms.  Using the configuration dialog
for the plugin set the device name to 48000Hz.  Since then I've had no
trouble whatsoever with clean playback.

I tend to want to record and playback radio programs, so I provide some
appropriate signal on the "line in", fiddle with the mixer until I get
appropriate levels, and then save the levels with alsactl -f <somefile>
store.  Recording to mp3 (yeah, ogg would be fine, but the SlimX folks
have done nothing with ogg firmware for the 330.  Dammit.) is
accomplished with a command like

arecord -f dat -d $SECONDS 2>>$LOG | /usr/bin/lame -x -r -s 48.0 -q 5
--resample 44.1 --tt "$ID3NAME" - $OUTPUT_DIR/${FNAME}.mp3  >> $LOG 2>&1
The arecord command line dumps little-endian stereo 16 bit PCM data for
a duration (-d $SECONDS) to the standard output.

The lame line records raw pcm (-r) which in my system required, for some
unknown reason, to byteswap (-x) at an input sample rate of 48000 Hz
(-s) a quality level of 5 (-q) to prevent pipe overflows, resampled to
44.1 KHz (--resample, probably still grossly overkill for FM stereo
broadcasts...thoughts anyone?) gives the file a tag title (-tt) and
records the stdin (-) to some output.mp3 file.  Fun eh?

Features I would really like, anybody know how to do this?:
A) enable the remote control and the on-card controls, which consist of
a volume knob, a mute, and a CMSS button. If I could get a device to
read from (like /dev/irtty or whatever) I would gladly decode the words
coming from the respective controls.
B) names in the mixer that correspond to the names on the card.  My
device has names like "mic in", "side/phones", "line in", "csub",
"rear", and "front" along with optical and digital I/O.  I would love a
mapping in alsamixer and GNOME alsa mixer that change "PCM" "PCM" "PCM"
"Speaker" "Speaker" "Speaker" into something that means something.
C) To be able to use the sound shapers (CMSS and EAX) which for a
headphone user are unbelievably sweet!  I use the card on a windows box
as well, and the EAX and CMSS are really, really good.  They put the
crap at earwax to shame (try sox on Dark Side of the Moon with earwax,
the bells clip and you want to take an ice pick to your ears).

If anyone has any interest in helping develop some of the features,
please feel free to cross-post to the developer's site.

Yours,
Park

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to