feat(sysaudio): 支持 macOS 系统音频流采集

- 新增 darwin.py 文件实现 macOS 音频流采集功能
- 修改 main-gummy.py 以支持 macOS 平台
- 更新 AllConfig 和 CaptionEngine 以适配新平台
This commit is contained in:
himeditator mac
2025-07-08 17:04:15 +08:00
parent 65da30f83d
commit 7e953db6bd
14 changed files with 141 additions and 36 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"id": "1e12f3ef",
"metadata": {},
"outputs": [
@@ -11,15 +11,14 @@
"output_type": "stream",
"text": [
"\n",
" 采样设备:\n",
" 采样输入设备:\n",
" - 设备类型:音频输出\n",
" - 序号:26\n",
" - 名称:耳机 (HUAWEI FreeLace 活力版) [Loopback]\n",
" - 序号:0\n",
" - 名称:BlackHole 2ch\n",
" - 最大输入通道数2\n",
" - 默认低输入延迟0.003s\n",
" - 默认高输入延迟0.01s\n",
" - 默认低输入延迟0.01s\n",
" - 默认高输入延迟0.1s\n",
" - 默认采样率48000.0Hz\n",
" - 是否回环设备True\n",
"\n",
" 音频样本块大小2400\n",
" 样本位宽2\n",
@@ -38,7 +37,7 @@
"current_dir = os.getcwd() \n",
"sys.path.append(os.path.join(current_dir, '../caption-engine'))\n",
"\n",
"from sysaudio.win import AudioStream\n",
"from sysaudio.darwin import AudioStream\n",
"from audioprcs import resampleRawChunk, mergeChunkChannels\n",
"\n",
"stream = AudioStream(0)\n",
@@ -47,7 +46,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"id": "a72914f4",
"metadata": {},
"outputs": [
@@ -84,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"id": "a6e8a098",
"metadata": {},
"outputs": [
@@ -168,7 +167,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "mystd",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
@@ -182,7 +181,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.9.6"
}
},
"nbformat": 4,