Close

New microphone, ALSA calls, & O_DIRECT

A project log for The ultimate vlogging mic

Recording the best headset audio in a portable form factor

lion-mclionheadlion mclionhead 02/23/2021 at 05:260 Comments

Using molex connectors for headsets has proven disastrous.  It may be they don't do well when they're frequently unplugged like audio connectors.  The TRS connector was invented over 100 years ago for telephone switchboards.  There was nothing special about the TRS connector's signal properties, so lions figured molex connectors would be more compact.  The molex connectors have been prone to dirty contacts & bad connections.

There's nothing special about going back to a dual 3.5mm TRS connector for the microphone & speakers.  It would just involve money.  It would be bigger than the molex connector but not totally ruin the experience.  Dual TRS would allow monitoring stereo on a headset without microphones.

There are other connectors besides molex, like SATA & USB.  

The single channel vlog mic finally got ported away from jackd to its own ALSA mmap calls & the performance instantly improved.  The latency got a lot lower & it was less prone to losing buffer synchronization.  Jackd had a problem of too many buffer handovers above the basic ALSA mmap buffer & latency from its socket interface.  Socket interfaces are so bad at latency, it's amazing audio software has gone exclusively to socket interfaces like pulseaudio & jackd.  ALSA has long supported mixing multiple programs in the kernel, where it's not as prone to latency as a userspace mixer.  Meanwhile, old programs like X11/Xorg/Xwayland long ago abandoned socket interfaces to get lower latency.

With direct ALSA mmap calls, the smallest buffer possible with the general pro's in full duplex mode dropped to 144 samples.  

The microphone was upgraded to a microphone extracted from a Zoom H2.  The sound quality was spectacular for an electret condenser, rivaling Tucker Gott's microphone.  The Zoom recorders were definitely a high point in electret condensers.  It's disappointing such good microphones aren't available from digikey.  

Finally, the file I/O got moved to O_DIRECT to reduce dropouts.

Helas, the 1st vlog with this setup was a disaster.  There were a lot of buffer overruns, so the ALSA buffer size has to be stepped back up.  The wind noise was terrible.  Only a few ramblings about lions were audible.  The larger zoom microphone didn't allow as effective a wind screen.  It was a stock wind screen that looked like Tucker Gott's.  

The next question is if the stereo version can monitor by fusing the 2 cards in userspace & if the 2 versions can reboot each other.

Discussions