Linux sound recording 

Newsgroups: aus.computers.linux,comp.os.linux.misc
Date: 26 Nov 2002 18:17:09 GMT
> I have a large collection of old LP's that I want to copy to CD, and
> want to use Linux to do it if possible.
> Any suggestions on what is the best way (ie: software wise) to do
> this with Linux?

I wrote a little utility to do the recording, it doesn't require much:

A few things I noticed:

For soundblaster, the ALSA drivers are better than the free OSS drivers because the ALSA ones seem to be less bothered by interrupts coming from other devices. Fundamentally though, PC DMA is rooted for sound recording because there is no guaranteed way to atomicly read the DMA pointer while DMA is happening — a hardware FIFO approach to sound recording is much better than DMA on PC architecture.

To reduce interrupt loading while recording, use a raw partition as the output device. You lose information about the output file size but you can keep that somewhere else and you are probably going to cut up the recording anyhow. Raw partition has much lower overhead than normal files because it doesn't update directories, inodes and all that.

To prevent bursts of hard-drive IO, open the output with the O_SYNC flag (see man 2 open) so that every block will write as a block and it won't defer writing. When writing to a raw partition, this gives excellent control over the hard drive behaviour by just adjusting the blocksize. Usually 1/2k, 1k, 2k or 4k blocks work best depending on your system.

Scsi discs usually have fewer interrupts and put less load on the CPU. This is important not because the CPU can't handle the load but because you need the CPU to be almost entirely unloaded in order to get real time response on the audio interrupts.

My system:

ad1816: TERRATEC SOUNDSYSTEM BASE 1 detected
ad1816: ISAPnP reports 'TERRATEC SOUNDSYSTEM BASE 1' at i/o 0x530, irq 5, dma 1, 3
ad1816: AD1816 sounddriver Copyright (C) 1998 by Thorsten Knabe
ad1816: io=0x530, irq=5, dma=1, dma2=3, clockfreq=33000, options=0 isadmabug=0

Running on a 200 MHz system and an Adaptec AIC-7871, it boots off IDE and runs the system off IDE but uses a dedicated SCSI drive just for sound recording. Recording an hour or more of continuous CD quality sound without missed samples works without a problem.

> I dont mind if it is command-line or GUI, as long as I can get some
> kind of recoding level meter on the screen, or at least find some
> way of stopping clipping of the signal (which sounds terrible in a
> digital environment).

Yeah, getting levels right is always a pain. Most sound cards have several volume controls that all affect recording. I generally make sure I mute everything except the input that I want (to reduce noise) and crank the input gain right up then throttle it back with the recording gain. The Teratec Base-1 comes with crappy documentation but Analog Devices provides excellent documentation for the AD1816, basically this is the reason that I'm not using a soundblaster because there is no way to know what is really going on inside the soundblaster.

Tel