RealTimeSTT 0.2.0__tar.gz → 0.2.1__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.1}/PKG-INFO +5 -20
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/README.md +3 -18
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealTimeSTT.egg-info/PKG-INFO +5 -20
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealTimeSTT.egg-info/requires.txt +1 -1
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealtimeSTT/audio_recorder.py +111 -89
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/setup.py +1 -1
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/LICENSE +0 -0
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealTimeSTT.egg-info/SOURCES.txt +0 -0
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealTimeSTT.egg-info/dependency_links.txt +0 -0
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealTimeSTT.egg-info/top_level.txt +0 -0
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/RealtimeSTT/__init__.py +0 -0
- {RealtimeSTT-0.2.0 → realtimestt-0.2.1}/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.1
|
|
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
|
|
@@ -13,7 +13,7 @@ Requires-Python: >=3.6
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: PyAudio==0.2.14
|
|
16
|
-
Requires-Dist: faster-whisper==1.0.
|
|
16
|
+
Requires-Dist: faster-whisper==1.0.3
|
|
17
17
|
Requires-Dist: pvporcupine==1.9.5
|
|
18
18
|
Requires-Dist: webrtcvad==2.0.10
|
|
19
19
|
Requires-Dist: halo==0.0.31
|
|
@@ -89,24 +89,9 @@ Although it is possible to run RealtimeSTT with a CPU installation only (use a s
|
|
|
89
89
|
### GPU Support with CUDA (recommended)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
### Updating PyTorch for CUDA Support
|
|
93
93
|
|
|
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.
|
|
94
|
+
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
95
|
|
|
111
96
|
#### For CUDA 11.8:
|
|
112
97
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
@@ -122,7 +107,7 @@ To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
|
122
107
|
pip install torch==2.3.1+cu121 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
|
|
123
108
|
```
|
|
124
109
|
|
|
125
|
-
Replace `2.3.1` with the version of
|
|
110
|
+
Replace `2.3.1` with the version of PyTorch that matches your system and requirements.
|
|
126
111
|
|
|
127
112
|
### Steps That Might Be Necessary Before
|
|
128
113
|
|
|
@@ -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
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
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
|
|
@@ -13,7 +13,7 @@ Requires-Python: >=3.6
|
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
15
|
Requires-Dist: PyAudio==0.2.14
|
|
16
|
-
Requires-Dist: faster-whisper==1.0.
|
|
16
|
+
Requires-Dist: faster-whisper==1.0.3
|
|
17
17
|
Requires-Dist: pvporcupine==1.9.5
|
|
18
18
|
Requires-Dist: webrtcvad==2.0.10
|
|
19
19
|
Requires-Dist: halo==0.0.31
|
|
@@ -89,24 +89,9 @@ Although it is possible to run RealtimeSTT with a CPU installation only (use a s
|
|
|
89
89
|
### GPU Support with CUDA (recommended)
|
|
90
90
|
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
### Updating PyTorch for CUDA Support
|
|
93
93
|
|
|
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.
|
|
94
|
+
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
95
|
|
|
111
96
|
#### For CUDA 11.8:
|
|
112
97
|
To update PyTorch and Torchaudio to support CUDA 11.8, use the following commands:
|
|
@@ -122,7 +107,7 @@ To update PyTorch and Torchaudio to support CUDA 12.X, execute the following:
|
|
|
122
107
|
pip install torch==2.3.1+cu121 torchaudio==2.3.1 --index-url https://download.pytorch.org/whl/cu121
|
|
123
108
|
```
|
|
124
109
|
|
|
125
|
-
Replace `2.3.1` with the version of
|
|
110
|
+
Replace `2.3.1` with the version of PyTorch that matches your system and requirements.
|
|
126
111
|
|
|
127
112
|
### Steps That Might Be Necessary Before
|
|
128
113
|
|
|
@@ -443,7 +443,7 @@ class AudioToTextRecorder:
|
|
|
443
443
|
# Set device for model
|
|
444
444
|
self.device = "cuda" if self.device == "cuda" and torch.cuda.is_available() else "cpu"
|
|
445
445
|
|
|
446
|
-
self.transcript_process =
|
|
446
|
+
self.transcript_process = self._start_thread(
|
|
447
447
|
target=AudioToTextRecorder._transcription_worker,
|
|
448
448
|
args=(
|
|
449
449
|
child_transcription_pipe,
|
|
@@ -459,7 +459,6 @@ class AudioToTextRecorder:
|
|
|
459
459
|
self.suppress_tokens
|
|
460
460
|
)
|
|
461
461
|
)
|
|
462
|
-
self.transcript_process.start()
|
|
463
462
|
|
|
464
463
|
# Start audio data reading process
|
|
465
464
|
if self.use_microphone.value:
|
|
@@ -468,7 +467,7 @@ class AudioToTextRecorder:
|
|
|
468
467
|
f" sample rate: {self.sample_rate}"
|
|
469
468
|
f" buffer size: {self.buffer_size}"
|
|
470
469
|
)
|
|
471
|
-
self.reader_process =
|
|
470
|
+
self.reader_process = self._start_thread(
|
|
472
471
|
target=AudioToTextRecorder._audio_data_worker,
|
|
473
472
|
args=(
|
|
474
473
|
self.audio_queue,
|
|
@@ -480,7 +479,6 @@ class AudioToTextRecorder:
|
|
|
480
479
|
self.use_microphone
|
|
481
480
|
)
|
|
482
481
|
)
|
|
483
|
-
self.reader_process.start()
|
|
484
482
|
|
|
485
483
|
# Initialize the realtime transcription model
|
|
486
484
|
if self.enable_realtime_transcription:
|
|
@@ -517,69 +515,71 @@ class AudioToTextRecorder:
|
|
|
517
515
|
for _ in range(len(self.wake_words_list))
|
|
518
516
|
]
|
|
519
517
|
|
|
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
|
|
518
|
+
if self.wakeword_backend in {'pvp', 'pvporcupine'}:
|
|
529
519
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
520
|
+
try:
|
|
521
|
+
self.porcupine = pvporcupine.create(
|
|
522
|
+
keywords=self.wake_words_list,
|
|
523
|
+
sensitivities=self.wake_words_sensitivities
|
|
524
|
+
)
|
|
525
|
+
self.buffer_size = self.porcupine.frame_length
|
|
526
|
+
self.sample_rate = self.porcupine.sample_rate
|
|
536
527
|
|
|
537
|
-
|
|
538
|
-
|
|
528
|
+
except Exception as e:
|
|
529
|
+
logging.exception(
|
|
530
|
+
"Error initializing porcupine "
|
|
531
|
+
f"wake word detection engine: {e}"
|
|
539
532
|
)
|
|
533
|
+
raise
|
|
540
534
|
|
|
541
|
-
|
|
542
|
-
|
|
535
|
+
logging.debug(
|
|
536
|
+
"Porcupine wake word detection engine initialized successfully"
|
|
537
|
+
)
|
|
543
538
|
|
|
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
|
-
)
|
|
539
|
+
elif self.wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}:
|
|
540
|
+
|
|
541
|
+
openwakeword.utils.download_models()
|
|
570
542
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
543
|
+
try:
|
|
544
|
+
if openwakeword_model_paths:
|
|
545
|
+
model_paths = openwakeword_model_paths.split(',')
|
|
546
|
+
self.owwModel = Model(
|
|
547
|
+
wakeword_models=model_paths,
|
|
548
|
+
inference_framework=openwakeword_inference_framework
|
|
549
|
+
)
|
|
550
|
+
logging.info(
|
|
551
|
+
"Successfully loaded wakeword model(s): "
|
|
552
|
+
f"{openwakeword_model_paths}"
|
|
553
|
+
)
|
|
554
|
+
else:
|
|
555
|
+
self.owwModel = Model(
|
|
556
|
+
inference_framework=openwakeword_inference_framework)
|
|
557
|
+
|
|
558
|
+
self.oww_n_models = len(self.owwModel.models.keys())
|
|
559
|
+
if not self.oww_n_models:
|
|
560
|
+
logging.error(
|
|
561
|
+
"No wake word models loaded."
|
|
575
562
|
)
|
|
576
|
-
raise
|
|
577
563
|
|
|
578
|
-
|
|
579
|
-
|
|
564
|
+
for model_key in self.owwModel.models.keys():
|
|
565
|
+
logging.info(
|
|
566
|
+
"Successfully loaded openwakeword model: "
|
|
567
|
+
f"{model_key}"
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
except Exception as e:
|
|
571
|
+
logging.exception(
|
|
572
|
+
"Error initializing openwakeword "
|
|
573
|
+
f"wake word detection engine: {e}"
|
|
580
574
|
)
|
|
581
|
-
|
|
582
|
-
|
|
575
|
+
raise
|
|
576
|
+
|
|
577
|
+
logging.debug(
|
|
578
|
+
"Open wake word detection engine initialized successfully"
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
else:
|
|
582
|
+
logging.exception(f"Wakeword engine {self.wakeword_backend} unknown/unsupported. Please specify one of: pvporcupine, openwakeword.")
|
|
583
583
|
|
|
584
584
|
|
|
585
585
|
# Setup voice activity detection model WebRTC
|
|
@@ -640,13 +640,36 @@ class AudioToTextRecorder:
|
|
|
640
640
|
self.realtime_thread = threading.Thread(target=self._realtime_worker)
|
|
641
641
|
self.realtime_thread.daemon = True
|
|
642
642
|
self.realtime_thread.start()
|
|
643
|
-
|
|
643
|
+
|
|
644
644
|
# Wait for transcription models to start
|
|
645
645
|
logging.debug('Waiting for main transcription model to start')
|
|
646
646
|
self.main_transcription_ready_event.wait()
|
|
647
647
|
logging.debug('Main transcription model ready')
|
|
648
648
|
|
|
649
649
|
logging.debug('RealtimeSTT initialization completed successfully')
|
|
650
|
+
|
|
651
|
+
def _start_thread(self, target=None, args=()):
|
|
652
|
+
"""
|
|
653
|
+
Implement a consistent threading model across the library.
|
|
654
|
+
|
|
655
|
+
This method is used to start any thread in this library. It uses the
|
|
656
|
+
standard threading. Thread for Linux and for all others uses the pytorch
|
|
657
|
+
MultiProcessing library 'Process'.
|
|
658
|
+
Args:
|
|
659
|
+
target (callable object): is the callable object to be invoked by
|
|
660
|
+
the run() method. Defaults to None, meaning nothing is called.
|
|
661
|
+
args (tuple): is a list or tuple of arguments for the target
|
|
662
|
+
invocation. Defaults to ().
|
|
663
|
+
"""
|
|
664
|
+
if (platform.system() == 'Linux'):
|
|
665
|
+
thread = threading.Thread(target=target, args=args)
|
|
666
|
+
thread.deamon = True
|
|
667
|
+
thread.start()
|
|
668
|
+
return thread
|
|
669
|
+
else:
|
|
670
|
+
thread = mp.Process(target=target, args=args)
|
|
671
|
+
thread.start()
|
|
672
|
+
return thread
|
|
650
673
|
|
|
651
674
|
@staticmethod
|
|
652
675
|
def _transcription_worker(conn,
|
|
@@ -948,37 +971,36 @@ class AudioToTextRecorder:
|
|
|
948
971
|
"""
|
|
949
972
|
Processes audio data to detect wake words.
|
|
950
973
|
"""
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
974
|
+
if self.wakeword_backend in {'pvp', 'pvporcupine'}:
|
|
975
|
+
pcm = struct.unpack_from(
|
|
976
|
+
"h" * self.buffer_size,
|
|
977
|
+
data
|
|
978
|
+
)
|
|
979
|
+
porcupine_index = self.porcupine.process(pcm)
|
|
980
|
+
if self.debug_mode:
|
|
981
|
+
print (f"wake words porcupine_index: {porcupine_index}")
|
|
982
|
+
return self.porcupine.process(pcm)
|
|
983
|
+
|
|
984
|
+
elif self.wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}:
|
|
985
|
+
pcm = np.frombuffer(data, dtype=np.int16)
|
|
986
|
+
prediction = self.owwModel.predict(pcm)
|
|
987
|
+
max_score = -1
|
|
988
|
+
max_index = -1
|
|
989
|
+
wake_words_in_prediction = len(self.owwModel.prediction_buffer.keys())
|
|
990
|
+
self.wake_words_sensitivities
|
|
991
|
+
if wake_words_in_prediction:
|
|
992
|
+
for idx, mdl in enumerate(self.owwModel.prediction_buffer.keys()):
|
|
993
|
+
scores = list(self.owwModel.prediction_buffer[mdl])
|
|
994
|
+
if scores[-1] >= self.wake_words_sensitivity and scores[-1] > max_score:
|
|
995
|
+
max_score = scores[-1]
|
|
996
|
+
max_index = idx
|
|
958
997
|
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
|
|
998
|
+
print (f"wake words oww max_index, max_score: {max_index} {max_score}")
|
|
999
|
+
return max_index
|
|
1000
|
+
else:
|
|
1001
|
+
if self.debug_mode:
|
|
1002
|
+
print (f"wake words oww_index: -1")
|
|
1003
|
+
return -1
|
|
982
1004
|
|
|
983
1005
|
if self.debug_mode:
|
|
984
1006
|
print("wake words no match")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|