refactor(engine): 修改虚拟环境设置,修改音频工具函数

- 更新虚拟环境目录名为 .venv
- 调整音频块采集速率默认值为 10
- 为 AudioStream 类添加重设音频块大小的方法
- 更新依赖文件 requirements.txt
This commit is contained in:
himeditator
2025-08-03 16:40:26 +08:00
parent 38b4b15cec
commit 1c0bf1f9c4
19 changed files with 99 additions and 70 deletions

View File

@@ -129,29 +129,24 @@ First enter the `engine` folder and execute the following commands to create a v
```bash
# in ./engine folder
python -m venv subenv
python -m venv .venv
# or
python3 -m venv subenv
python3 -m venv .venv
```
Then activate the virtual environment:
```bash
# Windows
subenv/Scripts/activate
.venv/Scripts/activate
# Linux or macOS
source subenv/bin/activate
source .venv/bin/activate
```
Then install dependencies (this step might result in errors on macOS and Linux, usually due to build failures, and you need to handle them based on the error messages):
```bash
# Windows
pip install -r requirements_win.txt
# macOS
pip install -r requirements_darwin.txt
# Linux
pip install -r requirements_linux.txt
pip install -r requirements.txt
```
If you encounter errors when installing the `samplerate` module on Linux systems, you can try installing it separately with this command:
@@ -170,9 +165,9 @@ Note that the path to the `vosk` library in `main-vosk.spec` might be incorrect
```
# Windows
vosk_path = str(Path('./subenv/Lib/site-packages/vosk').resolve())
vosk_path = str(Path('./.venv/Lib/site-packages/vosk').resolve())
# Linux or macOS
vosk_path = str(Path('./subenv/lib/python3.x/site-packages/vosk').resolve())
vosk_path = str(Path('./.venv/lib/python3.x/site-packages/vosk').resolve())
```
After the build completes, you can find the executable file in the `engine/dist` folder. Then proceed with subsequent operations.