Skip to content

Latest commit

 

History

History
130 lines (105 loc) · 5.98 KB

recording.md

File metadata and controls

130 lines (105 loc) · 5.98 KB

Recording a Discord call from macOS system audio

This is an alternative to the production Discord-native receiver. It captures audio after the Discord desktop app has played it, then transcribes locally. It is useful when a bot cannot join the channel or you deliberately want a mixed recording. No voice-receive bot is required.

This machine is already set up: ffmpeg, BlackHole 2ch, a Multi-Output Device, a mic, and whisper.cpp + a model are installed. .env is preconfigured. So the short version is:

nvm use 22
pnpm cli record --title "Team Sync"      # talk… then press Enter or q
# → writes a full session under ./transcripts with a REAL local transcript

How the audio is routed

 Discord call  ──► Multi-Output Device ──► your headphones (you hear it)
   (others)                         └────► BlackHole 2ch ──┐
                                                           ├─► ffmpeg amix ─► WAV ─► whisper.cpp
 Your mic ────────────────────────────► MacBook Pro Mic ──┘
  • Other people's voices come out of Discord → routed through the Multi-Output Device (so you still hear them) → also into BlackHole 2ch.
  • Your voice is captured directly from the microphone.
  • resound record runs ffmpeg with both as inputs and mixes them to one mono 16 kHz WAV, then transcribes it.

One-time setup (already done on this Mac — here for reference / other machines)

  1. Install the pieces
    brew install ffmpeg blackhole-2ch whisper-cpp
    # download a model:
    mkdir -p models
    curl -L -o models/ggml-base.en.bin \
      https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin
  2. Create a Multi-Output Device (Audio MIDI Setup → + → Create Multi-Output Device) and tick both your headphones/speakers and BlackHole 2ch.
  3. Send the call to it. Either set the Multi-Output Device as your system output, or, better, set it only for Discord: Discord → Settings → Voice & Video → Output Device → Multi-Output Device. Keep your mic as the Input Device.
  4. Tell Resound the device indices. Run pnpm cli devices and put the BlackHole and mic indices into .env as RESOUND_AUDIO_SYSTEM_DEVICE and RESOUND_AUDIO_MIC_DEVICE (indices can shift when you plug/unplug gear).

Using it

pnpm cli devices                         # confirm current device indices
pnpm cli record --title "Team Sync"      # Enter/q to stop & transcribe
pnpm cli record --title "Sync" --duration 1800   # or auto-stop after 30 min
pnpm cli record --title "Solo" --device 2        # mic only (no system audio)

pnpm cli validate <session>
pnpm cli export   <session> --format md

Permissions

The first time ffmpeg reads an input device, macOS will ask the terminal app for Microphone permission — allow it (System Settings → Privacy & Security → Microphone). Capturing BlackHole counts as audio input too.

Limitations

  • One mixed track → no per-speaker labels. Everyone is attributed to the first participant. True per-speaker diarization needs separate audio per person, as provided by the Discord-native receiver. For a meeting summary + searchable transcript this is usually fine.
  • Use a bigger model (ggml-small.en.bin, ggml-medium.en.bin) for higher accuracy at the cost of speed; point RESOUND_WHISPER_MODEL at it.

Using Slash Commands With Local Capture

Once the local capture path works from the CLI, the Discord bot can control the same local recorder:

RESOUND_BOT_MODE=local-capture
RESOUND_AUDIO_SYSTEM_DEVICE=1
RESOUND_AUDIO_MIC_DEVICE=2
pnpm bot:start

Then use /resound start and /resound stop in Discord. The title is optional, and /resound stop privately delivers the finished Markdown transcript by default. The bot must run on the same Mac that is capturing audio. This is intentionally local-first: every operator can run their own bot and recorder for their own Discord server without depending on a central hosted service.

On /resound stop, the bot now reports separate health checks for meeting/system audio and the local microphone. A silent system track means Discord is not actually routed through BlackHole/Multi-Output; a silent microphone track means the mic index or macOS permission is wrong. Do not trust a meeting capture until both lines show audio detected.

Two-minute end-to-end test

  1. Start the bot with pnpm bot:start and join any Discord voice channel.
  2. Run /resound start title:"Capture Test" (or simply /resound start).
  3. Have someone else speak (or play audio through Discord), then say a distinct sentence yourself.
  4. Run /resound stop.
  5. Confirm both capture-health lines are green and the reply reports transcript segments, then confirm both statements appear in the attached transcript.

The system recorder owns one ffmpeg process at a time. A second start is rejected until the previous capture has been stopped. Concurrent or repeated stop calls share the same result, including a finalization error. Failed ffmpeg exits appear as failed recorder health; pause/resume cannot act on a stopped process. Startup failures release ownership after the child closes, allowing a fresh attempt.

The Pycord adapter rejects overlapping starts and shares concurrent stop outcomes. A stop is complete only after the sidecar process closes, including after it emits its final track list. The idle finalization deadline still applies during process shutdown; termination escalates to SIGKILL after two seconds and waits for close.

The optional JavaScript Discord adapter reserves asynchronous startup and cancels late activation when stopped during dependency loading. Decoder setup failures release the subscription, and a failed pause flush remains a finalization error. These lifecycle guarantees do not establish live DAVE receive support for that optional adapter; Pycord remains the supported Discord receiver.