Skip to content

darkLordIceCream/darkmic

Repository files navigation

English  |  简体中文


darkmic

Phone → PC  ·  Wireless Microphone

Turn your mobile device into a Windows PC microphone.
Chromium-based browser only.  Zero install on device.  No cloud.


release updated license
Chromium Windows TypeScript pnpm Opus WebSocket


How It Works · Features · Quick Start · Architecture · Dev · Status · FAQ



⚡  How It Works

                        ┌─────────────────────────────────────────────────┐
                        │          📱 MOBILE DEVICE (Chromium)              │
                        │                                                 │
                        │   Open URL from terminal                         │
                        │   Tap "Start Microphone"                         │
                        │   Start speaking                                 │
                        │                                                 │
                        │   getUserMedia                                   │
                        │     → MediaStreamTrackProcessor                  │
                        │     → AudioEncoder (opus · 48kHz · mono)        │
                        │     → WebSocket send                             │
                        │                       │                         │
                        └───────────────────────│─────────────────────────┘
                                                │  HTTPS + WebSocket
                                                │  (local network · ~80ms)
                                                │
                        ┌───────────────────────│─────────────────────────┐
                        │                       ▼                         │
                        │           🖥️  WINDOWS PC (darkmic.exe)          │
                        │                                                 │
                        │   WebSocket receive                              │
                        │     → opusscript decode (opus → PCM)            │
                        │     → WinMM waveOut → VB-CABLE Input            │
                        │     → VB-CABLE Output (system virtual mic)       │
                        │                                                 │
                        │   ✅ Any app sees it as a normal microphone      │
                        └─────────────────────────────────────────────────┘

Audio flows one-way (phone → PC).  End-to-end latency ~ 80ms.


✨  Features

📱  Zero install on device Just a Chromium browser — no app store needed
🔒  Local network only No cloud, no data leaves your home
⚡  ~80ms latency WebCodecs AudioEncoder, measured via ping/pong
🎚️  Auto Gain Control DynamicsCompressorNode smooths speaking volume
🎵  Adaptive bitrate Auto-switches 32↔64kbps based on latency
📊  Live latency Real-time one-way ms on dashboard + phone
🔊  Opus codec Speech-optimized, efficient bandwidth
🔌  VB-Cable output System-level virtual microphone device
📦  Single .exe Packaged via pkg, FFmpeg bundled alongside
🖥️  Windows 10/11 Any mobile device with Chromium browser
🌐  QR connect Scan QR on PC dashboard to connect phone

🚀  Quick Start

Prerequisites

# Install system dependencies (Windows)
winget install ffmpeg
winget install OpenSSL.Light

Important

Also required: VB-Cable (virtual audio driver) and a Chromium-based browser (Chrome, Edge, Brave, etc.) on both PC and mobile. Both devices on the same WiFi.

Run

git clone https://github.com/darkLordIceCream/darkmic.git
cd darkmic
pnpm install
pnpm run dev

The terminal shows your LAN IPs:

  ➜  Dashboard: https://localhost:3000
  ➜  Phone:     https://192.168.1.100:3000/phone

Connect

Open https://localhost:3000 on your PC — the dashboard appears with a QR code
Scan the QR code with your mobile device's browser, or open the Phone URL manually
Tap Advanced → Proceed (self-signed cert — expected)
Tap "Start Microphone" → allow mic permission
Speak — audio streams to your PC's VB-Cable virtual microphone

🏗️  Architecture

Tech Stack

Layer Technology
Server runtime Node.js + TypeScript
HTTP Express
WebSocket ws
Audio encode (browser) WebCodecs AudioEncoder (opus)
Audio decode (server) opusscript (pure JS)
Audio output WinMM waveOut via koffi
Packaging @yao-pkg/pkg

Project Layout

darkmic/
├── src/                    # PC server (TypeScript)
│   ├── index.ts            # HTTPS + WebSocket + Express
│   ├── cert.ts             # Self-signed SSL cert generation
│   ├── audio.ts            # AudioPipe factory (3 modes)
│   └── wasapi.ts           # WinMM waveOut → VB-Cable
├── public/                 # Web app pages
│   ├── pc.html             # PC dashboard (QR code, metrics, event log)
│   ├── index.html          # Phone UI
│   └── client.js           # WebCodecs + WebSocket + auto-reconnect
├── scripts/                # Dev utilities
├── AGENTS.md               # AI agent instructions
├── feature_list.json       # Feature tracker
├── progress.md             # Session log
└── init.sh                 # Verification script

Future: If lower latency is needed, upgrade transport to WebRTC (RTCPeerConnection). WebSocket becomes signaling only.


🧪  Development

./init.sh               # Full verification (install + typecheck + build + audio test)
pnpm run dev            # Dev server with hot reload
pnpm run typecheck      # TypeScript type check only
pnpm run build          # Compile TypeScript to dist/
pnpm run start          # Production server (node dist/index.js)
pnpm test:audio         # Audio pipe test → file mode
pnpm test:audio -- ffplay   # Audio pipe test → speaker playback
pnpm test:audio -- wasapi   # Audio pipe test → VB-Cable output

✅  Feature Status

ID Feature Completed
F-001 Project scaffold + HTTPS certs 2026-05-13 done
F-002 WebCodecs + WebSocket pipeline 2026-05-13 done
F-003 opusscript decode → WinMM → VB-Cable 2026-05-16 done
F-004 QR code + PC dashboard + auto-reconnect 2026-05-16 done
F-005 AGC + adaptive bitrate + latency measurement 2026-05-16 done
F-006 WebRTC P2P transport deferred
F-007 Windows pkg packaging todo
F-008 Installer + system tray todo

❓  FAQ

Why does the browser show a privacy warning?
The server generates a self‑signed SSL certificate on first run. Chrome warns because it isn't signed by a public CA. Your connection is still encrypted — perfectly safe for local network use. Tap Advanced → Proceed to continue.

Can I use Safari or Firefox?
No. This project requires a Chromium-based browser (Chrome, Edge, Brave, Opera, etc.) on both mobile and PC. It uses WebCodecs AudioEncoder which is only implemented in Chromium.

Can I use this over the internet?
No. darkmic is designed for local network only (same WiFi subnet). There is no STUN/TURN, no cloud relay, no NAT traversal.



English  |  简体中文

Built for when you need a mic but don't have one.  © 2026 darkLordIceCream

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors