termux-stt 2.0.5 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -21
- package/README.md +84 -84
- package/README.pypi.md +44 -44
- package/bin/cli.js +55 -51
- package/bin/termux-stt.js +55 -51
- package/index.d.ts +72 -68
- package/index.js +53 -49
- package/lib/engine.js +96 -92
- package/lib/hybrid.js +68 -64
- package/lib/sherpa.js +101 -97
- package/lib/whisper.js +83 -79
- package/package.json +86 -86
package/LICENSE
CHANGED
|
@@ -1,21 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
# Termux-STT
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/termux-stt/)
|
|
4
|
-
[](https://pypi.org/project/termux-stt/)
|
|
5
|
-
[](https://www.npmjs.com/package/termux-stt)
|
|
6
|
-
[](https://www.npmjs.com/package/termux-stt)
|
|
7
|
-
[](https://github.com/uno-km/termux-stt)
|
|
8
|
-
|
|
9
|
-
> **디바이스 리소스를 활용한 통합 온디바이스 음성인식(STT) 및 차세대 신경망 화자 분리(PyAnnote 3.0 + CAM++ 192d + TS-VAD) 프레임워크**
|
|
10
|
-
> *Unified On-Device Speech-to-Text & Neural Multi-Speaker Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD Overlap Resolver)*
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Architecture & Overview
|
|
15
|
-
|
|
16
|
-
Whisper.cpp(네이티브 Vulkan GPU / NEON CPU) 및 Sherpa-ONNX 듀얼 모던 엔진을 통합하고, PyAnnote 3.0 신경망 세그멘테이션, 3D-Speaker CAM++ 192차원 성문 임베딩, TS-VAD 동시 발화(마이크 물림) 분리기를 결합하여 완전 온디바이스 실시간 다중 화자 음성인식을 구현합니다.
|
|
17
|
-
|
|
18
|
-
Integrates Whisper.cpp (Native Vulkan GPU / NEON CPU) and Sherpa-ONNX with PyAnnote 3.0 neural segmentation, 3D-Speaker CAM++ 192-dim embeddings, and TS-VAD overlapped speech resolution with zero cloud egress.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Installation & Quickstart
|
|
23
|
-
|
|
24
|
-
### Python (PyPI)
|
|
25
|
-
```bash
|
|
26
|
-
pip install termux-stt
|
|
27
|
-
```
|
|
28
|
-
```python
|
|
29
|
-
from termux_stt import create_engine
|
|
30
|
-
|
|
31
|
-
# 1. Initialize Whisper Engine with Vulkan GPU / CPU Hybrid Acceleration
|
|
32
|
-
engine = create_engine("whisper", model="small", lang="ko", threads=4, split_mode=True)
|
|
33
|
-
|
|
34
|
-
# 2. Transcribe Audio directly into Subtitles
|
|
35
|
-
result = engine.transcribe("samples/jfk_1min.wav")
|
|
36
|
-
print("Transcript:\n", result.text)
|
|
37
|
-
print("SRT Subtitles:\n", result.to_srt())
|
|
38
|
-
|
|
39
|
-
# 3. Multi-Speaker Neural Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD)
|
|
40
|
-
hybrid = create_engine("hybrid", lang="ko", num_speakers=2)
|
|
41
|
-
diar_result = hybrid.diarize("samples/kor_diarization.wav")
|
|
42
|
-
for seg in diar_result.segments:
|
|
43
|
-
print(f"[{seg.speaker}] ({seg.start:.1f}s -> {seg.end:.1f}s): {seg.text}")
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Node.js / TypeScript (npm)
|
|
48
|
-
```bash
|
|
49
|
-
npm install termux-stt
|
|
50
|
-
```
|
|
51
|
-
```typescript
|
|
52
|
-
const { createEngine } = require("termux-stt");
|
|
53
|
-
|
|
54
|
-
async function main() {
|
|
55
|
-
// 1. Initialize Whisper Engine
|
|
56
|
-
const engine = createEngine("whisper", { model: "tiny", lang: "ko", threads: 4 });
|
|
57
|
-
|
|
58
|
-
// 2. Transcribe Audio
|
|
59
|
-
const result = await engine.transcribe("samples/jfk_1min.wav");
|
|
60
|
-
console.log("Transcript:", result.text);
|
|
61
|
-
console.log("SRT Subtitles:\n", result.toSrt());
|
|
62
|
-
|
|
63
|
-
// 3. Neural Diarization via Hybrid Engine
|
|
64
|
-
const hybrid = createEngine("hybrid", { lang: "ko", numSpeakers: 2 });
|
|
65
|
-
const diarResult = await hybrid.diarize("samples/kor_diarization.wav");
|
|
66
|
-
for (const seg of diarResult.segments) {
|
|
67
|
-
console.log(`[${seg.speaker}] (${seg.start.toFixed(1)}s -> ${seg.end.toFixed(1)}s): ${seg.text}`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
main();
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## Official Documentation & Benchmarks
|
|
77
|
-
- [Official Architecture & API Reference](https://uno-km.vercel.app/lib/stt/)
|
|
78
|
-
- [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
|
|
79
|
-
- [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## License
|
|
84
|
-
Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
|
|
1
|
+
# Termux-STT
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/termux-stt/)
|
|
4
|
+
[](https://pypi.org/project/termux-stt/)
|
|
5
|
+
[](https://www.npmjs.com/package/termux-stt)
|
|
6
|
+
[](https://www.npmjs.com/package/termux-stt)
|
|
7
|
+
[](https://github.com/uno-km/termux-stt)
|
|
8
|
+
|
|
9
|
+
> **디바이스 리소스를 활용한 통합 온디바이스 음성인식(STT) 및 차세대 신경망 화자 분리(PyAnnote 3.0 + CAM++ 192d + TS-VAD) 프레임워크**
|
|
10
|
+
> *Unified On-Device Speech-to-Text & Neural Multi-Speaker Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD Overlap Resolver)*
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Architecture & Overview
|
|
15
|
+
|
|
16
|
+
Whisper.cpp(네이티브 Vulkan GPU / NEON CPU) 및 Sherpa-ONNX 듀얼 모던 엔진을 통합하고, PyAnnote 3.0 신경망 세그멘테이션, 3D-Speaker CAM++ 192차원 성문 임베딩, TS-VAD 동시 발화(마이크 물림) 분리기를 결합하여 완전 온디바이스 실시간 다중 화자 음성인식을 구현합니다.
|
|
17
|
+
|
|
18
|
+
Integrates Whisper.cpp (Native Vulkan GPU / NEON CPU) and Sherpa-ONNX with PyAnnote 3.0 neural segmentation, 3D-Speaker CAM++ 192-dim embeddings, and TS-VAD overlapped speech resolution with zero cloud egress.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation & Quickstart
|
|
23
|
+
|
|
24
|
+
### Python (PyPI)
|
|
25
|
+
```bash
|
|
26
|
+
pip install termux-stt
|
|
27
|
+
```
|
|
28
|
+
```python
|
|
29
|
+
from termux_stt import create_engine
|
|
30
|
+
|
|
31
|
+
# 1. Initialize Whisper Engine with Vulkan GPU / CPU Hybrid Acceleration
|
|
32
|
+
engine = create_engine("whisper", model="small", lang="ko", threads=4, split_mode=True)
|
|
33
|
+
|
|
34
|
+
# 2. Transcribe Audio directly into Subtitles
|
|
35
|
+
result = engine.transcribe("samples/jfk_1min.wav")
|
|
36
|
+
print("Transcript:\n", result.text)
|
|
37
|
+
print("SRT Subtitles:\n", result.to_srt())
|
|
38
|
+
|
|
39
|
+
# 3. Multi-Speaker Neural Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD)
|
|
40
|
+
hybrid = create_engine("hybrid", lang="ko", num_speakers=2)
|
|
41
|
+
diar_result = hybrid.diarize("samples/kor_diarization.wav")
|
|
42
|
+
for seg in diar_result.segments:
|
|
43
|
+
print(f"[{seg.speaker}] ({seg.start:.1f}s -> {seg.end:.1f}s): {seg.text}")
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Node.js / TypeScript (npm)
|
|
48
|
+
```bash
|
|
49
|
+
npm install termux-stt
|
|
50
|
+
```
|
|
51
|
+
```typescript
|
|
52
|
+
const { createEngine } = require("termux-stt");
|
|
53
|
+
|
|
54
|
+
async function main() {
|
|
55
|
+
// 1. Initialize Whisper Engine
|
|
56
|
+
const engine = createEngine("whisper", { model: "tiny", lang: "ko", threads: 4 });
|
|
57
|
+
|
|
58
|
+
// 2. Transcribe Audio
|
|
59
|
+
const result = await engine.transcribe("samples/jfk_1min.wav");
|
|
60
|
+
console.log("Transcript:", result.text);
|
|
61
|
+
console.log("SRT Subtitles:\n", result.toSrt());
|
|
62
|
+
|
|
63
|
+
// 3. Neural Diarization via Hybrid Engine
|
|
64
|
+
const hybrid = createEngine("hybrid", { lang: "ko", numSpeakers: 2 });
|
|
65
|
+
const diarResult = await hybrid.diarize("samples/kor_diarization.wav");
|
|
66
|
+
for (const seg of diarResult.segments) {
|
|
67
|
+
console.log(`[${seg.speaker}] (${seg.start.toFixed(1)}s -> ${seg.end.toFixed(1)}s): ${seg.text}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
main();
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Official Documentation & Benchmarks
|
|
77
|
+
- [Official Architecture & API Reference](https://uno-km.vercel.app/lib/stt/)
|
|
78
|
+
- [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
|
|
79
|
+
- [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
|
package/README.pypi.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# Termux-STT (Python)
|
|
2
|
-
|
|
3
|
-
[](https://pypi.org/project/termux-stt/)
|
|
4
|
-
[](https://pypi.org/project/termux-stt/)
|
|
5
|
-
[](https://github.com/uno-km/termux-stt)
|
|
6
|
-
|
|
7
|
-
> Unified On-Device Speech-to-Text & Neural Multi-Speaker Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD Overlap Resolver)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
pip install termux-stt
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Quickstart
|
|
16
|
-
|
|
17
|
-
```python
|
|
18
|
-
from termux_stt import create_engine
|
|
19
|
-
|
|
20
|
-
# 1. Initialize Whisper Engine with Vulkan GPU / CPU Hybrid Acceleration
|
|
21
|
-
engine = create_engine("whisper", model="small", lang="ko", threads=4, split_mode=True)
|
|
22
|
-
|
|
23
|
-
# 2. Transcribe Audio directly into Subtitles
|
|
24
|
-
result = engine.transcribe("samples/jfk_1min.wav")
|
|
25
|
-
print("Transcript:\n", result.text)
|
|
26
|
-
print("SRT Subtitles:\n", result.to_srt())
|
|
27
|
-
|
|
28
|
-
# 3. Multi-Speaker Neural Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD)
|
|
29
|
-
hybrid = create_engine("hybrid", lang="ko", num_speakers=2)
|
|
30
|
-
diar_result = hybrid.diarize("samples/kor_diarization.wav")
|
|
31
|
-
for seg in diar_result.segments:
|
|
32
|
-
print(f"[{seg.speaker}] ({seg.start:.1f}s -> {seg.end:.1f}s): {seg.text}")
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Description
|
|
37
|
-
Integrates Whisper.cpp (Native Vulkan GPU / NEON CPU) and Sherpa-ONNX with PyAnnote 3.0 neural segmentation, 3D-Speaker CAM++ 192-dim embeddings, and TS-VAD overlapped speech resolution with zero cloud egress.
|
|
38
|
-
|
|
39
|
-
## Documentation
|
|
40
|
-
- [Official Documentation & API Reference](https://uno-km.vercel.app/lib/stt/)
|
|
41
|
-
- [GitHub Repository](https://github.com/uno-km/termux-stt)
|
|
42
|
-
|
|
43
|
-
## License
|
|
44
|
-
Apache-2.0 License. Copyright (c) 2026 Eunho Kim (@uno-km).
|
|
1
|
+
# Termux-STT (Python)
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/termux-stt/)
|
|
4
|
+
[](https://pypi.org/project/termux-stt/)
|
|
5
|
+
[](https://github.com/uno-km/termux-stt)
|
|
6
|
+
|
|
7
|
+
> Unified On-Device Speech-to-Text & Neural Multi-Speaker Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD Overlap Resolver)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install termux-stt
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quickstart
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from termux_stt import create_engine
|
|
19
|
+
|
|
20
|
+
# 1. Initialize Whisper Engine with Vulkan GPU / CPU Hybrid Acceleration
|
|
21
|
+
engine = create_engine("whisper", model="small", lang="ko", threads=4, split_mode=True)
|
|
22
|
+
|
|
23
|
+
# 2. Transcribe Audio directly into Subtitles
|
|
24
|
+
result = engine.transcribe("samples/jfk_1min.wav")
|
|
25
|
+
print("Transcript:\n", result.text)
|
|
26
|
+
print("SRT Subtitles:\n", result.to_srt())
|
|
27
|
+
|
|
28
|
+
# 3. Multi-Speaker Neural Diarization (PyAnnote 3.0 + CAM++ 192d + TS-VAD)
|
|
29
|
+
hybrid = create_engine("hybrid", lang="ko", num_speakers=2)
|
|
30
|
+
diar_result = hybrid.diarize("samples/kor_diarization.wav")
|
|
31
|
+
for seg in diar_result.segments:
|
|
32
|
+
print(f"[{seg.speaker}] ({seg.start:.1f}s -> {seg.end:.1f}s): {seg.text}")
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Description
|
|
37
|
+
Integrates Whisper.cpp (Native Vulkan GPU / NEON CPU) and Sherpa-ONNX with PyAnnote 3.0 neural segmentation, 3D-Speaker CAM++ 192-dim embeddings, and TS-VAD overlapped speech resolution with zero cloud egress.
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
- [Official Documentation & API Reference](https://uno-km.vercel.app/lib/stt/)
|
|
41
|
+
- [GitHub Repository](https://github.com/uno-km/termux-stt)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
Apache-2.0 License. Copyright (c) 2026 Eunho Kim (@uno-km).
|
package/bin/cli.js
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (fs.existsSync(
|
|
15
|
-
return
|
|
16
|
-
}
|
|
17
|
-
const
|
|
18
|
-
if (fs.existsSync(
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026 Uno Kim / AMEVA Foundation. All rights reserved.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0 OR Commercial-License
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* AMEVA Standard Node.js CLI Runner for termux_stt.
|
|
8
|
+
* Automatically resolves Python 3 environment and dispatches to python -m termux_stt.
|
|
9
|
+
*/
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const { spawn, execSync } = require('child_process');
|
|
12
|
+
|
|
13
|
+
function findPython() {
|
|
14
|
+
if (process.env.PYTHON && fs.existsSync(process.env.PYTHON)) {
|
|
15
|
+
return process.env.PYTHON;
|
|
16
|
+
}
|
|
17
|
+
const termuxBin = '/data/data/com.termux/files/usr/bin/python3';
|
|
18
|
+
if (fs.existsSync(termuxBin)) {
|
|
19
|
+
return termuxBin;
|
|
20
|
+
}
|
|
21
|
+
const termuxBinAlt = '/data/data/com.termux/files/usr/bin/python';
|
|
22
|
+
if (fs.existsSync(termuxBinAlt)) {
|
|
23
|
+
return termuxBinAlt;
|
|
24
|
+
}
|
|
25
|
+
const candidates = ['python3', 'python'];
|
|
26
|
+
for (const cmd of candidates) {
|
|
27
|
+
try {
|
|
28
|
+
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
|
|
29
|
+
const res = execSync(checkCmd, { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim();
|
|
30
|
+
if (res) return cmd;
|
|
31
|
+
} catch (_) {}
|
|
32
|
+
}
|
|
33
|
+
return 'python3';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const pythonBin = findPython();
|
|
37
|
+
const args = ['-m', 'termux_stt', ...process.argv.slice(2)];
|
|
38
|
+
|
|
39
|
+
const child = spawn(pythonBin, args, {
|
|
40
|
+
stdio: 'inherit',
|
|
41
|
+
env: process.env
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
child.on('error', (err) => {
|
|
45
|
+
console.error(`[${'termux_stt'}] Failed to spawn python process (${pythonBin}):`, err.message);
|
|
46
|
+
process.exit(1);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
child.on('exit', (code, signal) => {
|
|
50
|
+
if (signal) {
|
|
51
|
+
process.kill(process.pid, signal);
|
|
52
|
+
} else {
|
|
53
|
+
process.exit(code || 0);
|
|
54
|
+
}
|
|
55
|
+
});
|