Re: Full duplex using 2 sound cards.

Ian Main (imain@vcc.bc.ca)
Tue, 28 Jan 1997 10:55:10 -0800 (PST)


On Wed, 29 Jan 1997, Hannu Savolainen wrote:

> On Tue, 28 Jan 1997, Ian Main wrote:
>
> >
> > Hi, as you guessed, I'm trying to get full duplex sound using 2 sound
> > cards. One is a mad16, and the other a sb16. Both work fine by
> > themselves, but when I try to use them together, the sb16 behaves a little
> > strangely. (mad16 works fine.) The sb16 works fine for 8 bit IO, but 16
> > bit playback and record is very jumpy. It misses large sections of the
> > sound (I assume it's a buffer problem.)
> It's very tricky to do recording of CD quality audio to a disk file in
> Linux. The process just sometimes get's blocked for disk I/O for too long
> time. This seems to happen every time bdflush/sync starts posting dirty
> buffers to disk. When using 44.1 kHz/16 bits/stereo format the maximum
> possible DMA buffer (64k) becomes full after 0.37 seconds which causes an
> overrun. However with a fast (SCSI) disk it's possible to record without
> problems. I don't know exactly which causes the difference between SB16
> and the MAD16 card but it's possibly related with different DMA overhead
> caused by the cards (could this be possible?).

Hmm. I'm not sure. But I know I can output 8 bits at 44100Khz stereo
with no problems. But 16 bits at 11025 mono skips like crazy. I've
also been using the sound blaster for a while now, and have never had
problems playing 16 bit audio until I put the mad16 in.

Is there no way to pass args to the sound driver through lilo? Even just
to tell it which card to detect first? I found the Readme.linux pointed
to Readme which.. didn't seem to get me anywhere. Is this info available
at all?

>
> To be able to do simultaneous recording and playback reliably you should
> implement extra buffering in the application. This probably means that you
> should use multible threads (or processes communicating through a shared
> memory segment). One thread reads data from the device as fast as possible
> and stores it into a buffer (FIFO). The second thread reads data from the
> buffer and posts it to the disk file. For simultaneous playback you
> probably need more threads.

Yes.. good stuff. I am using 2 threads right now, one for playback and
one for record. I may end up having to do like you say, although it seems
to work well enough for now.

Thanks a lot for the tips!

Ian