RealTimeSTT 0.2.0__tar.gz → 0.2.2__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.2.0 → RealtimeSTT-0.2.2}/PKG-INFO +7 -30
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/README.md +6 -19
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/RealtimeSTT/audio_recorder.py +124 -92
- {RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/PKG-INFO +7 -30
- {RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/SOURCES.txt +0 -5
- {RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/requires.txt +1 -1
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/setup.py +1 -1
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/LICENSE +0 -0
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/RealtimeSTT/__init__.py +0 -0
- {RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/dependency_links.txt +0 -0
- {RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/top_level.txt +0 -0
- {RealtimeSTT-0.2.0 → RealtimeSTT-0.2.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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,16 +12,6 @@ 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.2
|
|
17
|
-
Requires-Dist: pvporcupine==1.9.5
|
|
18
|
-
Requires-Dist: webrtcvad==2.0.10
|
|
19
|
-
Requires-Dist: halo==0.0.31
|
|
20
|
-
Requires-Dist: torch==2.3.1
|
|
21
|
-
Requires-Dist: torchaudio==2.3.1
|
|
22
|
-
Requires-Dist: scipy==1.12.0
|
|
23
|
-
Requires-Dist: websockets==v12.0
|
|
24
|
-
Requires-Dist: openwakeword==0.6.0
|
|
25
15
|
|
|
26
16
|
|
|
27
17
|
# RealtimeSTT
|
|
@@ -47,7 +37,7 @@ https://github.com/KoljaB/RealtimeSTT/assets/7604638/207cb9a2-4482-48e7-9d2b-072
|
|
|
47
37
|
|
|
48
38
|
### Updates
|
|
49
39
|
|
|
50
|
-
Latest Version: v0.2.
|
|
40
|
+
Latest Version: v0.2.2
|
|
51
41
|
|
|
52
42
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
53
43
|
|
|
@@ -89,24 +79,9 @@ Although it is possible to run RealtimeSTT with a CPU installation only (use a s
|
|
|
89
79
|
### GPU Support with CUDA (recommended)
|
|
90
80
|
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
### Updating PyTorch for CUDA Support
|
|
93
83
|
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu118
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*For Cuda 12.X:*
|
|
101
|
-
```bash
|
|
102
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu121
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
This command reinstalls PyTorch and Torchaudio with explicit support for CUDA.
|
|
106
|
-
|
|
107
|
-
### Updating PyTorch Only for CUDA Support
|
|
108
|
-
|
|
109
|
-
If you already have RealtimeSTT installed but want to upgrade your PyTorch installation to leverage GPU support with CUDA, follow these instructions based on your specific CUDA version. This process is useful if you initially installed RealtimeSTT with only CPU support and now wish to enhance its performance with CUDA capabilities.
|
|
84
|
+
To upgrade your PyTorch installation to enable GPU support with CUDA, follow these instructions based on your specific CUDA version. This is useful if you wish to enhance the performance of RealtimeSTT with CUDA capabilities.
|
|
110
85
|
|
|
111
86
|
#### For CUDA 11.8:
|
|
112
87
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
@@ -122,7 +97,7 @@ To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
|
122
97
|
pip install torch==2.3.1+cu121 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
|
|
123
98
|
```
|
|
124
99
|
|
|
125
|
-
Replace `2.3.1` with the version of
|
|
100
|
+
Replace `2.3.1` with the version of PyTorch that matches your system and requirements.
|
|
126
101
|
|
|
127
102
|
### Steps That Might Be Necessary Before
|
|
128
103
|
|
|
@@ -373,6 +348,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
373
348
|
|
|
374
349
|
- **silero_use_onnx** (bool, default=False): Enables usage of the pre-trained model from Silero in the ONNX (Open Neural Network Exchange) format instead of the PyTorch format. Default is False. Recommended for faster performance.
|
|
375
350
|
|
|
351
|
+
- **silero_deactivity_detection** (bool, default=False): Enables the Silero model for end-of-speech detection. More robust against background noise. Utilizes additional GPU resources but improves accuracy in noisy environments. When False, uses the default WebRTC VAD, which is more sensitive but may continue recording longer due to background sounds.
|
|
352
|
+
|
|
376
353
|
- **webrtc_sensitivity** (int, default=3): Sensitivity for the WebRTC Voice Activity Detection engine ranging from 0 (least aggressive / most sensitive) to 3 (most aggressive, least sensitive). Default is 3.
|
|
377
354
|
|
|
378
355
|
- **post_speech_silence_duration** (float, default=0.2): Duration in seconds of silence that must follow speech before the recording is considered to be completed. This ensures that any brief pauses during speech don't prematurely end the recording.
|
|
@@ -22,7 +22,7 @@ https://github.com/KoljaB/RealtimeSTT/assets/7604638/207cb9a2-4482-48e7-9d2b-072
|
|
|
22
22
|
|
|
23
23
|
### Updates
|
|
24
24
|
|
|
25
|
-
Latest Version: v0.2.
|
|
25
|
+
Latest Version: v0.2.2
|
|
26
26
|
|
|
27
27
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
28
28
|
|
|
@@ -64,24 +64,9 @@ Although it is possible to run RealtimeSTT with a CPU installation only (use a s
|
|
|
64
64
|
### GPU Support with CUDA (recommended)
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
### Updating PyTorch for CUDA Support
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu118
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*For Cuda 12.X:*
|
|
76
|
-
```bash
|
|
77
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu121
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
This command reinstalls PyTorch and Torchaudio with explicit support for CUDA.
|
|
81
|
-
|
|
82
|
-
### Updating PyTorch Only for CUDA Support
|
|
83
|
-
|
|
84
|
-
If you already have RealtimeSTT installed but want to upgrade your PyTorch installation to leverage GPU support with CUDA, follow these instructions based on your specific CUDA version. This process is useful if you initially installed RealtimeSTT with only CPU support and now wish to enhance its performance with CUDA capabilities.
|
|
69
|
+
To upgrade your PyTorch installation to enable GPU support with CUDA, follow these instructions based on your specific CUDA version. This is useful if you wish to enhance the performance of RealtimeSTT with CUDA capabilities.
|
|
85
70
|
|
|
86
71
|
#### For CUDA 11.8:
|
|
87
72
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
@@ -97,7 +82,7 @@ To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
|
97
82
|
pip install torch==2.3.1+cu121 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
|
|
98
83
|
```
|
|
99
84
|
|
|
100
|
-
Replace `2.3.1` with the version of
|
|
85
|
+
Replace `2.3.1` with the version of PyTorch that matches your system and requirements.
|
|
101
86
|
|
|
102
87
|
### Steps That Might Be Necessary Before
|
|
103
88
|
|
|
@@ -348,6 +333,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
348
333
|
|
|
349
334
|
- **silero_use_onnx** (bool, default=False): Enables usage of the pre-trained model from Silero in the ONNX (Open Neural Network Exchange) format instead of the PyTorch format. Default is False. Recommended for faster performance.
|
|
350
335
|
|
|
336
|
+
- **silero_deactivity_detection** (bool, default=False): Enables the Silero model for end-of-speech detection. More robust against background noise. Utilizes additional GPU resources but improves accuracy in noisy environments. When False, uses the default WebRTC VAD, which is more sensitive but may continue recording longer due to background sounds.
|
|
337
|
+
|
|
351
338
|
- **webrtc_sensitivity** (int, default=3): Sensitivity for the WebRTC Voice Activity Detection engine ranging from 0 (least aggressive / most sensitive) to 3 (most aggressive, least sensitive). Default is 3.
|
|
352
339
|
|
|
353
340
|
- **post_speech_silence_duration** (float, default=0.2): Duration in seconds of silence that must follow speech before the recording is considered to be completed. This ensures that any brief pauses during speech don't prematurely end the recording.
|
|
@@ -115,6 +115,7 @@ class AudioToTextRecorder:
|
|
|
115
115
|
# Voice activation parameters
|
|
116
116
|
silero_sensitivity: float = INIT_SILERO_SENSITIVITY,
|
|
117
117
|
silero_use_onnx: bool = False,
|
|
118
|
+
silero_deactivity_detection: bool = False,
|
|
118
119
|
webrtc_sensitivity: int = INIT_WEBRTC_SENSITIVITY,
|
|
119
120
|
post_speech_silence_duration: float = (
|
|
120
121
|
INIT_POST_SPEECH_SILENCE_DURATION
|
|
@@ -228,6 +229,12 @@ class AudioToTextRecorder:
|
|
|
228
229
|
pre-trained model from Silero in the ONNX (Open Neural Network
|
|
229
230
|
Exchange) format instead of the PyTorch format. This is
|
|
230
231
|
recommended for faster performance.
|
|
232
|
+
- silero_deactivity_detection (bool, default=False): Enables the Silero
|
|
233
|
+
model for end-of-speech detection. More robust against background
|
|
234
|
+
noise. Utilizes additional GPU resources but improves accuracy in
|
|
235
|
+
noisy environments. When False, uses the default WebRTC VAD,
|
|
236
|
+
which is more sensitive but may continue recording longer due
|
|
237
|
+
to background sounds.
|
|
231
238
|
- webrtc_sensitivity (int, default=WEBRTC_SENSITIVITY): Sensitivity
|
|
232
239
|
for the WebRTC Voice Activity Detection engine ranging from 0
|
|
233
240
|
(least aggressive / most sensitive) to 3 (most aggressive,
|
|
@@ -381,6 +388,7 @@ class AudioToTextRecorder:
|
|
|
381
388
|
self.silero_working = False
|
|
382
389
|
self.speech_end_silence_start = 0
|
|
383
390
|
self.silero_sensitivity = silero_sensitivity
|
|
391
|
+
self.silero_deactivity_detection = silero_deactivity_detection
|
|
384
392
|
self.listen_start = 0
|
|
385
393
|
self.spinner = spinner
|
|
386
394
|
self.halo = None
|
|
@@ -443,7 +451,7 @@ class AudioToTextRecorder:
|
|
|
443
451
|
# Set device for model
|
|
444
452
|
self.device = "cuda" if self.device == "cuda" and torch.cuda.is_available() else "cpu"
|
|
445
453
|
|
|
446
|
-
self.transcript_process =
|
|
454
|
+
self.transcript_process = self._start_thread(
|
|
447
455
|
target=AudioToTextRecorder._transcription_worker,
|
|
448
456
|
args=(
|
|
449
457
|
child_transcription_pipe,
|
|
@@ -459,7 +467,6 @@ class AudioToTextRecorder:
|
|
|
459
467
|
self.suppress_tokens
|
|
460
468
|
)
|
|
461
469
|
)
|
|
462
|
-
self.transcript_process.start()
|
|
463
470
|
|
|
464
471
|
# Start audio data reading process
|
|
465
472
|
if self.use_microphone.value:
|
|
@@ -468,7 +475,7 @@ class AudioToTextRecorder:
|
|
|
468
475
|
f" sample rate: {self.sample_rate}"
|
|
469
476
|
f" buffer size: {self.buffer_size}"
|
|
470
477
|
)
|
|
471
|
-
self.reader_process =
|
|
478
|
+
self.reader_process = self._start_thread(
|
|
472
479
|
target=AudioToTextRecorder._audio_data_worker,
|
|
473
480
|
args=(
|
|
474
481
|
self.audio_queue,
|
|
@@ -480,7 +487,6 @@ class AudioToTextRecorder:
|
|
|
480
487
|
self.use_microphone
|
|
481
488
|
)
|
|
482
489
|
)
|
|
483
|
-
self.reader_process.start()
|
|
484
490
|
|
|
485
491
|
# Initialize the realtime transcription model
|
|
486
492
|
if self.enable_realtime_transcription:
|
|
@@ -517,69 +523,71 @@ class AudioToTextRecorder:
|
|
|
517
523
|
for _ in range(len(self.wake_words_list))
|
|
518
524
|
]
|
|
519
525
|
|
|
520
|
-
|
|
521
|
-
case 'pvp' | 'pvporcupine':
|
|
522
|
-
try:
|
|
523
|
-
self.porcupine = pvporcupine.create(
|
|
524
|
-
keywords=self.wake_words_list,
|
|
525
|
-
sensitivities=self.wake_words_sensitivities
|
|
526
|
-
)
|
|
527
|
-
self.buffer_size = self.porcupine.frame_length
|
|
528
|
-
self.sample_rate = self.porcupine.sample_rate
|
|
526
|
+
if self.wakeword_backend in {'pvp', 'pvporcupine'}:
|
|
529
527
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
528
|
+
try:
|
|
529
|
+
self.porcupine = pvporcupine.create(
|
|
530
|
+
keywords=self.wake_words_list,
|
|
531
|
+
sensitivities=self.wake_words_sensitivities
|
|
532
|
+
)
|
|
533
|
+
self.buffer_size = self.porcupine.frame_length
|
|
534
|
+
self.sample_rate = self.porcupine.sample_rate
|
|
536
535
|
|
|
537
|
-
|
|
538
|
-
|
|
536
|
+
except Exception as e:
|
|
537
|
+
logging.exception(
|
|
538
|
+
"Error initializing porcupine "
|
|
539
|
+
f"wake word detection engine: {e}"
|
|
539
540
|
)
|
|
541
|
+
raise
|
|
540
542
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
+
logging.debug(
|
|
544
|
+
"Porcupine wake word detection engine initialized successfully"
|
|
545
|
+
)
|
|
543
546
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
self.owwModel = Model(
|
|
548
|
-
wakeword_models=model_paths,
|
|
549
|
-
inference_framework=openwakeword_inference_framework
|
|
550
|
-
)
|
|
551
|
-
logging.info(
|
|
552
|
-
"Successfully loaded wakeword model(s): "
|
|
553
|
-
f"{openwakeword_model_paths}"
|
|
554
|
-
)
|
|
555
|
-
else:
|
|
556
|
-
self.owwModel = Model(
|
|
557
|
-
inference_framework=openwakeword_inference_framework)
|
|
558
|
-
|
|
559
|
-
self.oww_n_models = len(self.owwModel.models.keys())
|
|
560
|
-
if not self.oww_n_models:
|
|
561
|
-
logging.error(
|
|
562
|
-
"No wake word models loaded."
|
|
563
|
-
)
|
|
564
|
-
|
|
565
|
-
for model_key in self.owwModel.models.keys():
|
|
566
|
-
logging.info(
|
|
567
|
-
"Successfully loaded openwakeword model: "
|
|
568
|
-
f"{model_key}"
|
|
569
|
-
)
|
|
547
|
+
elif self.wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}:
|
|
548
|
+
|
|
549
|
+
openwakeword.utils.download_models()
|
|
570
550
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
551
|
+
try:
|
|
552
|
+
if openwakeword_model_paths:
|
|
553
|
+
model_paths = openwakeword_model_paths.split(',')
|
|
554
|
+
self.owwModel = Model(
|
|
555
|
+
wakeword_models=model_paths,
|
|
556
|
+
inference_framework=openwakeword_inference_framework
|
|
557
|
+
)
|
|
558
|
+
logging.info(
|
|
559
|
+
"Successfully loaded wakeword model(s): "
|
|
560
|
+
f"{openwakeword_model_paths}"
|
|
561
|
+
)
|
|
562
|
+
else:
|
|
563
|
+
self.owwModel = Model(
|
|
564
|
+
inference_framework=openwakeword_inference_framework)
|
|
565
|
+
|
|
566
|
+
self.oww_n_models = len(self.owwModel.models.keys())
|
|
567
|
+
if not self.oww_n_models:
|
|
568
|
+
logging.error(
|
|
569
|
+
"No wake word models loaded."
|
|
570
|
+
)
|
|
571
|
+
|
|
572
|
+
for model_key in self.owwModel.models.keys():
|
|
573
|
+
logging.info(
|
|
574
|
+
"Successfully loaded openwakeword model: "
|
|
575
|
+
f"{model_key}"
|
|
575
576
|
)
|
|
576
|
-
raise
|
|
577
577
|
|
|
578
|
-
|
|
579
|
-
|
|
578
|
+
except Exception as e:
|
|
579
|
+
logging.exception(
|
|
580
|
+
"Error initializing openwakeword "
|
|
581
|
+
f"wake word detection engine: {e}"
|
|
580
582
|
)
|
|
581
|
-
|
|
582
|
-
|
|
583
|
+
raise
|
|
584
|
+
|
|
585
|
+
logging.debug(
|
|
586
|
+
"Open wake word detection engine initialized successfully"
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
else:
|
|
590
|
+
logging.exception(f"Wakeword engine {self.wakeword_backend} unknown/unsupported. Please specify one of: pvporcupine, openwakeword.")
|
|
583
591
|
|
|
584
592
|
|
|
585
593
|
# Setup voice activity detection model WebRTC
|
|
@@ -640,13 +648,36 @@ class AudioToTextRecorder:
|
|
|
640
648
|
self.realtime_thread = threading.Thread(target=self._realtime_worker)
|
|
641
649
|
self.realtime_thread.daemon = True
|
|
642
650
|
self.realtime_thread.start()
|
|
643
|
-
|
|
651
|
+
|
|
644
652
|
# Wait for transcription models to start
|
|
645
653
|
logging.debug('Waiting for main transcription model to start')
|
|
646
654
|
self.main_transcription_ready_event.wait()
|
|
647
655
|
logging.debug('Main transcription model ready')
|
|
648
656
|
|
|
649
657
|
logging.debug('RealtimeSTT initialization completed successfully')
|
|
658
|
+
|
|
659
|
+
def _start_thread(self, target=None, args=()):
|
|
660
|
+
"""
|
|
661
|
+
Implement a consistent threading model across the library.
|
|
662
|
+
|
|
663
|
+
This method is used to start any thread in this library. It uses the
|
|
664
|
+
standard threading. Thread for Linux and for all others uses the pytorch
|
|
665
|
+
MultiProcessing library 'Process'.
|
|
666
|
+
Args:
|
|
667
|
+
target (callable object): is the callable object to be invoked by
|
|
668
|
+
the run() method. Defaults to None, meaning nothing is called.
|
|
669
|
+
args (tuple): is a list or tuple of arguments for the target
|
|
670
|
+
invocation. Defaults to ().
|
|
671
|
+
"""
|
|
672
|
+
if (platform.system() == 'Linux'):
|
|
673
|
+
thread = threading.Thread(target=target, args=args)
|
|
674
|
+
thread.deamon = True
|
|
675
|
+
thread.start()
|
|
676
|
+
return thread
|
|
677
|
+
else:
|
|
678
|
+
thread = mp.Process(target=target, args=args)
|
|
679
|
+
thread.start()
|
|
680
|
+
return thread
|
|
650
681
|
|
|
651
682
|
@staticmethod
|
|
652
683
|
def _transcription_worker(conn,
|
|
@@ -948,37 +979,36 @@ class AudioToTextRecorder:
|
|
|
948
979
|
"""
|
|
949
980
|
Processes audio data to detect wake words.
|
|
950
981
|
"""
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
982
|
+
if self.wakeword_backend in {'pvp', 'pvporcupine'}:
|
|
983
|
+
pcm = struct.unpack_from(
|
|
984
|
+
"h" * self.buffer_size,
|
|
985
|
+
data
|
|
986
|
+
)
|
|
987
|
+
porcupine_index = self.porcupine.process(pcm)
|
|
988
|
+
if self.debug_mode:
|
|
989
|
+
print (f"wake words porcupine_index: {porcupine_index}")
|
|
990
|
+
return self.porcupine.process(pcm)
|
|
991
|
+
|
|
992
|
+
elif self.wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}:
|
|
993
|
+
pcm = np.frombuffer(data, dtype=np.int16)
|
|
994
|
+
prediction = self.owwModel.predict(pcm)
|
|
995
|
+
max_score = -1
|
|
996
|
+
max_index = -1
|
|
997
|
+
wake_words_in_prediction = len(self.owwModel.prediction_buffer.keys())
|
|
998
|
+
self.wake_words_sensitivities
|
|
999
|
+
if wake_words_in_prediction:
|
|
1000
|
+
for idx, mdl in enumerate(self.owwModel.prediction_buffer.keys()):
|
|
1001
|
+
scores = list(self.owwModel.prediction_buffer[mdl])
|
|
1002
|
+
if scores[-1] >= self.wake_words_sensitivity and scores[-1] > max_score:
|
|
1003
|
+
max_score = scores[-1]
|
|
1004
|
+
max_index = idx
|
|
958
1005
|
if self.debug_mode:
|
|
959
|
-
print (f"wake words
|
|
960
|
-
return
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
max_score = -1
|
|
966
|
-
max_index = -1
|
|
967
|
-
wake_words_in_prediction = len(self.owwModel.prediction_buffer.keys())
|
|
968
|
-
self.wake_words_sensitivities
|
|
969
|
-
if wake_words_in_prediction:
|
|
970
|
-
for idx, mdl in enumerate(self.owwModel.prediction_buffer.keys()):
|
|
971
|
-
scores = list(self.owwModel.prediction_buffer[mdl])
|
|
972
|
-
if scores[-1] >= self.wake_words_sensitivity and scores[-1] > max_score:
|
|
973
|
-
max_score = scores[-1]
|
|
974
|
-
max_index = idx
|
|
975
|
-
if self.debug_mode:
|
|
976
|
-
print (f"wake words oww max_index, max_score: {max_index} {max_score}")
|
|
977
|
-
return max_index
|
|
978
|
-
else:
|
|
979
|
-
if self.debug_mode:
|
|
980
|
-
print (f"wake words oww_index: -1")
|
|
981
|
-
return -1
|
|
1006
|
+
print (f"wake words oww max_index, max_score: {max_index} {max_score}")
|
|
1007
|
+
return max_index
|
|
1008
|
+
else:
|
|
1009
|
+
if self.debug_mode:
|
|
1010
|
+
print (f"wake words oww_index: -1")
|
|
1011
|
+
return -1
|
|
982
1012
|
|
|
983
1013
|
if self.debug_mode:
|
|
984
1014
|
print("wake words no match")
|
|
@@ -1328,14 +1358,16 @@ class AudioToTextRecorder:
|
|
|
1328
1358
|
|
|
1329
1359
|
# Stop the recording if silence is detected after speech
|
|
1330
1360
|
if self.stop_recording_on_voice_deactivity:
|
|
1361
|
+
is_speech = (
|
|
1362
|
+
self._is_silero_speech(data) if self.silero_deactivity_detection
|
|
1363
|
+
else self._is_webrtc_speech(data, True)
|
|
1364
|
+
)
|
|
1331
1365
|
|
|
1332
|
-
if not
|
|
1333
|
-
|
|
1366
|
+
if not is_speech:
|
|
1334
1367
|
# Voice deactivity was detected, so we start
|
|
1335
1368
|
# measuring silence time before stopping recording
|
|
1336
1369
|
if self.speech_end_silence_start == 0:
|
|
1337
1370
|
self.speech_end_silence_start = time.time()
|
|
1338
|
-
|
|
1339
1371
|
else:
|
|
1340
1372
|
self.speech_end_silence_start = 0
|
|
1341
1373
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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,16 +12,6 @@ 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.2
|
|
17
|
-
Requires-Dist: pvporcupine==1.9.5
|
|
18
|
-
Requires-Dist: webrtcvad==2.0.10
|
|
19
|
-
Requires-Dist: halo==0.0.31
|
|
20
|
-
Requires-Dist: torch==2.3.1
|
|
21
|
-
Requires-Dist: torchaudio==2.3.1
|
|
22
|
-
Requires-Dist: scipy==1.12.0
|
|
23
|
-
Requires-Dist: websockets==v12.0
|
|
24
|
-
Requires-Dist: openwakeword==0.6.0
|
|
25
15
|
|
|
26
16
|
|
|
27
17
|
# RealtimeSTT
|
|
@@ -47,7 +37,7 @@ https://github.com/KoljaB/RealtimeSTT/assets/7604638/207cb9a2-4482-48e7-9d2b-072
|
|
|
47
37
|
|
|
48
38
|
### Updates
|
|
49
39
|
|
|
50
|
-
Latest Version: v0.2.
|
|
40
|
+
Latest Version: v0.2.2
|
|
51
41
|
|
|
52
42
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
53
43
|
|
|
@@ -89,24 +79,9 @@ Although it is possible to run RealtimeSTT with a CPU installation only (use a s
|
|
|
89
79
|
### GPU Support with CUDA (recommended)
|
|
90
80
|
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
### Updating PyTorch for CUDA Support
|
|
93
83
|
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu118
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*For Cuda 12.X:*
|
|
101
|
-
```bash
|
|
102
|
-
pip install RealtimeSTT --index-url https://download.pytorch.org/whl/cu121
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
This command reinstalls PyTorch and Torchaudio with explicit support for CUDA.
|
|
106
|
-
|
|
107
|
-
### Updating PyTorch Only for CUDA Support
|
|
108
|
-
|
|
109
|
-
If you already have RealtimeSTT installed but want to upgrade your PyTorch installation to leverage GPU support with CUDA, follow these instructions based on your specific CUDA version. This process is useful if you initially installed RealtimeSTT with only CPU support and now wish to enhance its performance with CUDA capabilities.
|
|
84
|
+
To upgrade your PyTorch installation to enable GPU support with CUDA, follow these instructions based on your specific CUDA version. This is useful if you wish to enhance the performance of RealtimeSTT with CUDA capabilities.
|
|
110
85
|
|
|
111
86
|
#### For CUDA 11.8:
|
|
112
87
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
@@ -122,7 +97,7 @@ To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
|
122
97
|
pip install torch==2.3.1+cu121 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
|
|
123
98
|
```
|
|
124
99
|
|
|
125
|
-
Replace `2.3.1` with the version of
|
|
100
|
+
Replace `2.3.1` with the version of PyTorch that matches your system and requirements.
|
|
126
101
|
|
|
127
102
|
### Steps That Might Be Necessary Before
|
|
128
103
|
|
|
@@ -373,6 +348,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
373
348
|
|
|
374
349
|
- **silero_use_onnx** (bool, default=False): Enables usage of the pre-trained model from Silero in the ONNX (Open Neural Network Exchange) format instead of the PyTorch format. Default is False. Recommended for faster performance.
|
|
375
350
|
|
|
351
|
+
- **silero_deactivity_detection** (bool, default=False): Enables the Silero model for end-of-speech detection. More robust against background noise. Utilizes additional GPU resources but improves accuracy in noisy environments. When False, uses the default WebRTC VAD, which is more sensitive but may continue recording longer due to background sounds.
|
|
352
|
+
|
|
376
353
|
- **webrtc_sensitivity** (int, default=3): Sensitivity for the WebRTC Voice Activity Detection engine ranging from 0 (least aggressive / most sensitive) to 3 (most aggressive, least sensitive). Default is 3.
|
|
377
354
|
|
|
378
355
|
- **post_speech_silence_duration** (float, default=0.2): Duration in seconds of silence that must follow speech before the recording is considered to be completed. This ensures that any brief pauses during speech don't prematurely end the recording.
|
{RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/SOURCES.txt
RENAMED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
|
-
RealTimeSTT.egg-info/PKG-INFO
|
|
5
|
-
RealTimeSTT.egg-info/SOURCES.txt
|
|
6
|
-
RealTimeSTT.egg-info/dependency_links.txt
|
|
7
|
-
RealTimeSTT.egg-info/requires.txt
|
|
8
|
-
RealTimeSTT.egg-info/top_level.txt
|
|
9
4
|
RealtimeSTT/__init__.py
|
|
10
5
|
RealtimeSTT/audio_recorder.py
|
|
11
6
|
RealtimeSTT.egg-info/PKG-INFO
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{RealtimeSTT-0.2.0/RealTimeSTT.egg-info → RealtimeSTT-0.2.2/RealtimeSTT.egg-info}/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|