Identify SPDIF/TOSLINK input sample rate via ALSA

Hi HifiBerry community!

I'm building a software DSP which handle digital input at various sample rates.
An example of use case is recording a Chromecast Audio's output which typically varies beteeen 44.1k for streaming services, 48k for device casting, 96k and 192k for high res audio.

I'm prototyping with the Terratec AUREON XFIRE8.0 HD USB sound card which happily sends buffers to ALSA at whatever speed according to the input signal regardless of the sample rate requested to the recording API.

How would the Digi+ behave in that case:

  • Will the input sample rate change trigger an error?
  • Is identifying the input sample rate possible by iterating over all common sample rate until success?


Please sign in to leave a comment.