[alsa-devel] IEC958 / SPDIF raw capture

Clemens Ladisch clemens at ladisch.de
Thu Feb 11 08:26:34 CET 2010

Donald Tournier wrote:
> We have an application in our institute that will require recording of
> a digital signal via an optical cable. We have to be able to guarantee
> perfect bitwise reproduction of the signal (the odd bit error is not a
> problem). We're thinking of using SPDIF and ALSA to capture the signal
> (obviously we'll have to make sure the signal is properly encoded to
> begin with).
> However, after some initial attempts, it's becoming clear that ALSA
> can't necessarily guarantee bitwise perfect capture. ALSA might change
> the format, or resample the signal after capture (although I've heard
> that can be turned off with "snd_pcm_hw_params_set_rate_resample
> (capture_handle, hw_params, 0)").

If you open the device as "hw:x", ALSA will not do any conversions and
will give you the data exactly as it comes from the sound card.

> can this be done? If so, which card/driver would be recommended?

PCI(-E) cards based on C-Media chips (CMI87x8, CMI8770, AV200) are known
to allow bit-perfect digital capture.

> Ideally, we would like to capture the raw SPDIF subframes.

Some very old revisions of the CMI8738 did this, because proper decoding
of subframes wasn't implemented, but these aren't sold anymore.


More information about the Alsa-devel mailing list