RealTimeSTT 0.3.8__tar.gz → 0.3.9__tar.gz
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.
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/PKG-INFO +38 -7
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/README.md +25 -6
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT/audio_recorder.py +62 -19
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT/audio_recorder_client.py +7 -6
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/PKG-INFO +38 -7
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/requires.txt +1 -2
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/setup.py +34 -34
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/LICENSE +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT/__init__.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT/audio_input.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/SOURCES.txt +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/dependency_links.txt +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/entry_points.txt +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT.egg-info/top_level.txt +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT_server/__init__.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT_server/install_packages.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT_server/stt_cli_client.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/RealtimeSTT_server/stt_server.py +0 -0
- {RealtimeSTT-0.3.8 → realtimestt-0.3.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: A fast Voice Activity Detection and Transcription System
|
|
5
5
|
Home-page: https://github.com/KoljaB/RealTimeSTT
|
|
6
6
|
Author: Kolja Beigel
|
|
@@ -12,6 +12,18 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: PyAudio==0.2.14
|
|
16
|
+
Requires-Dist: faster-whisper==1.0.3
|
|
17
|
+
Requires-Dist: pvporcupine==1.9.5
|
|
18
|
+
Requires-Dist: webrtcvad-wheels==2.0.14
|
|
19
|
+
Requires-Dist: halo==0.0.31
|
|
20
|
+
Requires-Dist: torch
|
|
21
|
+
Requires-Dist: torchaudio
|
|
22
|
+
Requires-Dist: scipy==1.14.1
|
|
23
|
+
Requires-Dist: openwakeword>=0.4.0
|
|
24
|
+
Requires-Dist: websockets==v12.0
|
|
25
|
+
Requires-Dist: websocket-client==1.8.0
|
|
26
|
+
Requires-Dist: numpy<2.0.0
|
|
15
27
|
|
|
16
28
|
# RealtimeSTT
|
|
17
29
|
[](https://pypi.org/project/RealtimeSTT/)
|
|
@@ -43,7 +55,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
43
55
|
|
|
44
56
|
### Updates
|
|
45
57
|
|
|
46
|
-
Latest Version: v0.3.
|
|
58
|
+
Latest Version: v0.3.9
|
|
47
59
|
|
|
48
60
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
49
61
|
|
|
@@ -117,10 +129,25 @@ pip install RealtimeSTT
|
|
|
117
129
|
|
|
118
130
|
This will install all the necessary dependencies, including a **CPU support only** version of PyTorch.
|
|
119
131
|
|
|
120
|
-
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using
|
|
132
|
+
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using CUDA (please scroll down).
|
|
121
133
|
|
|
122
|
-
###
|
|
134
|
+
### Linux Installation
|
|
135
|
+
|
|
136
|
+
Before installing RealtimeSTT please execute:
|
|
123
137
|
|
|
138
|
+
```bash
|
|
139
|
+
sudo apt-get install portaudio19-dev
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### MacOS Installation
|
|
143
|
+
|
|
144
|
+
Before installing RealtimeSTT please execute:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
brew install portaudio
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### GPU Support with CUDA (recommended)
|
|
124
151
|
|
|
125
152
|
### Updating PyTorch for CUDA Support
|
|
126
153
|
|
|
@@ -130,17 +157,17 @@ To upgrade your PyTorch installation to enable GPU support with CUDA, follow the
|
|
|
130
157
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
131
158
|
|
|
132
159
|
```bash
|
|
133
|
-
pip install torch==2.
|
|
160
|
+
pip install torch==2.5.1+cu118 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu118
|
|
134
161
|
```
|
|
135
162
|
|
|
136
163
|
#### For CUDA 12.X:
|
|
137
164
|
To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
138
165
|
|
|
139
166
|
```bash
|
|
140
|
-
pip install torch==2.
|
|
167
|
+
pip install torch==2.5.1+cu121 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
|
|
141
168
|
```
|
|
142
169
|
|
|
143
|
-
Replace `2.
|
|
170
|
+
Replace `2.5.1` with the version of PyTorch that matches your system and requirements.
|
|
144
171
|
|
|
145
172
|
### Steps That Might Be Necessary Before
|
|
146
173
|
|
|
@@ -450,6 +477,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
450
477
|
|
|
451
478
|
- **level** (int, default=logging.WARNING): Logging level.
|
|
452
479
|
|
|
480
|
+
- **batch_size** (int, default=16): Batch size for the main transcription. Set to 0 to deactivate.
|
|
481
|
+
|
|
453
482
|
- **init_logging** (bool, default=True): Whether to initialize the logging framework. Set to False to manage this yourself.
|
|
454
483
|
|
|
455
484
|
- **handle_buffer_overflow** (bool, default=True): If set, the system will log a warning when an input overflow occurs during recording and remove the data from the buffer.
|
|
@@ -489,6 +518,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
489
518
|
|
|
490
519
|
- **on_realtime_transcription_stabilized**: A callback function that is triggered whenever there's an update in the real-time transcription and returns a higher quality, stabilized text as its argument.
|
|
491
520
|
|
|
521
|
+
- **realtime_batch_size**: (int, default=16): Batch size for the real-time transcription model. Set to 0 to deactivate.
|
|
522
|
+
|
|
492
523
|
- **beam_size_realtime** (int, default=3): The beam size to use for real-time transcription beam search decoding.
|
|
493
524
|
|
|
494
525
|
#### Voice Activation Parameters
|
|
@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
28
28
|
|
|
29
29
|
### Updates
|
|
30
30
|
|
|
31
|
-
Latest Version: v0.3.
|
|
31
|
+
Latest Version: v0.3.9
|
|
32
32
|
|
|
33
33
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
34
34
|
|
|
@@ -102,10 +102,25 @@ pip install RealtimeSTT
|
|
|
102
102
|
|
|
103
103
|
This will install all the necessary dependencies, including a **CPU support only** version of PyTorch.
|
|
104
104
|
|
|
105
|
-
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using
|
|
105
|
+
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using CUDA (please scroll down).
|
|
106
106
|
|
|
107
|
-
###
|
|
107
|
+
### Linux Installation
|
|
108
|
+
|
|
109
|
+
Before installing RealtimeSTT please execute:
|
|
108
110
|
|
|
111
|
+
```bash
|
|
112
|
+
sudo apt-get install portaudio19-dev
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### MacOS Installation
|
|
116
|
+
|
|
117
|
+
Before installing RealtimeSTT please execute:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
brew install portaudio
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### GPU Support with CUDA (recommended)
|
|
109
124
|
|
|
110
125
|
### Updating PyTorch for CUDA Support
|
|
111
126
|
|
|
@@ -115,17 +130,17 @@ To upgrade your PyTorch installation to enable GPU support with CUDA, follow the
|
|
|
115
130
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
116
131
|
|
|
117
132
|
```bash
|
|
118
|
-
pip install torch==2.
|
|
133
|
+
pip install torch==2.5.1+cu118 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu118
|
|
119
134
|
```
|
|
120
135
|
|
|
121
136
|
#### For CUDA 12.X:
|
|
122
137
|
To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
123
138
|
|
|
124
139
|
```bash
|
|
125
|
-
pip install torch==2.
|
|
140
|
+
pip install torch==2.5.1+cu121 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
|
|
126
141
|
```
|
|
127
142
|
|
|
128
|
-
Replace `2.
|
|
143
|
+
Replace `2.5.1` with the version of PyTorch that matches your system and requirements.
|
|
129
144
|
|
|
130
145
|
### Steps That Might Be Necessary Before
|
|
131
146
|
|
|
@@ -435,6 +450,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
435
450
|
|
|
436
451
|
- **level** (int, default=logging.WARNING): Logging level.
|
|
437
452
|
|
|
453
|
+
- **batch_size** (int, default=16): Batch size for the main transcription. Set to 0 to deactivate.
|
|
454
|
+
|
|
438
455
|
- **init_logging** (bool, default=True): Whether to initialize the logging framework. Set to False to manage this yourself.
|
|
439
456
|
|
|
440
457
|
- **handle_buffer_overflow** (bool, default=True): If set, the system will log a warning when an input overflow occurs during recording and remove the data from the buffer.
|
|
@@ -474,6 +491,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
474
491
|
|
|
475
492
|
- **on_realtime_transcription_stabilized**: A callback function that is triggered whenever there's an update in the real-time transcription and returns a higher quality, stabilized text as its argument.
|
|
476
493
|
|
|
494
|
+
- **realtime_batch_size**: (int, default=16): Batch size for the real-time transcription model. Set to 0 to deactivate.
|
|
495
|
+
|
|
477
496
|
- **beam_size_realtime** (int, default=3): The beam size to use for real-time transcription beam search decoding.
|
|
478
497
|
|
|
479
498
|
#### Voice Activation Parameters
|
|
@@ -34,6 +34,7 @@ from openwakeword.model import Model
|
|
|
34
34
|
from scipy.signal import resample
|
|
35
35
|
from scipy import signal
|
|
36
36
|
import signal as system_signal
|
|
37
|
+
from faster_whisper import WhisperModel, BatchedInferencePipeline
|
|
37
38
|
import faster_whisper
|
|
38
39
|
import openwakeword
|
|
39
40
|
import collections
|
|
@@ -87,11 +88,12 @@ if platform.system() != 'Darwin':
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
class TranscriptionWorker:
|
|
90
|
-
def __init__(self, conn, stdout_pipe, model_path, compute_type, gpu_device_index, device,
|
|
91
|
-
ready_event, shutdown_event, interrupt_stop_event, beam_size, initial_prompt, suppress_tokens):
|
|
91
|
+
def __init__(self, conn, stdout_pipe, model_path, download_root, compute_type, gpu_device_index, device,
|
|
92
|
+
ready_event, shutdown_event, interrupt_stop_event, beam_size, initial_prompt, suppress_tokens, batch_size):
|
|
92
93
|
self.conn = conn
|
|
93
94
|
self.stdout_pipe = stdout_pipe
|
|
94
95
|
self.model_path = model_path
|
|
96
|
+
self.download_root = download_root
|
|
95
97
|
self.compute_type = compute_type
|
|
96
98
|
self.gpu_device_index = gpu_device_index
|
|
97
99
|
self.device = device
|
|
@@ -101,6 +103,7 @@ class TranscriptionWorker:
|
|
|
101
103
|
self.beam_size = beam_size
|
|
102
104
|
self.initial_prompt = initial_prompt
|
|
103
105
|
self.suppress_tokens = suppress_tokens
|
|
106
|
+
self.batch_size = batch_size
|
|
104
107
|
self.queue = queue.Queue()
|
|
105
108
|
|
|
106
109
|
def custom_print(self, *args, **kwargs):
|
|
@@ -134,7 +137,10 @@ class TranscriptionWorker:
|
|
|
134
137
|
device=self.device,
|
|
135
138
|
compute_type=self.compute_type,
|
|
136
139
|
device_index=self.gpu_device_index,
|
|
140
|
+
download_root=self.download_root,
|
|
137
141
|
)
|
|
142
|
+
if self.batch_size > 0:
|
|
143
|
+
model = BatchedInferencePipeline(model=model)
|
|
138
144
|
except Exception as e:
|
|
139
145
|
logging.exception(f"Error initializing main faster_whisper transcription model: {e}")
|
|
140
146
|
raise
|
|
@@ -151,13 +157,24 @@ class TranscriptionWorker:
|
|
|
151
157
|
try:
|
|
152
158
|
audio, language = self.queue.get(timeout=0.1)
|
|
153
159
|
try:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
160
|
+
if self.batch_size > 0:
|
|
161
|
+
segments, info = model.transcribe(
|
|
162
|
+
audio,
|
|
163
|
+
language=language if language else None,
|
|
164
|
+
beam_size=self.beam_size,
|
|
165
|
+
initial_prompt=self.initial_prompt,
|
|
166
|
+
suppress_tokens=self.suppress_tokens,
|
|
167
|
+
batch_size=self.batch_size
|
|
168
|
+
)
|
|
169
|
+
else:
|
|
170
|
+
segments, info = model.transcribe(
|
|
171
|
+
audio,
|
|
172
|
+
language=language if language else None,
|
|
173
|
+
beam_size=self.beam_size,
|
|
174
|
+
initial_prompt=self.initial_prompt,
|
|
175
|
+
suppress_tokens=self.suppress_tokens
|
|
176
|
+
)
|
|
177
|
+
|
|
161
178
|
transcription = " ".join(seg.text for seg in segments).strip()
|
|
162
179
|
logging.debug(f"Final text detected with main model: {transcription}")
|
|
163
180
|
self.conn.send(('success', (transcription, info)))
|
|
@@ -195,6 +212,7 @@ class AudioToTextRecorder:
|
|
|
195
212
|
|
|
196
213
|
def __init__(self,
|
|
197
214
|
model: str = INIT_MODEL_TRANSCRIPTION,
|
|
215
|
+
download_root: str = None,
|
|
198
216
|
language: str = "",
|
|
199
217
|
compute_type: str = "default",
|
|
200
218
|
input_device_index: int = None,
|
|
@@ -208,6 +226,7 @@ class AudioToTextRecorder:
|
|
|
208
226
|
use_microphone=True,
|
|
209
227
|
spinner=True,
|
|
210
228
|
level=logging.WARNING,
|
|
229
|
+
batch_size: int = 16,
|
|
211
230
|
|
|
212
231
|
# Realtime transcription parameters
|
|
213
232
|
enable_realtime_transcription=False,
|
|
@@ -217,6 +236,7 @@ class AudioToTextRecorder:
|
|
|
217
236
|
init_realtime_after_seconds=INIT_REALTIME_INITIAL_PAUSE,
|
|
218
237
|
on_realtime_transcription_update=None,
|
|
219
238
|
on_realtime_transcription_stabilized=None,
|
|
239
|
+
realtime_batch_size: int = 16,
|
|
220
240
|
|
|
221
241
|
# Voice activation parameters
|
|
222
242
|
silero_sensitivity: float = INIT_SILERO_SENSITIVITY,
|
|
@@ -280,6 +300,8 @@ class AudioToTextRecorder:
|
|
|
280
300
|
'large-v2'.
|
|
281
301
|
If a specific size is provided, the model is downloaded
|
|
282
302
|
from the Hugging Face Hub.
|
|
303
|
+
- download_root (str, default=None): Specifies the root path were the Whisper models
|
|
304
|
+
are downloaded to. When empty, the default is used.
|
|
283
305
|
- language (str, default=""): Language code for speech-to-text engine.
|
|
284
306
|
If not specified, the model will attempt to detect the language
|
|
285
307
|
automatically.
|
|
@@ -314,6 +336,7 @@ class AudioToTextRecorder:
|
|
|
314
336
|
- spinner (bool, default=True): Show spinner animation with current
|
|
315
337
|
state.
|
|
316
338
|
- level (int, default=logging.WARNING): Logging level.
|
|
339
|
+
- batch_size (int, default=16): Batch size for the main transcription
|
|
317
340
|
- enable_realtime_transcription (bool, default=False): Enables or
|
|
318
341
|
disables real-time transcription of audio. When set to True, the
|
|
319
342
|
audio will be transcribed continuously as it is being recorded.
|
|
@@ -345,6 +368,8 @@ class AudioToTextRecorder:
|
|
|
345
368
|
triggered when the transcribed text stabilizes in quality. The
|
|
346
369
|
stabilized text is generally more accurate but may arrive with a
|
|
347
370
|
slight delay compared to the regular real-time updates.
|
|
371
|
+
- realtime_batch_size (int, default=16): Batch size for the real-time
|
|
372
|
+
transcription model.
|
|
348
373
|
- silero_sensitivity (float, default=SILERO_SENSITIVITY): Sensitivity
|
|
349
374
|
for the Silero Voice Activity Detection model ranging from 0
|
|
350
375
|
(least sensitive) to 1 (most sensitive). Default is 0.5.
|
|
@@ -508,6 +533,7 @@ class AudioToTextRecorder:
|
|
|
508
533
|
self.enable_realtime_transcription = enable_realtime_transcription
|
|
509
534
|
self.use_main_model_for_realtime = use_main_model_for_realtime
|
|
510
535
|
self.main_model_type = model
|
|
536
|
+
self.download_root = download_root
|
|
511
537
|
self.realtime_model_type = realtime_model_type
|
|
512
538
|
self.realtime_processing_pause = realtime_processing_pause
|
|
513
539
|
self.init_realtime_after_seconds = init_realtime_after_seconds
|
|
@@ -522,6 +548,8 @@ class AudioToTextRecorder:
|
|
|
522
548
|
self.beam_size = beam_size
|
|
523
549
|
self.beam_size_realtime = beam_size_realtime
|
|
524
550
|
self.allowed_latency_limit = allowed_latency_limit
|
|
551
|
+
self.batch_size = batch_size
|
|
552
|
+
self.realtime_batch_size = realtime_batch_size
|
|
525
553
|
|
|
526
554
|
self.level = level
|
|
527
555
|
self.audio_queue = mp.Queue()
|
|
@@ -630,7 +658,8 @@ class AudioToTextRecorder:
|
|
|
630
658
|
args=(
|
|
631
659
|
child_transcription_pipe,
|
|
632
660
|
child_stdout_pipe,
|
|
633
|
-
|
|
661
|
+
self.main_model_type,
|
|
662
|
+
self.download_root,
|
|
634
663
|
self.compute_type,
|
|
635
664
|
self.gpu_device_index,
|
|
636
665
|
self.device,
|
|
@@ -639,7 +668,8 @@ class AudioToTextRecorder:
|
|
|
639
668
|
self.interrupt_stop_event,
|
|
640
669
|
self.beam_size,
|
|
641
670
|
self.initial_prompt,
|
|
642
|
-
self.suppress_tokens
|
|
671
|
+
self.suppress_tokens,
|
|
672
|
+
self.batch_size
|
|
643
673
|
)
|
|
644
674
|
)
|
|
645
675
|
|
|
@@ -673,8 +703,11 @@ class AudioToTextRecorder:
|
|
|
673
703
|
model_size_or_path=self.realtime_model_type,
|
|
674
704
|
device=self.device,
|
|
675
705
|
compute_type=self.compute_type,
|
|
676
|
-
device_index=self.gpu_device_index
|
|
706
|
+
device_index=self.gpu_device_index,
|
|
707
|
+
download_root=self.download_root,
|
|
677
708
|
)
|
|
709
|
+
if self.realtime_batch_size > 0:
|
|
710
|
+
self.realtime_model_type = BatchedInferencePipeline(model=self.realtime_model_type)
|
|
678
711
|
|
|
679
712
|
except Exception as e:
|
|
680
713
|
logging.exception("Error initializing faster_whisper "
|
|
@@ -2066,13 +2099,23 @@ class AudioToTextRecorder:
|
|
|
2066
2099
|
continue
|
|
2067
2100
|
else:
|
|
2068
2101
|
# Perform transcription and assemble the text
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2102
|
+
if self.realtime_batch_size > 0:
|
|
2103
|
+
segments, info = self.realtime_model_type.transcribe(
|
|
2104
|
+
audio_array,
|
|
2105
|
+
language=self.language if self.language else None,
|
|
2106
|
+
beam_size=self.beam_size_realtime,
|
|
2107
|
+
initial_prompt=self.initial_prompt,
|
|
2108
|
+
suppress_tokens=self.suppress_tokens,
|
|
2109
|
+
batch_size=self.realtime_batch_size
|
|
2110
|
+
)
|
|
2111
|
+
else:
|
|
2112
|
+
segments, info = self.realtime_model_type.transcribe(
|
|
2113
|
+
audio_array,
|
|
2114
|
+
language=self.language if self.language else None,
|
|
2115
|
+
beam_size=self.beam_size_realtime,
|
|
2116
|
+
initial_prompt=self.initial_prompt,
|
|
2117
|
+
suppress_tokens=self.suppress_tokens
|
|
2118
|
+
)
|
|
2076
2119
|
|
|
2077
2120
|
self.detected_realtime_language = info.language if info.language_probability > 0 else None
|
|
2078
2121
|
self.detected_realtime_language_probability = info.language_probability
|
|
@@ -4,8 +4,9 @@ debug_mode = False
|
|
|
4
4
|
from typing import Iterable, List, Optional, Union
|
|
5
5
|
from urllib.parse import urlparse
|
|
6
6
|
from datetime import datetime
|
|
7
|
+
from websocket import WebSocketApp
|
|
8
|
+
from websocket import ABNF
|
|
7
9
|
import subprocess
|
|
8
|
-
import websocket
|
|
9
10
|
import threading
|
|
10
11
|
import platform
|
|
11
12
|
import logging
|
|
@@ -307,7 +308,7 @@ class AudioToTextRecorderClient:
|
|
|
307
308
|
message = struct.pack('<I', metadata_length) + metadata_json.encode('utf-8') + chunk
|
|
308
309
|
|
|
309
310
|
if self.is_running:
|
|
310
|
-
self.data_ws.send(message, opcode=
|
|
311
|
+
self.data_ws.send(message, opcode=ABNF.OPCODE_BINARY)
|
|
311
312
|
|
|
312
313
|
def set_microphone(self, microphone_on=True):
|
|
313
314
|
"""
|
|
@@ -334,7 +335,7 @@ class AudioToTextRecorderClient:
|
|
|
334
335
|
|
|
335
336
|
try:
|
|
336
337
|
# Connect to control WebSocket
|
|
337
|
-
self.control_ws =
|
|
338
|
+
self.control_ws = WebSocketApp(self.control_url,
|
|
338
339
|
on_message=self.on_control_message,
|
|
339
340
|
on_error=self.on_error,
|
|
340
341
|
on_close=self.on_close,
|
|
@@ -345,7 +346,7 @@ class AudioToTextRecorderClient:
|
|
|
345
346
|
self.control_ws_thread.start()
|
|
346
347
|
|
|
347
348
|
# Connect to data WebSocket
|
|
348
|
-
self.data_ws =
|
|
349
|
+
self.data_ws = WebSocketApp(self.data_url,
|
|
349
350
|
on_message=self.on_data_message,
|
|
350
351
|
on_error=self.on_error,
|
|
351
352
|
on_close=self.on_close,
|
|
@@ -500,7 +501,7 @@ class AudioToTextRecorderClient:
|
|
|
500
501
|
raise Exception("Failed to set up audio recording.")
|
|
501
502
|
|
|
502
503
|
# Initialize WAV file writer if output_wav_file is provided
|
|
503
|
-
if self.output_wav_file:
|
|
504
|
+
if self.output_wav_file and not self.wav_file:
|
|
504
505
|
self.wav_file = wave.open(self.output_wav_file, 'wb')
|
|
505
506
|
self.wav_file.setnchannels(1)
|
|
506
507
|
self.wav_file.setsampwidth(2)
|
|
@@ -536,7 +537,7 @@ class AudioToTextRecorderClient:
|
|
|
536
537
|
if self.is_running:
|
|
537
538
|
if log_outgoing_chunks:
|
|
538
539
|
print(".", flush=True, end='')
|
|
539
|
-
self.data_ws.send(message, opcode=
|
|
540
|
+
self.data_ws.send(message, opcode=ABNF.OPCODE_BINARY)
|
|
540
541
|
except KeyboardInterrupt:
|
|
541
542
|
if self.debug_mode:
|
|
542
543
|
print("KeyboardInterrupt in record_and_send_audio, exiting...")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.9
|
|
4
4
|
Summary: A fast Voice Activity Detection and Transcription System
|
|
5
5
|
Home-page: https://github.com/KoljaB/RealTimeSTT
|
|
6
6
|
Author: Kolja Beigel
|
|
@@ -12,6 +12,18 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Requires-Python: >=3.6
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
+
Requires-Dist: PyAudio==0.2.14
|
|
16
|
+
Requires-Dist: faster-whisper==1.0.3
|
|
17
|
+
Requires-Dist: pvporcupine==1.9.5
|
|
18
|
+
Requires-Dist: webrtcvad-wheels==2.0.14
|
|
19
|
+
Requires-Dist: halo==0.0.31
|
|
20
|
+
Requires-Dist: torch
|
|
21
|
+
Requires-Dist: torchaudio
|
|
22
|
+
Requires-Dist: scipy==1.14.1
|
|
23
|
+
Requires-Dist: openwakeword>=0.4.0
|
|
24
|
+
Requires-Dist: websockets==v12.0
|
|
25
|
+
Requires-Dist: websocket-client==1.8.0
|
|
26
|
+
Requires-Dist: numpy<2.0.0
|
|
15
27
|
|
|
16
28
|
# RealtimeSTT
|
|
17
29
|
[](https://pypi.org/project/RealtimeSTT/)
|
|
@@ -43,7 +55,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
43
55
|
|
|
44
56
|
### Updates
|
|
45
57
|
|
|
46
|
-
Latest Version: v0.3.
|
|
58
|
+
Latest Version: v0.3.9
|
|
47
59
|
|
|
48
60
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
49
61
|
|
|
@@ -117,10 +129,25 @@ pip install RealtimeSTT
|
|
|
117
129
|
|
|
118
130
|
This will install all the necessary dependencies, including a **CPU support only** version of PyTorch.
|
|
119
131
|
|
|
120
|
-
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using
|
|
132
|
+
Although it is possible to run RealtimeSTT with a CPU installation only (use a small model like "tiny" or "base" in this case) you will get way better experience using CUDA (please scroll down).
|
|
121
133
|
|
|
122
|
-
###
|
|
134
|
+
### Linux Installation
|
|
135
|
+
|
|
136
|
+
Before installing RealtimeSTT please execute:
|
|
123
137
|
|
|
138
|
+
```bash
|
|
139
|
+
sudo apt-get install portaudio19-dev
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### MacOS Installation
|
|
143
|
+
|
|
144
|
+
Before installing RealtimeSTT please execute:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
brew install portaudio
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### GPU Support with CUDA (recommended)
|
|
124
151
|
|
|
125
152
|
### Updating PyTorch for CUDA Support
|
|
126
153
|
|
|
@@ -130,17 +157,17 @@ To upgrade your PyTorch installation to enable GPU support with CUDA, follow the
|
|
|
130
157
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
131
158
|
|
|
132
159
|
```bash
|
|
133
|
-
pip install torch==2.
|
|
160
|
+
pip install torch==2.5.1+cu118 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu118
|
|
134
161
|
```
|
|
135
162
|
|
|
136
163
|
#### For CUDA 12.X:
|
|
137
164
|
To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
138
165
|
|
|
139
166
|
```bash
|
|
140
|
-
pip install torch==2.
|
|
167
|
+
pip install torch==2.5.1+cu121 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu121
|
|
141
168
|
```
|
|
142
169
|
|
|
143
|
-
Replace `2.
|
|
170
|
+
Replace `2.5.1` with the version of PyTorch that matches your system and requirements.
|
|
144
171
|
|
|
145
172
|
### Steps That Might Be Necessary Before
|
|
146
173
|
|
|
@@ -450,6 +477,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
450
477
|
|
|
451
478
|
- **level** (int, default=logging.WARNING): Logging level.
|
|
452
479
|
|
|
480
|
+
- **batch_size** (int, default=16): Batch size for the main transcription. Set to 0 to deactivate.
|
|
481
|
+
|
|
453
482
|
- **init_logging** (bool, default=True): Whether to initialize the logging framework. Set to False to manage this yourself.
|
|
454
483
|
|
|
455
484
|
- **handle_buffer_overflow** (bool, default=True): If set, the system will log a warning when an input overflow occurs during recording and remove the data from the buffer.
|
|
@@ -489,6 +518,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
489
518
|
|
|
490
519
|
- **on_realtime_transcription_stabilized**: A callback function that is triggered whenever there's an update in the real-time transcription and returns a higher quality, stabilized text as its argument.
|
|
491
520
|
|
|
521
|
+
- **realtime_batch_size**: (int, default=16): Batch size for the real-time transcription model. Set to 0 to deactivate.
|
|
522
|
+
|
|
492
523
|
- **beam_size_realtime** (int, default=3): The beam size to use for real-time transcription beam search decoding.
|
|
493
524
|
|
|
494
525
|
#### Voice Activation Parameters
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import setuptools
|
|
2
|
-
|
|
3
|
-
with open("README.md", "r") as fh:
|
|
4
|
-
long_description = fh.read()
|
|
5
|
-
|
|
6
|
-
# Read requirements.txt
|
|
7
|
-
with open('requirements.txt') as f:
|
|
8
|
-
requirements = f.read().splitlines()
|
|
9
|
-
|
|
10
|
-
setuptools.setup(
|
|
11
|
-
name="RealtimeSTT",
|
|
12
|
-
version="0.3.
|
|
13
|
-
author="Kolja Beigel",
|
|
14
|
-
author_email="kolja.beigel@web.de",
|
|
15
|
-
description="A fast Voice Activity Detection and Transcription System",
|
|
16
|
-
long_description=long_description,
|
|
17
|
-
long_description_content_type="text/markdown",
|
|
18
|
-
url="https://github.com/KoljaB/RealTimeSTT",
|
|
19
|
-
packages=setuptools.find_packages(include=["RealtimeSTT", "RealtimeSTT_server"]),
|
|
20
|
-
classifiers=[
|
|
21
|
-
"Programming Language :: Python :: 3",
|
|
22
|
-
"License :: OSI Approved :: MIT License",
|
|
23
|
-
"Operating System :: OS Independent",
|
|
24
|
-
],
|
|
25
|
-
python_requires='>=3.6',
|
|
26
|
-
install_requires=requirements,
|
|
27
|
-
keywords="real-time, audio, transcription, speech-to-text, voice-activity-detection, VAD, real-time-transcription, ambient-noise-detection, microphone-input, faster_whisper, speech-recognition, voice-assistants, audio-processing, buffered-transcription, pyaudio, ambient-noise-level, voice-deactivity",
|
|
28
|
-
entry_points={
|
|
29
|
-
'console_scripts': [
|
|
30
|
-
'stt-server=RealtimeSTT_server.stt_server:main',
|
|
31
|
-
'stt=RealtimeSTT_server.stt_cli_client:main',
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
)
|
|
1
|
+
import setuptools
|
|
2
|
+
|
|
3
|
+
with open("README.md", "r") as fh:
|
|
4
|
+
long_description = fh.read()
|
|
5
|
+
|
|
6
|
+
# Read requirements.txt
|
|
7
|
+
with open('requirements.txt') as f:
|
|
8
|
+
requirements = f.read().splitlines()
|
|
9
|
+
|
|
10
|
+
setuptools.setup(
|
|
11
|
+
name="RealtimeSTT",
|
|
12
|
+
version="0.3.9",
|
|
13
|
+
author="Kolja Beigel",
|
|
14
|
+
author_email="kolja.beigel@web.de",
|
|
15
|
+
description="A fast Voice Activity Detection and Transcription System",
|
|
16
|
+
long_description=long_description,
|
|
17
|
+
long_description_content_type="text/markdown",
|
|
18
|
+
url="https://github.com/KoljaB/RealTimeSTT",
|
|
19
|
+
packages=setuptools.find_packages(include=["RealtimeSTT", "RealtimeSTT_server"]),
|
|
20
|
+
classifiers=[
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
],
|
|
25
|
+
python_requires='>=3.6',
|
|
26
|
+
install_requires=requirements,
|
|
27
|
+
keywords="real-time, audio, transcription, speech-to-text, voice-activity-detection, VAD, real-time-transcription, ambient-noise-detection, microphone-input, faster_whisper, speech-recognition, voice-assistants, audio-processing, buffered-transcription, pyaudio, ambient-noise-level, voice-deactivity",
|
|
28
|
+
entry_points={
|
|
29
|
+
'console_scripts': [
|
|
30
|
+
'stt-server=RealtimeSTT_server.stt_server:main',
|
|
31
|
+
'stt=RealtimeSTT_server.stt_cli_client:main',
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|