release v0.2.0

- 更新和增加文档
- 添加新的图片
- 优化文档结构和内容
This commit is contained in:
himeditator
2025-07-05 17:11:25 +08:00
parent 50ea9c5e4c
commit 213426dace
32 changed files with 609 additions and 93 deletions

View File

@@ -4,42 +4,55 @@
<p>Auto Caption 是一个跨平台的实时字幕显示软件。</p>
<p>
| <b>简体中文</b>
| <a href="https://github.com/HiMeditator/auto-caption/blob/main/README_en.md">English</a> |
| <a href="./README_en.md">English</a>
| <a href="./README_ja.md">日本語</a> |
</p>
<p><i>v0.2.0版本已经发布。预计将添加本地字幕引擎的v1.0.0版本正在开发中...</i></p>
</div>
<p style="color:red;text-align:center;">新版本的开发正在进行中新特性包括本地字幕引擎、英日语国际化以及暗色主题还将修复已知bug和提示使用体验预计将于本月之内发布。</p>
![](./assets/media/main.png)
![](./assets/media/main_zh.png)
## 📥 下载
[GitHub Releases](https://github.com/HiMeditator/auto-caption/releases)
## 📚 用户手册
## 📚 相关文档
[Auto Caption 用户手册](./assets/user-manual_zh.md)
[Auto Caption 用户手册](./docs/user-manual/zh.md)
[字幕引擎说明文档](./assets/engine-manual_zh.md)
[字幕引擎说明文档](./docs/engine-manual/zh.md)
[项目 API 文档](./docs/api-docs/electron-ipc.md)
### 基本使用
目前仅提供了 Windows 平台的可安装版本。如果使用默认的 Gummy 字幕引擎,需要获取阿里云百炼平台的 API KEY 并配置到环境变量中才能正常使用该模型。相关教程:[获取 API KEY](https://help.aliyun.com/zh/model-studio/get-api-key)、[将 API Key 配置到环境变量](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)。
目前仅提供了 Windows 平台的可安装版本。如果使用默认的 Gummy 字幕引擎,首先需要获取阿里云百炼平台的 API KEY 并配置到环境变量中,这样才能正常使用该模型。
对于开发者,可以自己开发新的字幕引擎,自定义字幕引擎的开发请参考[字幕引擎说明文档](./assets/engine-manual_zh.md)。
**国际版的阿里云服务并没有提供 Gummy 模型,因此目前非中国用户无法使用默认字幕引擎。我正在开发新的本地字幕引擎,以确保所有用户都有默认字幕引擎可以使用。**
相关教程:
- [获取 API KEY](https://help.aliyun.com/zh/model-studio/get-api-key)
- [将 API Key 配置到环境变量](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)。
如果你想了解字幕引擎的工作原理,或者你想开发自己的字幕引擎,请参考[字幕引擎说明文档](./docs/engine-manual/zh.md)。
## ✨ 特性
- 多界面语言支持
- 丰富的字幕样式设置
- 灵活的字幕引擎选择
- 多语言识别与翻译
- 字幕记录展示与导出
- 生成音频输出和麦克风输入的字幕
说明:Windows 平台支持生成音频输出和麦克风输入的字幕Linux 平台仅支持生成麦克风输入的字幕。
说明:
- Windows 平台支持生成音频输出和麦克风输入的字幕
- Linux 平台目前仅支持生成麦克风输入的字幕
- 目前还没有适配 macOS 平台
## 🚀 项目运行
![](./assets/media/structure.png)
![](./assets/media/structure_zh.png)
### 安装依赖
@@ -49,16 +62,6 @@ npm install
### 构建字幕引擎
> #### 背景介绍
>
> 如果你是开发者,想开发自定义字幕引擎,请查看[字幕引擎说明文档](./assets/engine-manual_zh.md)。
>
> 所谓的字幕引擎实际上是一个子程序,它会实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。生成的字幕通过 IPC 输出为转换为字符串的 JSON 数据,并返回给主程序。主程序读取字幕数据,处理后显示在窗口上。
>
>目前项目默认使用[阿里云 Gummy 模型](https://help.aliyun.com/zh/model-studio/gummy-speech-recognition-translation/),需要获取阿里云百炼平台的 API KEY 并配置到环境变量中才能正常使用该模型。
>
> 本项目的 gummy 字幕引擎是一个 python 子程序,通过 pyinstaller 打包为可执行文件。 运行字幕引擎子程序的代码在 `src\main\utils\engine.ts` 文件中。
首先进入 `caption-engine` 文件夹,执行如下指令创建虚拟环境:
```bash
@@ -74,7 +77,7 @@ subenv/Scripts/activate
source subenv/bin/activate
```
然后安装依赖(注意如果是 Linux 环境,需要注释 `requirements.txt` 中的 `PyAudioWPatch`,该模块仅适用于 Windows 环境):
然后安装依赖(注意如果是 Linux 环境,需要注释 `requirements.txt` 中的 `PyAudioWPatch`,该模块仅适用于 Windows 环境):
```bash
pip install -r requirements.txt
@@ -100,7 +103,7 @@ npm run dev
```bash
# For windows
npm run build:win
# For macOS
# For macOS, not avaliable yet
npm run build:mac
# For Linux
npm run build:linux

View File

@@ -1,51 +1,57 @@
<div align="center" >
<img src="./resources/icon.png" width="100px" height="100px"/>
<h1 align="center">auto-caption</h1>
<p>Auto Caption is a cross-platform real-time subtitle display software.</p>
<p>Auto Caption is a cross-platform real-time caption display software.</p>
<p>
| <a href="https://github.com/HiMeditator/auto-caption/blob/main/README.md">简体中文</a>
| <b>English</b> |
| <a href="./README.md">Chinese</a>
| <b>English</b>
| <a href="./README_ja.md">Japanese</a> |
</p>
<p><i>Version v0.2.0 has been released. Version v1.0.0, which is expected to add a local caption engine, is under development...</i></p>
</div>
<p style="color:red;text-align:center;">The development of the new version is underway, featuring a local subtitle engine, English/Japanese internationalization, and a dark theme. It will also include fixes for known bugs and improvements to the user experience. It is expected to be released within this month.</p>
![](./assets/media/main.png)
## ⚠️ Attention
**The current software interface language is Chinese. English adaptation has not been done yet.**
![](./assets/media/main_en.png)
## 📥 Download
[GitHub Releases](https://github.com/HiMeditator/auto-caption/releases)
## 📚 User Manual
## 📚 Related Documentation
[Auto Caption User Manual (Chinese)](./assets/user-manual_en.md)
[Auto Caption User Manual](./docs/user-manual/en.md)
[Caption Engine Documentation (Chinese)](./assets/engine-manual_en.md)
[Caption Engine Explanation Document](./docs/engine-manual/en.md)
[Project API Documentation (Chinese)](./docs/api-docs/electron-ipc.md)
### Basic Usage
Currently, only an installable version for the Windows platform is provided. If using the default Gummy subtitle engine, you need to obtain an API KEY from Alibaba Cloud's Bailian platform and configure it in the environment variables to use the model properly. Related tutorials: [Get API KEY](https://help.aliyun.com/zh/model-studio/get-api-key), [Configure API Key through Environment Variables](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables).
Currently, only an installable version for the Windows platform is provided. If you want to use the default Gummy caption engine, you first need to obtain an API KEY from the Alibaba Cloud Model Studio and configure it in the environment variables. This is necessary to use the model properly.
For developers, you can create a new subtitle engine. For instructions on customizing the subtitle engine, please refer to the [Caption Engine Documentation (Chinese)](./assets/engine-manual_zh.md).
**The international version of Alibaba Cloud does not provide the Gummy model, so non-Chinese users currently cannot use the default caption engine. I am trying to develop a new local caption engine to ensure that all users have access to a default caption engine.**
Relevant tutorials:
- [Obtain API KEY (Chinese)](https://help.aliyun.com/zh/model-studio/get-api-key)
- [Configure API Key in Environment Variables (Chinese)](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables).
If you want to understand how the caption engine works or if you want to develop your own caption engine, please refer to the [Caption Engine Explanation Document](./docs/engine-manual/en.md).
## ✨ Features
- Rich subtitle style settings
- Flexible subtitle engine selection
- Multi-language interface support
- Rich caption style settings
- Flexible caption engine selection
- Multi-language recognition and translation
- Subtitle record display and export
- Generate subtitles for audio output and microphone input
- Caption record display and export
- Generate captions for audio output and microphone input
Note: The Windows platform supports generating subtitles for both audio output and microphone input, while the Linux platform only supports generating subtitles for microphone input.
Notes:
- The Windows platform supports generating captions for both audio output and microphone input.
- The Linux platform currently only supports generating captions for microphone input.
- The macOS platform is not yet supported.
## 🚀 Project Execution
![](./assets/media/structure.png)
![](./assets/media/structure_en.png)
### Install Dependencies
@@ -53,19 +59,9 @@ Note: The Windows platform supports generating subtitles for both audio output a
npm install
```
### Build Subtitle Engine
### Build Caption Engine
> #### Background
>
> If you are a developer and want to develop a custom subtitle engine, please refer to the [Caption Engine Documentation (Chinese)](./assets/engine-manual_zh.md).
>
> The so-called subtitle engine is actually a subprocess that will real-time acquire streaming data from system audio input (recording) or output (playing sound) and call an audio-to-text model to generate corresponding subtitles for the audio. The generated subtitles are output as JSON data converted to strings via IPC and returned to the main program. The main program reads the subtitle data, processes it, and displays it on the window.
>
> Currently, the project uses the [Alibaba Cloud Gummy Model](https://help.aliyun.com/zh/model-studio/gummy-speech-recognition-translation/) by default, which requires obtaining an API KEY from Alibaba Cloud's Bailian platform and configuring it in the environment variables to function properly. Related tutorials: [Get API KEY](https://help.aliyun.com/zh/model-studio/get-api-key), [Configure API Key through Environment Variables](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables).
>
> The gummy subtitle engine in this project is a Python subprocess, packaged into an executable file using pyinstaller. The code for running the subtitle engine subprocess is in the `src\main\utils\engine.ts` file.
First, enter the `caption-engine` folder and execute the following command to create a virtual environment:
First, navigate to the `caption-engine` folder and execute the following command to create a virtual environment:
```bash
python -m venv subenv
@@ -80,7 +76,7 @@ subenv/Scripts/activate
source subenv/bin/activate
```
Then install the dependencies (note that if you are in a Linux environment, you need to comment out `PyAudioWPatch` in `requirements.txt`, as this module is only applicable to the Windows environment):
Next, install the dependencies (note that if you are in a Linux environment, you should comment out `PyAudioWPatch` in `requirements.txt`, as this module is only applicable to the Windows environment):
```bash
pip install -r requirements.txt
@@ -92,23 +88,21 @@ Then build the project using `pyinstaller`:
pyinstaller --onefile main-gummy.py
```
At this point, the project is built. You can find the corresponding executable file in the `caption-engine/dist` folder. You can proceed with further operations.
At this point, the project is built. You can find the executable file in the `caption-engine/dist` folder and proceed with further operations.
### Run the Project
```bash
npm run dev
```
### Build the Project
Please note that the software is currently not compatible with the macOS platform. Use Windows or Linux systems for building, with Windows being more recommended as it implements the full set of features.
Note that the software is currently not adapted for the macOS platform. Please use Windows or Linux systems for building, with Windows being more recommended due to its full functionality.
```bash
# For Windows
npm run build:win
# For macOS
# For macOS, not avaliable yet
npm run build:mac
# For Linux
npm run build:linux

109
README_ja.md Normal file
View File

@@ -0,0 +1,109 @@
<div align="center" >
<img src="./resources/icon.png" width="100px" height="100px"/>
<h1 align="center">auto-caption</h1>
<p>Auto Caption はクロスプラットフォームのリアルタイム字幕表示ソフトウェアです。</p>
<p>
| <a href="./README.md">簡体中文</a>
| <a href="./README_en.md">英語</a>
| <b>日本語</b> |
</p>
<p><i>v0.2.0 バージョンがリリースされました。ローカル字幕エンジンを追加予定の v1.0.0 バージョンが開発中...</i></p>
</div>
![](./assets/media/main_ja.png)
## 📥 ダウンロード
[GitHub Releases](https://github.com/HiMeditator/auto-caption/releases)
## 📚 関連ドキュメント
[Auto Caption ユーザーマニュアル](./docs/user-manual/ja.md)
[字幕エンジン説明文書](./docs/engine-manual/ja.md)
[プロジェクト API ドキュメント(中国語)](./docs/api-docs/electron-ipc.md)
### 基本的な使用方法
現在、Windows プラットフォーム向けのインストール可能なバージョンのみ提供されています。デフォルトの Gummy 字幕エンジンを使用する場合、まず Alibaba Cloud 百煉プラットフォームの API キーを取得し、環境変数に設定する必要があります。これによりモデルが正常に動作します。
**アリババクラウドの国際版には Gummy モデルが提供されていないため、中国以外のユーザーは現在、デフォルトの字幕エンジンを使用できません。すべてのユーザーが利用できるように、新しいローカルの字幕エンジンを開発中です。**
関連チュートリアル:
- [API キーの取得(中国語)](https://help.aliyun.com/zh/model-studio/get-api-key)
- [環境変数への API キーの設定(中国語)](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)。
字幕エンジンの仕組みを理解したい場合、または独自の字幕エンジンを開発したい場合は、[字幕エンジン説明文書](./docs/engine-manual/ja.md)を参照してください。
## ✨ 特徴
- 複数言語のインターフェースサポート
- 豊富な字幕スタイル設定
- 柔軟な字幕エンジン選択
- 複数言語の認識と翻訳
- 字幕記録の表示とエクスポート
- オーディオ出力とマイク入力の字幕生成
注意事項:
- Windows プラットフォームでは、オーディオ出力とマイク入力の両方の字幕生成がサポートされています。
- Linux プラットフォームでは、現在マイク入力の字幕生成のみがサポートされています。
- 現在、macOS プラットフォームには対応していません。
## 🚀 プロジェクトの実行
![](./assets/media/structure_ja.png)
### 依存関係のインストール
```bash
npm install
```
### 字幕エンジンのビルド
まず、`caption-engine` フォルダに移動し、以下のコマンドを実行して仮想環境を作成します:
```bash
python -m venv subenv
```
次に、仮想環境をアクティブ化します:
```bash
# Windows
subenv/Scripts/activate
# Linux
source subenv/bin/activate
```
次に、依存関係をインストールしますLinux 環境の場合、`requirements.txt``PyAudioWPatch` をコメントアウトする必要があります。このモジュールは Windows 環境でのみ適用されます):
```bash
pip install -r requirements.txt
```
次に、`pyinstaller` を使用してプロジェクトをビルドします:
```bash
pyinstaller --onefile main-gummy.py
```
この時点でプロジェクトのビルドが完了し、`caption-engine/dist` フォルダで対応する実行ファイルを見つけることができます。その後、必要な操作を行ってください。
### プロジェクトの実行
```bash
npm run dev
```
### プロジェクトのビルド
現在、ソフトウェアは macOS プラットフォームに対応していません。Windows または Linux システムを使用してビルドしてください。完全な機能を備えた Windows プラットフォームが推奨されます。
```bash
# For Windows
npm run build:win
# For macOS, not avaliable yet
npm run build:mac
# For Linux
npm run build:linux
```

View File

@@ -1,5 +0,0 @@
- [x] 添加英语和日语语言支持
- [ ] 优化长字幕显示效果
- [x] 添加暗色主题
- [ ] 修复字幕引擎空置报错的问题
- [ ] 添加更多字幕引擎

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 KiB

BIN
assets/media/main_en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

BIN
assets/media/main_ja.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

BIN
assets/media/main_zh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

BIN
assets/structure.pptx Normal file

Binary file not shown.

View File

@@ -21,15 +21,16 @@
- 添加用户说明文档
- 添加字幕引擎说明文档
## v1.0.0
## v0.2.0
2025-07-
2025-07-05
本版本为正式版。
对项目进行了重构,修复了 bug添加了新功能。本版本为正式版。
### 新增功能
- 添加多界面语言支持(中文、英语、日语)
- 添加暗色主题
### 提升体验
@@ -37,7 +38,12 @@
- 添加更多可保存和载入的配置项
- 为字幕引擎添加更严格的状态限制,防止出现僵尸进程
### 新增文档
### 修复bug
- 添加字幕引擎长时间空置后报错的问题
### 新增文档
- 新增日语说明文档
- 新增英语、日语字幕引擎说明文档和用户手册
- 新增 electron ipc api 文档

6
docs/TODO.md Normal file
View File

@@ -0,0 +1,6 @@
- [x] 添加英语和日语语言支持 *2025/07/04*
- [x] 添加暗色主题 *2025/07/04*
- [x] 优化长字幕显示效果 *2025/07/05*
- [x] 修复字幕引擎空置报错的问题 *2025/07/05*
- [ ] 添加更多字幕引擎
- [ ] 减小软件体积

View File

@@ -1,4 +1,4 @@
# api-doc
# electron ipc api-doc
本文档主要记录主进程和渲染进程的通信约定。

116
docs/engine-manual/en.md Normal file
View File

@@ -0,0 +1,116 @@
# Caption Engine Documentation
![](../../assets/media/structure_en.png)
## Introduction to the Caption Engine
The so-called caption engine is actually a subprocess that fetches real-time streaming audio data from system audio input (recording) or output (playing sound) and calls an audio-to-text model to generate captions for the corresponding audio. The generated captions are converted into JSON formatted string data and passed to the main program via standard output (it must be ensured that the string read by the main program can be correctly interpreted as a JSON object). The main program reads and interprets the caption data, processes it, and displays it on the window.
## Features the Caption Engine Needs to Implement
### Audio Acquisition
First, your caption engine needs to acquire streaming audio data from system audio input (recording) or output (playing sound). If developing with Python, you can use the PyAudio library to get microphone audio input data (cross-platform). Use the PyAudioWPatch library to get system audio output (only applicable to Windows platform).
The acquired audio stream data is usually in the form of short audio chunks, and the size of these chunks should be adjusted according to the model. For example, Alibaba Cloud's Gummy model performs better with 0.05-second audio chunks than with 0.2-second audio chunks.
### Audio Processing
The acquired audio stream may need preprocessing before being converted to text. For instance, Alibaba Cloud's Gummy model can only recognize single-channel audio streams, while the collected audio streams are generally dual-channel, so you need to convert the dual-channel audio stream to a single channel. The conversion of channels can be achieved using methods from the NumPy library.
You can directly use the audio acquisition and processing modules I've developed (path: `caption-engine/sysaudio`):
```python
if sys.platform == 'win32':
from sysaudio.win import AudioStream, mergeStreamChannels
elif sys.platform == 'linux':
from sysaudio.linux import AudioStream, mergeStreamChannels
else:
raise NotImplementedError(f"Unsupported platform: {sys.platform}")
# Create an instance of the audio stream object
stream = AudioStream(audio_type)
# Open the audio stream
stream.openStream()
while True: # Loop to read audio data
# Read audio data
data = stream.stream.read(stream.CHUNK)
# Convert dual-channel audio data to single-channel
data = mergeStreamChannels(data, stream.CHANNELS)
# Call the audio-to-text model
# ... ...
```
### Audio to Text Conversion
Once you have the appropriate audio stream, you can convert it to text. Various models are typically used to achieve this. You can choose the model based on your requirements.
### Data Transmission
After obtaining the text for the current audio stream, you need to pass the text to the main program. The caption engine process passes the caption data to the Electron main process through standard output.
The content transmitted must be a JSON string, where the JSON object should include the following parameters:
```typescript
export interface CaptionItem {
index: number, // Caption sequence number
time_s: string, // Start time of the current caption
time_t: string, // End time of the current caption
text: string, // Caption content
translation: string // Caption translation
}
```
**It is essential to ensure that every time a caption JSON data is output, the buffer is flushed, ensuring that the string received by the Electron main process each time can be interpreted as a JSON object.**
If using Python, you can refer to the following method to pass data to the main program:
```python
# caption-engine\main-gummy.py
sys.stdout.reconfigure(line_buffering=True)
# caption-engine\audio2text\gummy.py
...
def send_to_node(self, data):
"""
Send data to the Node.js process
"""
try:
json_data = json.dumps(data) + '\n'
sys.stdout.write(json_data)
sys.stdout.flush()
except Exception as e:
print(f"Error sending data to Node.js: {e}", file=sys.stderr)
...
```
The code for the data receiving end is as follows:
```typescript
// src\main\utils\engine.ts
...
this.process.stdout.on('data', (data) => {
const lines = data.toString().split('\n');
lines.forEach((line: string) => {
if (line.trim()) {
try {
const caption = JSON.parse(line);
addCaptionLog(caption);
} catch (e) {
controlWindow.sendErrorMessage('Cannot parse caption engine output as JSON object: ' + e)
console.error('[ERROR] Error parsing JSON:', e);
}
}
});
});
this.process.stderr.on('data', (data) => {
controlWindow.sendErrorMessage('Caption engine error: ' + data)
console.error(`[ERROR] Subprocess Error: ${data}`);
});
...
```
## Code Reference
The default caption engine entry point code is located in the `main-gummy.py` file under the `caption-engine` folder of this project. The `src\main\utils\engine.ts` file contains the server-side code for acquiring and processing caption engine data. You can read and understand the implementation details and the complete runtime process of the caption engine as needed.

118
docs/engine-manual/ja.md Normal file
View File

@@ -0,0 +1,118 @@
# キャプションエンジンの説明文書
![](../../assets/media/structure_ja.png)
この文書は大規模モデルを使用して翻訳されていますので、内容に正確でない部分があるかもしれません。
## キャプションエンジンの紹介
キャプションエンジンとは、実際にはサブプログラムであり、システムの音声入力録音または出力音声再生のストリーミングデータをリアルタイムで取得し、音声をテキストに変換するモデルを呼び出して対応する音声のキャプションを生成します。生成されたキャプションはJSON形式の文字列データに変換され、標準出力を通じてメインプログラムに渡されますメインプログラムが読み取った文字列がJSONオブジェクトとして正しく解釈できるようにする必要があります。メインプログラムはキャプションデータを読み取り、解釈し、処理してウィンドウ上に表示します。
## キャプションエンジンが必要とする機能
### 音声の取得
まず、あなたのキャプションエンジンはシステムの音声入力録音または出力音声再生のストリーミングデータを取得する必要があります。Pythonを使用して開発する場合、PyAudioライブラリを使用してマイクからの音声入力データを取得できます全プラットフォーム対応。PyAudioWPatchライブラリを使用してシステムの音声出力を取得することができますWindowsプラットフォームのみ対応
一般的に取得される音声ストリームデータは、比較的短い時間の音声ブロックで構成されています。モデルに合わせて音声ブロックのサイズを調整する必要があります。例えば、アリババクラウドのGummyモデルでは、0.05秒の音声ブロックを使用した認識精度が0.2秒の音声ブロックよりも優れています。
### 音声の処理
取得した音声ストリームは、テキストに変換する前に前処理を行う必要があるかもしれません。例えば、アリババクラウドのGummyモデルは単一チャンネルの音声ストリームしか認識できませんが、収集された音声ストリームは通常二重チャンネルです。そのため、二重チャンネルの音声ストリームを単一チャンネルに変換する必要があります。チャンネル数の変換はNumPyライブラリのメソッドを使用して行うことができます。
既に開発済みの音声取得と音声処理モジュール(パス:`caption-engine/sysaudio`)を使用することもできます:
```python
if sys.platform == 'win32':
from sysaudio.win import AudioStream, mergeStreamChannels
elif sys.platform == 'linux':
from sysaudio.linux import AudioStream, mergeStreamChannels
else:
raise NotImplementedError(f"サポートされていないプラットフォーム: {sys.platform}")
# 音声ストリームオブジェクトのインスタンスを作成
stream = AudioStream(audio_type)
# 音声ストリームを開く
stream.openStream()
while True: # 音声データを繰り返し読み込む
# 音声データを読み込む
data = stream.stream.read(stream.CHUNK)
# 二重チャンネルの音声データを単一チャンネルに変換
data = mergeStreamChannels(data, stream.CHANNELS)
# 音声をテキストに変換するモデルを呼び出す
# ... ...
```
### 音声からテキストへの変換
適切な音声ストリームを得た後、それをテキストに変換することができます。通常、様々なモデルを使用してこの変換を行います。必要に応じてモデルを選択してください。
### データの伝送
現在の音声ストリームのテキストを取得したら、それをメインプログラムに伝送する必要があります。キャプションエンジンプロセスは標準出力を通じてキャプションデータをElectronのメインプロセスに伝送します。
伝送する内容はJSON文字列でなければならず、JSONオブジェクトには以下のパラメータを含める必要があります
```typescript
export interface CaptionItem {
index: number, // キャプション番号
time_s: string, // 現在のキャプションの開始時間
time_t: string, // 現在のキャプションの終了時間
text: string, // キャプションの内容
translation: string // キャプションの翻訳
}
```
**注意キャプションJSONデータを出力するたびに必ずバッファをフラッシュし、Electronのメインプロセスが受け取る文字列が常にJSONオブジェクトとして解釈できるようにする必要があります。**
Pythonを使用する場合、以下のようにデータをメインプログラムに伝送できます
```python
# caption-engine\main-gummy.py
sys.stdout.reconfigure(line_buffering=True)
# caption-engine\audio2text\gummy.py
...
def send_to_node(self, data):
"""
データをNode.jsプロセスに送信
"""
try:
json_data = json.dumps(data) + '\n'
sys.stdout.write(json_data)
sys.stdout.flush()
except Exception as e:
print(f"Node.jsへのデータ送信エラー: {e}", file=sys.stderr)
...
```
データ受信側のコードは以下の通りです:
```typescript
// src\main\utils\engine.ts
...
this.process.stdout.on('data', (data) => {
const lines = data.toString().split('\n');
lines.forEach((line: string) => {
if (line.trim()) {
try {
const caption = JSON.parse(line);
addCaptionLog(caption);
} catch (e) {
controlWindow.sendErrorMessage('キャプションエンジンの出力内容がJSONオブジェクトとして解析できません: ' + e)
console.error('[ERROR] JSON解析エラー:', e);
}
}
});
});
this.process.stderr.on('data', (data) => {
controlWindow.sendErrorMessage('キャプションエンジンエラー: ' + data)
console.error(`[ERROR] サブプロセスエラー: ${data}`);
});
...
```
## 参考コード
本プロジェクトの `caption-engine` フォルダにある `main-gummy.py` ファイルは、デフォルトのキャプションエンジンのエントリポイントコードです。`src\main\utils\engine.ts` はサーバーサイドでキャプションエンジンのデータを取得および処理するためのコードです。必要に応じて、キャプションエンジンの実装詳細と完全な実行プロセスを理解するために読み込むことができます。

View File

@@ -1,10 +1,10 @@
# 字幕引擎说明文档
![](./media/structure.png)
![](../../assets/media/structure_zh.png)
## 字幕引擎介绍
所谓的字幕引擎实际上是一个子程序,它会实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。生成的字幕转换为 JSON 格式的字符串数据,并通过 IPC 传递给主程序。主程序读取字幕数据,处理后显示在窗口上。
所谓的字幕引擎实际上是一个子程序,它会实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。生成的字幕转换为 JSON 格式的字符串数据,并通过标准输出传递给主程序(需要保证主程序读取到的字符串可以被正确解释为 JSON 对象)。主程序读取并解释字幕数据,处理后显示在窗口上。
## 字幕引擎需要实现的功能
@@ -18,13 +18,38 @@
获取到的音频流在转文字之前可能需要进行预处理。比如阿里云的 Gummy 模型只能识别单通道的音频流,而收集的音频流一般是双通道的,因此要将双通道音频流转换为单通道。通道数的转换可以使用 NumPy 库中的方法实现。
你可以直接使用我开发好的音频获取和音频处理模块(路径:`caption-engine/sysaudio`
```python
if sys.platform == 'win32':
from sysaudio.win import AudioStream, mergeStreamChannels
elif sys.platform == 'linux':
from sysaudio.linux import AudioStream, mergeStreamChannels
else:
raise NotImplementedError(f"Unsupported platform: {sys.platform}")
# 创建音频流对象实例
stream = AudioStream(audio_type)
# 打开音频流
stream.openStream()
while True: # 循环读取音频数据
# 读取音频数据
data = stream.stream.read(stream.CHUNK)
# 将双通道音频数据转换为单通道
data = mergeStreamChannels(data, stream.CHANNELS)
# 调用音频转文字模型
# ... ...
```
### 音频转文字
在得到了合适的音频流后,就可以将音频流转换为文字了。一般使用各种模型来实现音频流转文字。可根据需求自行选择模型。
### 数据传递
在获取到当前音频流的文字后,需要将文字传递给主程序。使用进程间通信(IPC)的方式,比如通过标准输入输出流或者命名管道来实现。传递的内容必须是 JSON 字符串,其中 JSON 对象需要包含的参数如下:
在获取到当前音频流的文字后,需要将文字传递给主程序。字幕引擎进程通过标准输出将字幕数据传递给 electron 主进程。
传递的内容必须是 JSON 字符串,其中 JSON 对象需要包含的参数如下:
```typescript
export interface CaptionItem {
@@ -36,9 +61,14 @@ export interface CaptionItem {
}
```
**注意必须确保咱们一起每输出一次字幕 JSON 数据就得刷新缓冲区,确保 electron 主进程每次接收到的字符串都可以被解释为 JSON 对象。**
如果使用 python 语言,可以参考以下方式将数据传递给主程序:
```python
# caption-engine\main-gummy.py
sys.stdout.reconfigure(line_buffering=True)
# caption-engine\audio2text\gummy.py
...
def send_to_node(self, data):

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

BIN
docs/img/02_en.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
docs/img/02_ja.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
docs/img/02_zh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

60
docs/user-manual/en.md Normal file
View File

@@ -0,0 +1,60 @@
# Auto Caption User Manual
Corresponding Version: v0.2.0
## Software Introduction
Auto Caption is a cross-platform caption display software that can real-time capture system audio input (recording) or output (playback) streaming data and use an audio-to-text model to generate captions for the corresponding audio. The default caption engine provided by the software (using Alibaba Cloud Gummy model) supports recognition and translation in nine languages (Chinese, English, Japanese, Korean, German, French, Russian, Spanish, Italian).
Currently, the default caption engine only has full functionality on the Windows platform. On the Linux platform, it can only generate captions for audio input (microphone) and does not support generating captions for audio output (playback).
![](../../assets/media/main_en.png)
### Software Limitations
To use the default caption service, you need to obtain an API KEY from Alibaba Cloud.
The software is built using Electron, so the software size is inevitably large.
## Software Usage
### Preparing the Alibaba Cloud Model Studio API KEY
To use the default caption engine (Alibaba Cloud Gummy), you need to obtain an API KEY from the Alibaba Cloud Model Studio and configure it in your local environment variables.
**The international version of Alibaba Cloud does not provide the Gummy model, so non-Chinese users currently cannot use the default caption engine. I am trying to develop a new local caption engine to ensure that all users have access to a default caption engine.**
Alibaba Cloud provides detailed tutorials for this:
- [Obtain API KEY (Chinese)](https://help.aliyun.com/zh/model-studio/get-api-key)
- [Configure API Key in Environment Variables (Chinese)](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)
### Modifying Settings
Caption settings can be divided into three categories: general settings, caption engine settings, and caption style settings. Note that changes to general settings take effect immediately. For the other two categories, after making changes, you need to click the "Apply" option in the upper right corner of the corresponding settings module for the changes to take effect. If you click "Cancel Changes," the current modifications will not be saved and will revert to the previous state.
### Starting and Stopping Captions
After completing all configurations, click the "Start Caption Engine" button on the interface to start the captions. If you need a separate caption display window, click the "Open Caption Window" button to activate the independent caption display window. To pause caption recognition, click the "Stop Caption Engine" button.
### Adjusting the Caption Display Window
The following image shows the caption display window, which displays the latest captions in real-time. The three buttons in the upper right corner of the window have the following functions: pin the window to the front, open the caption control window, and close the caption display window. The width of the window can be adjusted by moving the mouse to the left or right edge of the window and dragging the mouse.
![](../img/01.png)
### Exporting Caption Records
In the caption control window, you can see the records of all collected captions. Click the "Export Caption Records" button to export the caption records as a JSON file.
## Caption Engine
The so-called caption engine is actually a subprocess that real-time captures system audio input (recording) or output (playback) streaming data and uses an audio-to-text model to generate captions for the corresponding audio. The generated captions are output as JSON data converted to strings and returned to the main program. The main program reads the caption data, processes it, and displays it in the window.
The software provides a default caption engine. If you need other caption engines, you can call them by enabling the custom engine option (other engines need to be developed specifically for this software). The engine path is the path to the custom caption engine on your computer, and the engine command is the runtime parameters for the custom caption engine, which need to be filled out according to the rules of the specific caption engine.
![](../img/02_en.png)
Note that when using a custom caption engine, all previous caption engine settings will be ineffective, and the configuration of the custom caption engine is entirely done through the engine command.
If you are a developer and want to develop a custom caption engine, please refer to the [Caption Engine Explanation Document](../engine-manual/en.md).

62
docs/user-manual/ja.md Normal file
View File

@@ -0,0 +1,62 @@
# Auto Caption ユーザーマニュアル
対応バージョンv0.2.0
この文書は大規模モデルを使用して翻訳されていますので、内容に正確でない部分があるかもしれません。
## ソフトウェアの概要
Auto Caption は、クロスプラットフォームの字幕表示ソフトウェアで、システムの音声入力(録音)または出力(音声再生)のストリーミングデータをリアルタイムで取得し、音声からテキストに変換するモデルを利用して対応する音声の字幕を生成します。このソフトウェアが提供するデフォルトの字幕エンジン(アリババクラウド Gummy モデルを使用は、9つの言語中国語、英語、日本語、韓国語、ドイツ語、フランス語、ロシア語、スペイン語、イタリア語の認識と翻訳をサポートしています。
現在、デフォルトの字幕エンジンは Windows プラットフォームでのみ完全な機能を利用できます。Linux プラットフォームでは、音声入力(マイク)からの字幕生成のみがサポートされており、音声出力(音声再生)からの字幕生成はまだサポートされていません。
![](../../assets/media/main_ja.png)
### ソフトウェアの欠点
デフォルトの字幕サービスを使用するには、アリババクラウドの API KEY を取得する必要があります。
ソフトウェアは Electron で構築されているため、そのサイズは避けられないほど大きいです。
## ソフトウェアの使用方法
### アリババクラウド百炼プラットフォームの API KEY の準備
ソフトウェアが提供するデフォルトの字幕エンジン(アリババクラウド Gummyを使用するには、アリババクラウド百炼プラットフォームから API KEY を取得し、ローカル環境変数に設定する必要があります。
**アリババクラウドの国際版には Gummy モデルが提供されていないため、中国以外のユーザーは現在、デフォルトの字幕エンジンを使用できません。すべてのユーザーが利用できるように、新しいローカルの字幕エンジンを開発中です。**
アリババクラウドは詳細なチュートリアルを提供していますので、以下のリンクを参照してください:
- [API KEY の取得(中国語)](https://help.aliyun.com/zh/model-studio/get-api-key)
- [環境変数を通じて API Key を設定する(中国語)](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)
### 設定の変更
字幕の設定は3つのカテゴリーに分かれます一般的な設定、字幕エンジンの設定、字幕スタイルの設定。注意すべき点として、一般的な設定の変更は即座に適用されます。しかし、他の2つの設定については、変更後に該当する設定モジュール右上の「適用」オプションをクリックすることで初めて変更が有効になります。「変更を取り消す」を選択すると、現在の変更は保存されず、前回の状態に戻ります。
### 字幕の開始と停止
すべての設定を完了したら、インターフェースの「字幕エンジンを開始」ボタンをクリックして字幕を開始できます。独立した字幕表示ウィンドウが必要な場合は、インターフェースの「字幕ウィンドウを開く」ボタンをクリックして独立した字幕表示ウィンドウをアクティブ化します。字幕認識を一時停止する必要がある場合は、「字幕エンジンを停止」ボタンをクリックします。
### 字幕表示ウィンドウの調整
下の図は字幕表示ウィンドウです。このウィンドウは現在の最新の字幕をリアルタイムで表示します。ウィンドウの右上にある3つのボタンの機能はそれぞれ次の通りですウィンドウを最前面に固定する、字幕制御ウィンドウを開く、字幕表示ウィンドウを閉じる。このウィンドウの幅は調整可能です。マウスをウィンドウの左右の端に移動し、ドラッグして幅を調整します。
![](../img/01.png)
### 字幕記録のエクスポート
字幕制御ウィンドウでは、現在収集されたすべての字幕の記録を見ることができます。「字幕記録をエクスポート」ボタンをクリックすると、字幕記録をJSONファイルとしてエクスポートできます。
## 字幕エンジン
字幕エンジンとは、実際にはサブプログラムであり、システムの音声入力録音または出力音声再生のストリーミングデータをリアルタイムで取得し、音声からテキストに変換するモデルを利用して対応する音声の字幕を生成します。生成された字幕はIPC経由で文字列に変換されたJSONデータとして出力され、メインプログラムに返されます。メインプログラムは字幕データを読み取り、処理してウィンドウ上に表示します。
ソフトウェアはデフォルトの字幕エンジンを提供しており、他の字幕エンジンが必要な場合は、カスタムエンジンオプションを開いて他の字幕エンジンを呼び出すことができます(他のエンジンはこのソフトウェアに対して開発する必要があります)。エンジンパスは、あなたのコンピュータ上のカスタム字幕エンジンのパスであり、エンジンコマンドはカスタム字幕エンジンの実行パラメータです。これらの部分は、その字幕エンジンの規則に従って記入する必要があります。
![](../img/02_ja.png)
カスタム字幕エンジンを使用する場合、前の字幕エンジンの設定はすべて無効になります。カスタム字幕エンジンの設定は完全にエンジンコマンドによって行われます。
開発者の方で、カスタム字幕エンジンを開発したい場合は、[字幕エンジン説明文書](../engine-manual/ja.md)をご覧ください。

View File

@@ -1,14 +1,14 @@
# Auto Caption 用户手册
对应版本v0.1.0
对应版本v0.2.0
## 软件简介
Auto Caption 是一个跨平台的字幕显示软件,能够实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。软件提供的默认字幕引擎(使用阿里云 Gummy 模型)支持九种语言(中英日韩德法俄西意)的识别与翻译。
Auto Caption 是一个跨平台的字幕显示软件,能够实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。软件提供的默认字幕引擎(使用阿里云 Gummy 模型)支持九种语言(中、英、日、韩、德、法、俄、西、意)的识别与翻译。
目前软件默认字幕引擎只有在 Windows 平台下才拥有完整功能。在 Linux 平台下只能生成音频输入(麦克风)的字幕,暂不支持音频输出(播放声音)的字幕生成。
![](./media/main.png)
![](../../assets/media/main_zh.png)
### 软件缺点
@@ -22,15 +22,17 @@ Auto Caption 是一个跨平台的字幕显示软件,能够实时获取系统
要使用软件提供的默认字幕引擎(阿里云 Gummy需要从阿里云百炼平台获取 API KEY 并在本机环境变量中配置。
**国际版的阿里云服务并没有提供 Gummy 模型,因此目前非中国用户无法使用默认字幕引擎。我正在开发新的本地字幕引擎,以确保所有用户都有默认字幕引擎可以使用。**
这部分阿里云提供了详细的教程,可参考:
- [获取 API KEY](https://help.aliyun.com/zh/model-studio/get-api-key)
- [将 API Key 配置到环境变量](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)
- [将 API Key 配置到环境变量](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables)
### 修改字幕设置
### 修改设置
字幕设置可以分为类:修改字幕引擎置、修改字幕样式设置。需要注意的是,在调整的设置的参数后,需要点击每个设置模块右上角的“更改设置”(字幕引擎设置)或“应用样式”(字幕样式设置),更改才会真正生效。如果点击“取消更改”那么当前设置将不会被保存,而是回到上次修改的状态。
字幕设置可以分为类:通用设置、字幕引擎置、字幕样式设置。需要注意的是,修改通用设置是立即生效的。但是对于其他两类设置,修改后需要点击对应设置模块右上角的“应用”选项,更改才会真正生效。如果点击“取消更改”那么当前修改将不会被保存,而是回退到上次修改的状态。
### 启动和关闭字幕
@@ -40,7 +42,7 @@ Auto Caption 是一个跨平台的字幕显示软件,能够实时获取系统
如下图为字幕展示窗口,该窗口实时展示当前最新字幕。窗口右上角三个按钮的功能分别是:将窗口固定在最前面、打开字幕控制窗口、关闭字幕展示窗口。该窗口宽度可以调整,将鼠标移动至窗口的左右边缘,拖动鼠标即可调整宽度。
![](./img/01.png)
![](../img/01.png)
### 字幕记录的导出
@@ -50,10 +52,10 @@ Auto Caption 是一个跨平台的字幕显示软件,能够实时获取系统
所谓的字幕引擎实际上是一个子程序,它会实时获取系统音频输入(录音)或输出(播放声音)的流式数据,并调用音频转文字的模型生成对应音频的字幕。生成的字幕通过 IPC 输出为转换为字符串的 JSON 数据,并返回给主程序。主程序读取字幕数据,处理后显示在窗口上。
软件提供了一个默认的字幕引擎,如果你需要其他的字幕引擎,可以通过打开自定义引擎选项来调用其他字幕引擎(其他引擎需要针对进行开发)。其中引擎路径是自定义字幕引擎在你的电脑上的路径,引擎指令是自定义字幕引擎的运行参数,这部分需要按该字幕引擎的规则进行填写。
软件提供了一个默认的字幕引擎,如果你需要其他的字幕引擎,可以通过打开自定义引擎选项来调用其他字幕引擎(其他引擎需要针对该软件进行开发)。其中引擎路径是自定义字幕引擎在你的电脑上的路径,引擎指令是自定义字幕引擎的运行参数,这部分需要按该字幕引擎的规则进行填写。
![](./img/02.png)
![](../img/02_zh.png)
注意使用自定义字幕引擎时,前面的字幕引擎的设置将全部不起作用,自定义字幕引擎的配置完全通过引擎指令进行配置。
如果你是开发者,想开发自定义字幕引擎,请查看[字幕引擎说明文档](./engine-manual_zh.md)。
如果你是开发者,想开发自定义字幕引擎,请查看[字幕引擎说明文档](../engine-manual/zh.md)。

View File

@@ -1,6 +1,6 @@
{
"name": "auto-caption",
"version": "0.1.0",
"version": "0.2.0",
"description": "A cross-platform subtitle display software.",
"main": "./out/main/index.js",
"author": "himeditator",

View File

@@ -47,7 +47,7 @@
<p class="about-desc">{{ $t('status.about.desc') }}</p>
<a-divider />
<div class="about-info">
<p><b>{{ $t('status.about.version') }}</b><a-tag color="green">v0.1.0</a-tag></p>
<p><b>{{ $t('status.about.version') }}</b><a-tag color="green">v0.2.0</a-tag></p>
<p>
<b>{{ $t('status.about.author') }}</b>
<a
@@ -66,10 +66,19 @@
<p>
<b>{{ $t('status.about.manual') }}</b>
<a
href="https://github.com/HiMeditator/auto-caption/blob/main/assets/user-manual_zh.md"
:href="`https://github.com/HiMeditator/auto-caption/tree/main/docs/user-manual/${$t('lang')}.md`"
target="_blank"
>
<a-tag color="blue">GitHub | user-manual_zh.md</a-tag>
<a-tag color="blue">GitHub | user-manual/{{ $t('lang') }}.md</a-tag>
</a>
</p>
<p>
<b>{{ $t('status.about.engineDoc') }}</b>
<a
:href="`https://github.com/HiMeditator/auto-caption/tree/main/docs/engine-manual/${$t('lang')}.md`"
target="_blank"
>
<a-tag color="blue">GitHub | engine-manual/{{ $t('lang') }}.md</a-tag>
</a>
</p>
</div>

View File

@@ -1,4 +1,5 @@
export default {
lang: "en",
example: {
"original": "这是字幕样式预览。",
"translation": "(Translation) This is a preview of caption styles."
@@ -92,7 +93,8 @@ export default {
"author": "Project Author",
"projLink": "Project Link",
"manual": "User Manual",
"date": "June 26, 2026"
"engineDoc": "Caption Engine Manual",
"date": "July 5, 2026"
}
},
log: {

View File

@@ -1,4 +1,5 @@
export default {
lang: "ja",
example: {
"original": "这是字幕样式预览。",
"translation": "(翻訳)これは字幕のスタイルのプレビューです。"
@@ -92,7 +93,8 @@ export default {
"author": "プロジェクト作者",
"projLink": "プロジェクトリンク",
"manual": "ユーザーマニュアル",
"date": "2026 年 6 月 26 日"
"engineDoc": "字幕エンジンマニュアル",
"date": "2025 年 7 月 5 日"
}
},
log: {

View File

@@ -1,4 +1,5 @@
export default {
lang: "zh",
example: {
"original": "This is a preview of caption styles. ",
"translation": "(翻译)这是字幕样式预览。"
@@ -92,7 +93,8 @@ export default {
"author": "项目作者",
"projLink": "项目链接",
"manual": "用户手册",
"date": "2026 年 6 月 26 日"
"engineDoc": "字幕引擎手册",
"date": "2025 年 7 月 5 日"
}
},
log: {