pi-voice README

项目的 README,来自 github.com/earendil-works/pi-voice。合并为一个 markdown 文件:README.md。

Pi Voice

Local speech-to-text for Pi.

Press a keyboard shortcut, talk, and the resulting transcript will be put directly into your chat.

Install

Install the npm package:

pi install npm:@earendil-works/pi-voice

If you prefer being on the development tip, you can install from GitHub:

pi install ssh://[email protected]/earendil-works/pi-voice

Usage

The extension registers:

/transcribe remains available as a compatibility alias for /voice-settings.

Upgrading from pi-transcribe

It's recommended to install Pi Voice via NPM. If you have an older install of pi-transcribe uninstall it via:

pi remove git:github.com/earendil-works/pi-transcribe

If you installed it into a project with -l, run pi remove -l git:github.com/earendil-works/pi-transcribe from that project instead. Then install Pi Voice with:

pi install npm:@earendil-works/pi-voice

File transcription and FFmpeg

The agent can call transcribe_file for local audio or video files. Decoded audio is limited to 512 MiB (about 2.3 hours). File decoding requires the ffmpeg executable. Install FFmpeg with your system package manager if you don't already have it installed

# macOS with Homebrew
brew install ffmpeg

# Debian or Ubuntu
sudo apt install ffmpeg

# Windows with winget
winget install Gyan.FFmpeg

If FFmpeg is installed outside PATH, point Pi Voice at it before starting Pi:

export PI_VOICE_FFMPEG_PATH=/path/to/ffmpeg

The legacy PI_TRANSCRIBE_FFMPEG_PATH variable remains supported when PI_VOICE_FFMPEG_PATH is not set.

When FFmpeg is unavailable, transcribe_file reports platform-specific guidance to the agent. The agent should ask before running a package-manager command. Model setup is still explicit: run /voice-settings once in the interactive TUI to choose and, after confirmation, download a local model.

Keeping transcribe_file out of the context

To keep transcribe_file out of the model's tool list and the codemode description while leaving it discoverable and callable, set transcribeFileExposure in ~/.pi/agent/pi-voice.json from "direct" to "deferred" once /voice-settings has run (add the key if the file predates it):

"transcribeFileExposure": "deferred"

Applies on the next start or /reload. Scripts find it with searchTools() when codemode is enabled ("defaultTools": ["+codemode"]), and tool_search can load it if enabled. Requires Pi 0.99.2 or later; older Pi ignores it. Resuming a session started before the change keeps the tool declared in that session.

Developing & Building Pi Voice

To develop or run it from a checkout:

git clone [email protected]:earendil-works/pi-voice.git
cd pi-voice
npm install --ignore-scripts
pi -e .

If you want to be able to re-run onboarding you can enable the debug env var when starting Pi. This enables the /voice-onboarding command.

PI_VOICE_DEBUG=1 pi -e /absolute/path/to/pi-voice

pi-voice (earendil-works/pi-voice)

正在搜索数据库…

这是什么?这是 Pi 编程助手的语音转文字扩展:按下快捷键,开口说话,转写结果就会插入到你编辑器的光标处。所有转写都在你自己的电脑上本地完成。
这是一个独立的软件,还是需要接入其他工具?它以扩展的形式接入 Pi,不是独立软件。它会添加一个录音快捷键、一个用于设置的 /transcribe 命令,以及一个叫 transcribefile 的工具,助手可以调用它来处理本地的音频或视频文件。
怎么安装设置?直接从 GitHub 安装(npm 发布版已在计划中),然后在 Pi 的交互式 TUI 里运行一次 /transcribe,选择一个模型,经你确认后下载。
除了扩展本身,我还需要安装什么?需要 Node.js 22 或更新版本。只有转写音频和视频文件时才需要 FFmpeg——对着麦克风听写不需要它;如果 FFmpeg 不在 PATH 里,你可以在启动 Pi 之前把它的路径指给 pi-transcribe。
我能从系统里的任何软件开始录音吗?不能——这个快捷键是 Pi 终端里的绑定,不是系统级的全局热键,所以只有在 Pi 获得焦点时才能开始录音。
我的声音会传到我的电脑之外吗?不会:音频用你在 TUI 中确认后下载的模型在本地转写。唯一涉及网络的步骤就是那一次性的模型下载。
助手能自己转写音频文件吗?可以,通过它的 transcribefile 工具。所有任务共用一个已加载的模型,麦克风听写的优先级更高,会在当前文件任务结束后立即处理;文件任务最多同时运行两个,共用一个 FFmpeg 解码器,解码上限为 128 MiB(约 35 分钟)。
是不是所有模型都能在我还在说话时就开始转写?不是——支持流式处理的模型会在录音过程中以大约 500 毫秒的分块进行处理,而其他模型要等你停止说话后才转写完整的录音。
如果设置过程中出了问题,有没有办法重新走一遍设置流程?有,但仅用于调试:用 PITRANSCRIBEDEBUG=1 启动 Pi,然后运行 /transcribe-onboarding。在选好模型之前取消的话,你当前的配置不会改变。
大小
1.5 MB
星标
326
更新
提交Nov 11
时长
3个月
提交 · 90 天