impress_asr_input/README.md
impressionyang 7c51542918 Initial commit: Impress ASR Input 项目基础框架
功能:
- 基于 ONNX 的语音识别引擎
- 多语言支持(中文、英文、日语、韩语)
- 模型加载器(支持 SenseVoice/Whisper/Paraformer)
- 音频采集和处理模块(VAD、重采样、归一化)
- 文本输出模块(剪贴板)
- CLI 命令行工具
- Electron GUI 界面
- Windows x64 打包配置

文档:
- PRD 产品需求文档
- README 项目说明
- 开发指南
- Windows 构建指南

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-20 16:10:11 +08:00

173 lines
4.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Impress ASR Input
基于 ONNX 的本地语音识别输入工具,支持多语言实时识别和音频文件转写。
## 特性
- 🎯 **本地运行** - 无需联网,保护隐私,无 API 调用成本
- 🌍 **多语言支持** - 中文、英文、日语、韩语等
-**低延迟** - 准实时识别1 秒内完成短句识别
- 💻 **跨平台** - 支持 Windows、macOS、Linux
## 快速开始
### 系统要求
- Node.js >= 20.0.0
- Windows 10+ / macOS 11+ / Ubuntu 20.04+
### 安装
```bash
# 克隆项目
cd impress-asr-input
# 安装依赖
npm install
# 编译 TypeScript
npm run build
```
### 放入模型文件
将 ONNX 模型放入 `models/` 目录:
```bash
models/
├── sensevoice.onnx # 推荐:阿里达摩院多语言模型
├── whisper.onnx # OpenAI 多语言模型
└── paraformer.onnx # 阿里达摩院中文模型
```
模型下载地址:
- SenseVoice: https://huggingface.co/FunAudioLLM/SenseVoice
- Whisper: https://huggingface.co/onnx-community/whisper-base
- Paraformer: https://www.modelscope.cn/models/damo/speech_paraformer-large-vad-punct
### 使用方法
```bash
# 命令行模式 - 开始语音识别
npm start -- start
# 指定语言
npm start -- start -l en
# 转写音频文件
npm start -- transcribe input.wav -o output.txt
# Electron GUI 模式(需要先安装 electron
npm install electron --save-dev
npm run dev:electron
```
## Windows 构建
### 方法一:在 Windows 上构建(推荐)
```powershell
npm run build:win # 构建安装包
npm run build:win:zip # 构建 ZIP 包
```
### 方法二:在 Linux 上构建
```bash
export ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
npm run build:win:dir # 构建解压版本
```
详见:[docs/BUILD_WINDOWS.md](docs/BUILD_WINDOWS.md)
## 项目结构
```
impress-asr-input/
├── src/
│ ├── core/
│ │ ├── audio-processor.ts # 音频处理VAD、重采样
│ │ ├── audio-recorder.ts # 音频采集模块
│ │ ├── index.ts # 模块导出
│ │ ├── model-loader.ts # 模型加载器
│ │ ├── speech-recognizer.ts # ONNX 语音识别引擎
│ │ └── text-output.ts # 文本输出模块
│ ├── ui/
│ │ └── index.html # Electron UI 界面
│ ├── electron-main.ts # Electron 主进程
│ ├── main.ts # CLI 命令行入口
│ ├── preload.ts # Electron 预加载脚本
│ └── utils/
│ └── config.ts # 配置管理
├── models/ # ONNX 模型文件目录
│ ├── README.md # 模型说明
│ └── models.config.json # 模型配置
├── docs/
│ ├── BUILD_WINDOWS.md # Windows 构建指南
│ └── DEVELOPMENT.md # 开发指南
├── scripts/
│ ├── postinstall.js # 安装后脚本
│ └── prepare-build.js # 打包准备脚本
├── dist/ # TypeScript 编译输出
├── release/ # Windows 打包输出
├── test/
│ └── audio-processor.test.ts # 单元测试
├── package.json
├── tsconfig.json
└── PRD.md # 产品需求文档
```
## 开发计划
| 版本 | 状态 | 内容 |
|------|------|------|
| v0.1.0 | ✅ 完成 | 基础框架、单语言识别 demo |
| v0.5.0 | 🔄 进行中 | 多语言支持、Electron GUI |
| v1.0.0 | ⏳ 待开发 | 键盘模拟、批量转写、打包分发 |
## 命令行选项
```bash
# 启动语音识别
npm start -- start [选项]
选项:
-l, --language <lang> 识别语言 (默认zh)
-m, --model <path> 模型文件路径
-o, --output <mode> 输出模式clipboard|keyboard|both (默认clipboard)
# 转写音频文件
npm start -- transcribe <文件> [选项]
选项:
-l, --language <lang> 识别语言 (默认zh)
-m, --model <path> 模型文件路径
-o, --output <file> 输出文件路径
```
## 技术栈
| 模块 | 技术 |
|------|------|
| 运行时 | Node.js 20+ |
| UI 框架 | Electron |
| ONNX 推理 | onnxruntime-web |
| 剪贴板 | clipboardy |
| 命令行 | commander |
| 构建工具 | electron-builder |
## 许可证
MIT
## 贡献
欢迎提交 Issue 和 Pull Request
## 相关资源
- [ONNX Runtime](https://onnxruntime.ai/)
- [SenseVoice Model](https://github.com/FunAudioLLM/SenseVoice)
- [Whisper ONNX](https://github.com/guillaumekln/faster-whisper)
- [Electron 文档](https://www.electronjs.org/docs)