Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

docs: add AGENTS, READMEs, changelog and the release workflow

wqugurucf6989ab1120
diff --git a/.github/release-notes.md b/.github/release-notes.md
new file mode 100644
index 0000000..3c4afee
--- /dev/null
+++ b/.github/release-notes.md
@@ -0,0 +1,3 @@
+Download the `.dmg`, open it and drag **Live Subs** into **Applications**. Requires macOS 26 on Apple silicon.
+
+First launch: **System Settings › Privacy & Security › Open Anyway**.
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..fb90ad2
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,22 @@
+name: build
+
+# macOS runner minutes are billed at 10× for private repositories, so this runs on
+# pull requests and on demand rather than on every push to main.
+on:
+ pull_request:
+ workflow_dispatch:
+
+jobs:
+ build:
+ runs-on: macos-26
+ steps:
+ - uses: actions/checkout@v4
+ - run: swift build
+ - run: scripts/package.sh
+ - uses: actions/upload-artifact@v4
+ with:
+ name: LiveSubs
+ path: |
+ build/LiveSubs-*.dmg
+ build/LiveSubs-*.zip
+ build/checksums.txt
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..49eaf4c
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,29 @@
+name: release
+
+on:
+ push:
+ tags: ["v*.*.*"]
+
+permissions:
+ contents: write
+
+jobs:
+ release:
+ runs-on: macos-26
+ steps:
+ - uses: actions/checkout@v4
+ - name: Check the tag matches Info.plist
+ run: |
+ PLIST=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" Resources/Info.plist)
+ [[ "v$PLIST" == "$GITHUB_REF_NAME" ]] || { echo "tag $GITHUB_REF_NAME != Info.plist $PLIST"; exit 1; }
+ - name: Build and package
+ run: scripts/package.sh
+ env:
+ BUILD_NUMBER: ${{ github.run_number }}
+ - name: Publish the release
+ run: |
+ scripts/release_notes.sh "${GITHUB_REF_NAME#v}" > build/notes.md
+ gh release create "$GITHUB_REF_NAME" build/LiveSubs-*.dmg build/LiveSubs-*.zip build/checksums.txt \
+ --title "Live Subs ${GITHUB_REF_NAME#v}" --notes-file build/notes.md
+ env:
+ GH_TOKEN: ${{ github.token }}
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..e8b50dc
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,62 @@
+# AGENTS.md
+
+Live Subs is a macOS menu bar app that turns whatever the Mac is playing (streams, videos, meetings, voice rooms) into live translated subtitles, keeps every meeting as a bilingual transcript, and can translate what you say back into the room as speech.
+
+## Scope (deliberately small)
+
+- Three surfaces, nothing more: the **menu bar panel** (on/off, heard language, translate-to language, "我说话也翻译", subtitle bar display mode, meeting records, quit), the **subtitle bar** on screen, and the **main window** (meeting records + a small settings sheet). First launch shows a three-step **onboarding** window (permissions, try the sample video, speaking).
+- Listening: system audio (Core Audio process tap, our own process excluded) → spoken-language detection across installed on-device models → on-device transcription (`SpeechAnalyzer` / `SpeechTranscriber`) → translation (Google endpoint) → subtitle bar. Every confirmed sentence goes into the live meeting record.
+- Language detection compares confidence: the same 3–6 s clip after a pause is transcribed by every installed model; a winner needs confidence ≥ 0.6 and a 0.08 lead; the first detection or a 0.35 lead switches at once, otherwise two agreeing detections. After a switch the last 8 s are replayed into the new model.
+- "Follow system" translates into the first system language that differs from the source language.
+- Subtitle bar: shows only while someone talks (auto) or always; tucks into a dot after 2/4/8 s of quiet; fades to 15% and stays click-through while the pointer passes over it; editable after the pointer rests 0.6 s (drag to move, drag the corner to scale, double-click resets); ⌃⌥S hides/shows. Position, width and size are remembered per display.
+- Speaking: hold ⌥ Space → microphone → one `SpeechAnalyzer` per press, finished with `finalizeAndFinishThroughEndOfInput` → translate into the room's language → system voice → the chosen output device (a virtual microphone). The virtual microphone is BlackHole 2ch, installed from the app: download the official notarized package, check its pinned SHA-256, run `installer` through the standard administrator prompt. We never bundle the GPL driver.
+- Meeting records: one folder per meeting, `session.json` + `system.m4a` (+ `mic.m4a`); empty meetings are dropped; export to Markdown, Word (`.docx` via `NSAttributedString`) and SRT. Speaker labels are only "对方" (system audio) and "你" (microphone): no diarization yet.
+- Nothing the user does needs the Terminal. When a feature request fits none of the above, push back before adding UI.
+
+## Design
+
+- Source of truth: the Design canvases in claude.ai (logo directions, onboarding, auto show/hide) and the app itself.
+- Look: light grey ground `#F3F4F6`/`#F6F7F9`, white cards, ink `#15171C`, one accent orange `#E8552B` for "live" (dots, the speaking line, the icon). Text greys `#5A5F6B` / `#6B7080` (they pass 4.5:1 on white).
+- Logo C: white sound bars turning into lines of text on an orange squircle. The app icon is drawn by `Sources/LiveSubsIcon`; the in-app mark (`BrandMark`) and the menu bar template glyph (`BrandImage.menuBar`, 40% when paused) are drawn in code in `Onboarding.swift`.
+- Copy is Chinese, short: one line of grey helper text at most.
+
+## Layout
+
+- `Package.swift`: SwiftPM, macOS 26+, Swift 5 language mode, no dependencies.
+- `Sources/LiveSubs`: the app. Engine files are UI-free: `SystemAudioTap`, `AudioRouter` (resample, feed, ring buffer, recording), `LanguageDetector`, `ListenEngine`, `SpeakEngine` (also the Carbon `HotKey`), `Translator`, `VirtualMic`, `SessionStore` (+ exports). UI: `Overlay` (subtitle bar), `Views` (panel, main window, settings), `Onboarding` (+ sample player, brand mark), `AppModel` (wiring, status item, windows, debug control, `@main`). `DMGBackground` draws the installer background; `DevBuild` tells dev from release.
+- `Sources/LiveSubsIcon`: CLI that renders the icon set (`--dev` adds the DEV band).
+- `Resources/`: `Info.plist`, `sample/` (the 7 s onboarding clip, made by `scripts/make-sample.sh`), `dmg/DS_Store` (installer window layout).
+- `scripts/build.sh`: builds `build/LiveSubs.app`. Without `RELEASE=1` it is a **dev build**: "Live Subs Dev", bundle id `com.wquguru.cicada.dev`, `LiveSubsDev` = `branch @ commit[+]` in Info.plist; "DEV" beside the menu bar glyph, a DEV badge and the stamp in the panel, a DEV band on the icon, its own settings, permissions, `~/Library/Application Support/LiveSubs Dev` and log `/tmp/livesubs-dev-debug.log`. Both builds are signed ad hoc with a fixed designated requirement (the bundle id) so rebuilding keeps the system-audio and microphone permissions. Don't change the release bundle id `com.wquguru.cicada`: permissions are tied to it.
+- `scripts/package.sh`: `RELEASE=1` build (refuses any other bundle id) → `LiveSubs-<version>-macOS-AppleSilicon.dmg` / `.zip` + `checksums.txt`. The DMG background is drawn by the app (`LiveSubs --render-dmg-background out.png <scale>`); the window layout is `Resources/dmg/DS_Store`, made by Finder via `scripts/dmg-template.sh` — rerun it after changing the window, icon positions or background, and keep `DMGBackground.swift` in step.
+- `tools/`: test helpers (remote control, synthetic mouse/keys, window capture, transcription check); see `tools/README.md`.
+
+## Commands
+
+```bash
+swift build # debug build
+scripts/build.sh && open build/LiveSubs.app # dev build (Live Subs Dev)
+RELEASE=1 scripts/build.sh # release build (com.wquguru.cicada)
+scripts/package.sh # DMG + zip + checksums in build/
+scripts/make-sample.sh # regenerate the onboarding sample clip
+```
+
+Debug control: dev builds always accept commands on the distributed notification `com.wquguru.cicada.debug` (release builds only with `defaults write com.wquguru.cicada debug -bool true`, which also logs transcript text). Send them with `tools/lsctl` (`start`, `stop`, `open`, `panel`, `onboarding:<step>`, `samplePlay`, `speakFile:<audio>`, `place:x,y,w,font`, `frame`, `overlayState`, `export:<dir>` …).
+
+Release: `scripts/release.sh <x.y.z>` (clean `main`, a `## x.y.z — <today>` section in `CHANGELOG.md`) bumps `Resources/Info.plist`, commits, tags `v<x.y.z>` and pushes; `.github/workflows/release.yml` (runner `macos-26`) builds the tag, checks it matches Info.plist and publishes the DMG, zip and checksums with notes from `scripts/release_notes.sh`. `build.yml` runs on pull requests and on demand only: macOS minutes are expensive for a private repo.
+
+Only Command Line Tools are required (no Xcode project). Do not add an `.xcodeproj`.
+
+## Verifying changes
+
+Run the app and check the behaviour, not just the build. The pattern used so far: dev build, `tools/lsctl` to drive it, `afplay Resources/sample/sample.m4a` (or `say -o` clips) as the "someone talking" input, read `/tmp/livesubs-dev-debug.log`, screenshot windows with `screencapture -l <id>` (`tools/winall`). Synthetic mouse/key events (`tools/mouse`, `tools/key`, `tools/toggle-key`) need the terminal to have Accessibility access. The real microphone, the BlackHole install (password) and a Mac without permissions need a person.
+
+TODO: unit tests for the pure parts (language-code mapping, detection scoring, SRT/Markdown export). Swift Testing under Command Line Tools needs extra framework search paths (see cameo's `scripts/test.sh`).
+
+## Conventions
+
+- Keep files small and single-purpose; match the existing naming and comment density (comments say why).
+- UI and engine state are `@MainActor`; audio callbacks never touch app state directly (they hand buffers to `AudioRouter`'s queue).
+- No third-party dependencies; system frameworks only.
+- User data: `~/Library/Application Support/LiveSubs/Sessions` and `UserDefaults` (`sourceMode`, `target`, `speakEnabled`, `speakFrom`, `speakTo`, `speakOutput`, `recordAudio`, `overlayAuto`, `overlayHideAfter`, `overlay.<screen>`, `lastDetected`, `onboarded`).
+- Add a line to `CHANGELOG.md` with every user-visible change. Keep `README.md` and `README.zh-CN.md` in step.
+- Commit in coherent batches with a short imperative subject.
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..ff54159
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,12 @@
+# Changelog
+
+One section per release, newest first. `scripts/release.sh` needs the section, dated today;
+the release workflow publishes it as the release notes.
+
+## 2.0.0 — 2026-11-01
+
+- New: spoken-language auto-detection across the installed on-device models; translation target follows the system language or a manual choice.
+- New: menu bar panel, meeting records with Markdown / Word / SRT export, and a three-step first-run guide with a built-in sample video.
+- New: hold ⌥ Space to speak; your words are translated and spoken into a virtual microphone, installed from the app.
+- New: the subtitle bar shows up only while someone talks, tucks away into a dot, turns see-through when the pointer passes; ⌃⌥S shows or hides it.
+- Improved: on-device recognition with macOS 26 SpeechAnalyzer (no audio leaves the Mac), new icon, DMG installer.
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..43c994c
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1 @@
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9749b00
--- /dev/null
+++ b/README.md
@@ -0,0 +1,68 @@
+<p align="center">
+ <img src="docs/icon.png" width="128" height="128" alt="Live Subs icon">
+</p>
+
+<h1 align="center">Live Subs</h1>
+
+<p align="center">
+ Live translated subtitles for anything your Mac plays — and your own voice, translated back into the call.
+</p>
+
+<p align="center">
+ <a href="https://github.com/wquguru/live-subs/releases/latest"><b>Download for macOS</b></a> · <a href="CHANGELOG.md"><b>What’s new</b></a>
+</p>
+
+<p align="center">
+ <img src="https://img.shields.io/badge/macOS-26%2B-black" alt="macOS 26+">
+ <img src="https://img.shields.io/badge/Apple%20silicon-only-black" alt="Apple silicon">
+ <img src="https://img.shields.io/badge/Swift-5-orange" alt="Swift 5">
+</p>
+
+<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a></p>
+
+---
+
+Live Subs listens to what your Mac is playing — a livestream, a video, a meeting, a voice room — works out which language is being spoken, and shows the translation in a small subtitle bar on top of everything. Recognition happens on your Mac; only the recognised text is sent for translation.
+
+## Features
+
+- **Detects the language for you** — every installed on-device speech model listens to the same few seconds; the most confident one wins, usually within half a second.
+- **Translates into your language** — follows your system languages by default (English audio on an English Mac goes to your next language), or pick one.
+- **Stays out of the way** — the subtitle bar appears only while someone talks, tucks into a small dot when it's quiet, and turns see-through when your pointer passes over it, so you can still click what's underneath. Rest the pointer on it to drag or resize; ⌃⌥S hides it.
+- **Speak back** — hold ⌥ Space and talk; the room hears your words translated, through a virtual microphone you install from the app.
+- **Meeting records** — every session is saved as a bilingual transcript (with the audio, on your Mac only) and exports to Markdown, Word or SRT.
+- **Private by design** — audio capture, language detection and speech recognition all run on-device.
+
+## Requirements
+
+- macOS 26 on Apple silicon
+- Building from source: Xcode Command Line Tools (`xcode-select --install`)
+
+## Installation
+
+Download **`LiveSubs-<version>-macOS-AppleSilicon.dmg`** from [Releases](https://github.com/wquguru/live-subs/releases), open it and drag **Live Subs** into **Applications**. A `.zip` of the app and `checksums.txt` (SHA-256) sit next to it.
+
+The app is ad-hoc signed (not notarized). On first launch macOS blocks it: open **System Settings › Privacy & Security** and click **Open Anyway**.
+
+The first launch walks you through three steps: turn on **system audio recording** (and, optionally, the microphone), play the built-in sample to see subtitles appear, and — if you want to speak back — install the virtual microphone with one click (it asks for your password once).
+
+## Usage
+
+1. Play anything with sound. Subtitles appear at the bottom of the screen.
+2. Click the menu bar icon to change the heard language (auto by default), the language to translate into, or how the subtitle bar behaves.
+3. To speak back: turn on **我说话也翻译**, choose **BlackHole 2ch** as the microphone in your meeting app, then hold ⌥ Space while you talk.
+4. **会议记录** in the panel opens your transcripts: search, switch between bilingual / original / translation, export.
+
+### Uninstall
+
+Quit Live Subs and move it to the Trash. Transcripts and recordings stay in `~/Library/Application Support/LiveSubs` until you delete them; settings are in `defaults delete com.wquguru.cicada`.
+
+## Development
+
+```bash
+scripts/build.sh # dev build → build/LiveSubs.app ("Live Subs Dev", runs beside the installed app)
+open build/LiveSubs.app
+scripts/package.sh # release DMG + zip + checksums
+```
+
+See [AGENTS.md](AGENTS.md) for the architecture, dev vs release builds, packaging, testing and releases.
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 0000000..7be0112
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,79 @@
+<p align="center">
+ <img src="docs/icon.png" width="128" height="128" alt="Live Subs 图标">
+</p>
+
+<h1 align="center">Live Subs</h1>
+
+<p align="center">
+ Mac 上正在播放的任何声音,都实时翻译成字幕;你说的话,也能翻译成语音发回会议里。
+</p>
+
+<p align="center">
+ <a href="https://github.com/wquguru/live-subs/releases/latest"><b>下载 macOS 版</b></a> · <a href="CHANGELOG.md"><b>更新内容</b></a>
+</p>
+
+<p align="center">
+ <img src="https://img.shields.io/badge/macOS-26%2B-black" alt="macOS 26+">
+ <img src="https://img.shields.io/badge/Apple%20silicon-only-black" alt="Apple 芯片">
+ <img src="https://img.shields.io/badge/Swift-5-orange" alt="Swift 5">
+</p>
+
+<p align="center"><a href="README.md">English</a> · <a href="README.zh-CN.md">简体中文</a></p>
+
+---
+
+Live Subs 听电脑里正在播放的声音,比如直播、视频、会议或语音房。它先判断说的是哪种语言,再把翻译显示在置顶的小字幕条上。语音识别在本机完成,只有识别出的文字会发去翻译。
+
+## 功能
+
+- **自动识别语言**:所有已安装的本机语音模型同时听同一段声音,最有把握的那个胜出,通常半秒内就能判断出来。
+- **翻译成你的语言**:默认跟随系统语言。如果系统是英文、对方说的也是英文,就翻成你的第二首选语言。也可以手动指定。
+- **不挡操作**:
+ - 有人说话时字幕条才出现,安静后收成一个小点;
+ - 鼠标经过时字幕条会变透明,下面的按钮照样能点;
+ - 鼠标停住不动,就可以拖动、缩放字幕条;
+ - ⌃⌥S 随时隐藏或显示。
+- **说话也能翻译**:按住 ⌥ Space 说话,会议里的人听到的是翻译后的语音。这需要一个虚拟麦克风,在 App 里一键安装。
+- **会议记录**:每场会议都自动存成双语稿子(录音只存在本机),可以导出 Markdown、Word 或 SRT。
+- **隐私**:声音采集、语言识别、语音识别都在本机完成。
+
+## 系统要求
+
+- macOS 26,Apple 芯片
+- 从源码构建:Xcode Command Line Tools(`xcode-select --install`)
+
+## 安装
+
+1. 从 [Releases](https://github.com/wquguru/live-subs/releases) 下载 **`LiveSubs-<版本>-macOS-AppleSilicon.dmg`**。旁边还有一个 `.zip` 和 `checksums.txt`(SHA-256 校验值)。
+2. 打开 DMG,把 **Live Subs** 拖进「应用程序」。
+3. 第一次打开会被系统拦住,因为 App 没有经过公证。去 **系统设置 › 隐私与安全性**,点 **仍要打开**。
+
+第一次打开时有三步引导:
+
+1. 打开「听电脑里的声音」,麦克风可选;
+2. 播放内置的示例视频,看字幕出来;
+3. 如果想让对方听到你的翻译,一键安装虚拟麦克风(只需要输一次电脑密码)。
+
+## 使用
+
+1. 播放任何有声音的内容,字幕会出现在屏幕下方。
+2. 点菜单栏图标,可以改“听到”的语言(默认自动识别)、“翻译成”的语言,以及字幕条的显示方式。
+3. 想让对方听到你的翻译:
+ - 打开 **我说话也翻译**;
+ - 在会议软件里把麦克风选成 **BlackHole 2ch**;
+ - 说话时按住 ⌥ Space。
+4. 面板里的 **会议记录** 可以看所有稿子:能搜索,能切换双语、原文、译文,也能导出。
+
+### 卸载
+
+退出 Live Subs,把它拖进废纸篓即可。会议稿子和录音保存在 `~/Library/Application Support/LiveSubs`,需要的话手动删除。设置可以用 `defaults delete com.wquguru.cicada` 清除。
+
+## 开发
+
+```bash
+scripts/build.sh # 开发版 → build/LiveSubs.app(“Live Subs Dev”,可以和正式版同时运行)
+open build/LiveSubs.app
+scripts/package.sh # 正式版 DMG、zip 和校验值
+```
+
+架构、开发版和正式版的区别、打包、测试、发布流程,见 [AGENTS.md](AGENTS.md)。
diff --git a/docs/icon.png b/docs/icon.png
new file mode 100644
index 0000000..5ace82c
Binary files /dev/null and b/docs/icon.png differ
diff --git a/scripts/release.sh b/scripts/release.sh
new file mode 100755
index 0000000..05c0b8e
--- /dev/null
+++ b/scripts/release.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Cuts a release: scripts/release.sh 2.1.0
+# Needs a "## 2.1.0 — <today>" section in CHANGELOG.md. Sets the version in Resources/Info.plist,
+# commits, tags v<version> and pushes; the release workflow builds and publishes the DMG.
+set -euo pipefail
+cd "$(dirname "$0")/.."
+
+VERSION=${1:?usage: scripts/release.sh <version, e.g. 2.1.0>}
+[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "version must look like 1.2.3" >&2; exit 1; }
+[[ -z "$(git status --porcelain)" ]] || { echo "working tree is not clean" >&2; exit 1; }
+[[ "$(git branch --show-current)" == main ]] || { echo "release from main" >&2; exit 1; }
+git rev-parse "v$VERSION" >/dev/null 2>&1 && { echo "tag v$VERSION already exists" >&2; exit 1; }
+grep -q "^## $VERSION — $(date +%Y-%m-%d)" CHANGELOG.md \
+ || { echo "add \"## $VERSION — $(date +%Y-%m-%d)\" to CHANGELOG.md first" >&2; exit 1; }
+
+/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $VERSION" Resources/Info.plist
+git commit -m "Release v$VERSION" Resources/Info.plist
+git tag -a "v$VERSION" -m "Live Subs $VERSION"
+git push origin main "v$VERSION"
+echo "Pushed v$VERSION; follow it at https://github.com/wquguru/live-subs/actions/workflows/release.yml"
diff --git a/scripts/release_notes.sh b/scripts/release_notes.sh
new file mode 100755
index 0000000..30854b9
--- /dev/null
+++ b/scripts/release_notes.sh
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+# Prints the release notes for one version: its CHANGELOG.md section, then .github/release-notes.md.
+# scripts/release_notes.sh 2.0.0
+set -euo pipefail
+cd "$(dirname "$0")/.."
+VERSION=${1:?usage: scripts/release_notes.sh <version>}
+awk -v v="$VERSION" '
+ /^## / { on = ($2 == v) ; next }
+ on { print }
+' CHANGELOG.md | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}'
+echo
+cat .github/release-notes.md