Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Mar 2004 19:22:41 +0100 (CET)
From:      Barry Bouwsma <freebsd-misuser@remove-NOSPAM-to-reply.NOSPAM.dyndns.dk>
To:        Michael Reifenberger <mike@Reifenberger.com>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: S/PDIF support
Message-ID:  <200403211822.i2LIMfp01422@Mail.NOSPAM.DynDNS.dK>
References:  <20040222234549.R71343@fw.reifenberger.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[ipv6-only address above]
A few weeks late for this reply, but I hope it's still relevant...

> is S/PDIF I/O supported under FreeBSD (-current)?

I have had it working in -stable; should be no problem with -current,
though I have needed to make a few source hacks...


> If yes, which cards (esp. S/PDIF input)?

I've had success with two particular cards, both of which should be
available in .de ...

The FM801-based 512i card from TerraTec has an optical s/pdif output,
which Just Works in parallel with the normal line/speaker output --
provided you've hacked the chip detection to enable audio (patches for
this get mentioned every few months on the lists).  The card itself
has no s/pdif input, while the fm801 chip should be capable of such,
perhaps on a different card, probably with additional register frobbing.
Playback has been very pleasing with my hardware, at the bitrates I use.
This card is no longer being produced, but can probably still be found.

There are apparently several cards based on the CMI8738 chip, some of
which have both optical and electrical s/pdif in- and outputs -- the
particular one I got was from Typhoon, and should be had for some EUR30
or so, a full 6-channel card.

The support for this chip seems to be better under NetBSD than FreeBSD
(more options), and FBSD s/pdif output needs to be enabled with a sysctl.
I think it's either/or line or s/pdif out with FreeBSD at present.  This
card seems to be limited to 48 and 44,1kHz sample rate audio -- at
least it doesn't play as nicely with my hardware as the FM801-based card.
But my hardware is a bit suspect.

I've hacked a few lines in the source in order to switch the input from
analog mixer (which is rather noisy compared to other available cards)
to one of the s/pdif inputs, to enable me to record.  This can be done
dynamically with NetBSD, while my simplistic hack gives me loadable
modules with either optical or coaxial input support -- fine for me
since I only need one of them.  Probably someone with a bit of time and
more skill can hack a sysctl akin to the spdif-output to select one of
the possible inputs for recording.

This card does not record 32kHz samplerate audio; only 44,1 and 48Khz
based on my tests.  The electrical input appears to need to be driven
by a 5V signal -- one of my sources provides nothing; my other sources
probably have ground loop problems that have given me distorted sound
on all but one coax-in test.  Optical input works great.

In the absence of an s/pdif signal to record, my FreeBSD -stable reports
a channel dead timeout, and seems to partially freeze the system until
the recording process is killed.  So there needs to be some input to the
card for recording -- which recording is made at the actual sample rate
of the s/pdif signal, naturally.  I'm using multiple cards in one machine
with some issues that I haven't bothered to track down as a problem with
my hardware or with FreeBSD, but otherwise my needs are met, mostly.  I
have a small bit of static in my optical recordings made on the machine
with two cards; I haven't noticed this slight crackling in recordings
made on a different machine with a single card, but more research is
necessary.

With that out of the way, note that by default, FreeBSD cannot record
from the s/pdif inputs.  I suggest an inspection of the three NetBSD
source files (pci/cmpci*) in comparison to FreeBSD's (based in part on
NetBSD) as a basis for better hacks to enable recording, as well as
hints as to further things this card/chip is capable of.

I've seen two different makes of card with this chip and full s/pdif
interconnections, as well as an identical-looking board for half the
price without any s/pdif connectors and only 2 (or 4?) channel support.
I suspect it should be no problem to find a suitable card.

Those are the only s/pdif cards I've played with so far.

Hope this late information is helpful, if only for the archives.


barry bouwsma



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200403211822.i2LIMfp01422>