[alsa-devel] IEC958 / SPDIF raw capture

Donald Tournier d.tournier at brain.org.au
Fri Feb 12 04:44:17 CET 2010

Thanks Clemens, that very helpful. We'll try to source one of these
C-Media cards as soon as possible.

Also nice to know about the "hw:x" trick, although I'm not too sure
how to use that in practice. I've just tried this command, with no

$ arecord -D hw:x -t raw output.raw
ALSA lib pcm_hw.c:1435:(_snd_pcm_hw_open) Invalid value for card
arecord: main:608: audio open error: No such device

How exactly should this be used?


On 11 February 2010 18:26, Clemens Ladisch <clemens at ladisch.de> wrote:
> 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.
> Clemens

Jacques-Donald Tournier (PhD)
Brain Research Institute, Melbourne, Australia
Tel: +61 (0)3 9496 4078

More information about the Alsa-devel mailing list