Digirig reporting incorrect channel count on Windows
11 July 2025
One of the peculiarities of developing M17RT is working with the Rust cross-platform audio library cpal. I'm not out to criticise cpal today—it's a wonderful library—but it is pretty low-level. As a developer I am required to take into account that certain input and output devices may support particular sample formats (e.g. 16 or 32-bit signed integers) and particular sample rates (e.g. 44.1 kHz or 48 kHz) and I need adapt my audio data to fit what's available.
One of the most popular USB audio interfaces for amateur radio is a gizmo called the Digirig. I own two of them. When I plug it in to my Win11 desktop, cpal offers me four choices for consuming the audio input: u8, i16, i32 or f32 sample formats all at 48 kHz and with one channel. This is correct—it's a mono device.
You can imagine my surprise when I plugged exactly the same device into my Win11 laptop and cpal offered me i32 or f32 at 48 kHz with four channels. Suspiciously, this is exactly the same combinations offered by the laptop's built-in microphone. How did it go so wrong? Was it a bug in cpal? (Spoiler: It was not.)
Onboard sound card: SupportedStreamConfigRange { channels: 4, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: I32 } SupportedStreamConfigRange { channels: 4, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: F32 } Digirig: SupportedStreamConfigRange { channels: 4, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: I32 } SupportedStreamConfigRange { channels: 4, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: F32 }
It turns out my Lenovo laptop came with some fancy Dolby drivers which by default would insert themselves to do some sort of signal processing on the input and output of an attached USB audio device. As a result cpal was talking to this virtual audio component which had different expectations of format, instead of directly providing samples for the digirig behind it like I wanted.
Luckily the solution was quite simple. I just had to go through sound settings for both the USB input and output devices and disable audio enhancements.

Now cpal enumerates the configurations for the Digirig how I expected. The lesson is clear—if you're using a Digirig on Windows you will definitely want to make sure this is disabled. Otherwise a driver like this might interfere with your digital radio signals. This is my fault of course. Digirig's getting started guide warns that you need to turn off "custom features" like "spatial audio". I hadn't checked; when I first got the Digirig I was using it with a Linux system and had no such issues.
SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: U8 } SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: I16 } SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: I32 } SupportedStreamConfigRange { channels: 1, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Range { min: 0, max: 4294967295 }, sample_format: F32 }
Tech Tidbits Blog by Thomas Karpiniec
Posts RSS, Atom