Bitstream corruption when recording SPDIF?

Windows 10, Audacity 2.1.3 (+self compiled ASIO support)

I’m trying to use Audacity to do capture of embedded AC3/DTS streams.

I’m using an ESI U24XL and capturing via TOSLINK. Applications see the bitstream as 48khz 2ch 16bit PCM.

It seems that during recording, values are being offset/corrupted. What should be 00 is sometimes being set to FF, what should be 7E is sometimes 7F, etc. Values look like randomly +/- 1.

Needless to say this ends up in corrupt, unplayable AC3/DTS streams :smiley: I have tried WASAPI, ASIO, etc. and get the same results.

I tried another application - Reaper - and I get perfect captures with no errors.

It kinda seems like Audacity may be doing some kind of math or rounding on recording.

I doubt that we are going to be able to offer much help.

Audacity interfaces with the computer sound system via PortAudio ( Audacity handles audio data internally as 32-bit float. In most cases this means that there will be no rounding of data values that Audacity receives from PortAudio, though there would of course be rounding if Audacity received data in a very high bit format such as 32 or 64 bit integer.

I don’t know what happens between PortAudio and the physical hardware. That’s not really Audacity code, and I just look at it as a black box. I do know that I can feed a sample stream into Audacity and Audacity records the data bit-perfect, which indicates that there is no rounding on Audacity’s side of the PortAudio API when recording as 32-bit float.

I don’t know where to go with this from here as I don’t have the hardware to even start debugging the problem. Unless you are able to probe what’s happening inside PortAudio (debug the I/O library), then you may need to stick with Reaper for capture. If you want to use a smaller / lighter program for audio capture, you could try

interesting data points for anyone interested:

ffmpeg (directsound): bitstream corruption
OBS: bit perfect