hydra

Terminal replacement for Loopback — virtual audio devices and routing on macOS, from a ratatui TUI.
Log | Files | Refs | README | LICENSE

README.md (2852B)


      1 # Hydra diagnostics
      2 
      3 Tools for diagnosing audio-path problems — built while chasing a "one ear in Discord" bug
      4 that turned out to be **downstream of Hydra entirely**. The lesson they encode: when audio
      5 "sounds wrong," measure each layer in order rather than guessing at the device.
      6 
      7 ## The layers, and how to measure each
      8 
      9 1. **Tap capture** (does Hydra capture the app at all, balanced?) — route an app via the TUI
     10    and watch the route's peak in `hydra query`. A balanced source should give equal L/R.
     11 2. **Hydra device output** (does the virtual device emit true stereo?) — record Hydra's
     12    *input* with ffmpeg and check per-channel frequency content:
     13    ```sh
     14    ffmpeg -f avfoundation -i ":0" -t 2 -y /tmp/out.wav   # ":0" = Hydra (check -list_devices)
     15    # feed a hard-panned source (300Hz L / 900Hz R) and confirm L≠R in the recording
     16    ```
     17    IMPORTANT: test with a **distinct-L/R** source, not an identical-L/R tone — an identical
     18    tone plays in both ears even if a channel is being dropped, so it can't detect mono
     19    collapse. (This was a real mistake during the original investigation.)
     20 3. **Device properties** (`devdiff.m`) — dump format / channel-layout / labels for every
     21    input device, to A/B Hydra against a known-good device (e.g. Loopback):
     22    ```sh
     23    clang -framework CoreAudio -framework CoreFoundation devdiff.m -o /tmp/devdiff && /tmp/devdiff
     24    ```
     25    This is what found Hydra was defaulting to 48000 Hz while the host ran at 44100 — the one
     26    device-level difference from the working Loopback mic.
     27 4. **Browser capture** (`hydra_mic_probe.js`) — paste into Vesktop DevTools console; reports
     28    what Chromium's WebRTC capture actually sees (track settings + per-channel peaks). Confirms
     29    whether the browser receives stereo from the device.
     30 5. **SDP / Opus** — read StereoMic's own console logs (no pasting needed):
     31    `[StereoMic] munged setLocalDescription` AND `munged setRemoteDescription` both firing =
     32    Opus is advertising stereo on offer + answer. If only local fires, the answer-munge didn't
     33    apply (a StereoMic-side issue, not Hydra).
     34 6. **Discord audio processing** — Echo Cancellation / Noise Suppression(Krisp) / Auto Gain
     35    are mono-only; any one enabled collapses capture to mono regardless of device. Turn all
     36    off in Vesktop → Voice & Video.
     37 7. **The receiver** — the easiest variable to forget. Verify the *listener's* playback is
     38    actually stereo (headphones on a second device joined to the same channel) before
     39    concluding the transmit path is broken. Unknown/mono speakers on the far end mimic every
     40    send-side bug.
     41 
     42 ## Hard-won rule
     43 
     44 Hydra measured correct at every layer (44.1k, clean [L,R] labels, true stereo to the
     45 browser, both channels captured). Most "Hydra is broken" symptoms live in layers 5–7. Build
     46 the measurement before changing the device.