RealTimeSTT 0.2.2__tar.gz → 0.2.4__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.2 → RealtimeSTT-0.2.4}/PKG-INFO +13 -1
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/README.md +2 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT/audio_recorder.py +75 -25
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT.egg-info/PKG-INFO +13 -1
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/setup.py +1 -1
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/LICENSE +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT/__init__.py +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT.egg-info/SOURCES.txt +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT.egg-info/dependency_links.txt +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT.egg-info/requires.txt +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/RealtimeSTT.egg-info/top_level.txt +0 -0
- {RealtimeSTT-0.2.2 → RealtimeSTT-0.2.4}/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.4
|
|
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,16 @@ 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==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
|
|
15
25
|
|
|
16
26
|
|
|
17
27
|
# RealtimeSTT
|
|
@@ -331,6 +341,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
331
341
|
|
|
332
342
|
- **enable_realtime_transcription** (bool, default=False): Enables or disables real-time transcription of audio. When set to True, the audio will be transcribed continuously as it is being recorded.
|
|
333
343
|
|
|
344
|
+
- **use_main_model_for_realtime** (bool, default=False): If set to True, the main transcription model will be used for both regular and real-time transcription. If False, a separate model specified by `realtime_model_type` will be used for real-time transcription. Using a single model can save memory and potentially improve performance, but may not be optimized for real-time processing. Using separate models allows for a smaller, faster model for real-time transcription while keeping a more accurate model for final transcription.
|
|
345
|
+
|
|
334
346
|
- **realtime_model_type** (str, default="tiny"): Specifies the size or path of the machine learning model to be used for real-time transcription.
|
|
335
347
|
- Valid options: 'tiny', 'tiny.en', 'base', 'base.en', 'small', 'small.en', 'medium', 'medium.en', 'large-v1', 'large-v2'.
|
|
336
348
|
|
|
@@ -316,6 +316,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
316
316
|
|
|
317
317
|
- **enable_realtime_transcription** (bool, default=False): Enables or disables real-time transcription of audio. When set to True, the audio will be transcribed continuously as it is being recorded.
|
|
318
318
|
|
|
319
|
+
- **use_main_model_for_realtime** (bool, default=False): If set to True, the main transcription model will be used for both regular and real-time transcription. If False, a separate model specified by `realtime_model_type` will be used for real-time transcription. Using a single model can save memory and potentially improve performance, but may not be optimized for real-time processing. Using separate models allows for a smaller, faster model for real-time transcription while keeping a more accurate model for final transcription.
|
|
320
|
+
|
|
319
321
|
- **realtime_model_type** (str, default="tiny"): Specifies the size or path of the machine learning model to be used for real-time transcription.
|
|
320
322
|
- Valid options: 'tiny', 'tiny.en', 'base', 'base.en', 'small', 'small.en', 'medium', 'medium.en', 'large-v1', 'large-v2'.
|
|
321
323
|
|
|
@@ -107,6 +107,7 @@ class AudioToTextRecorder:
|
|
|
107
107
|
|
|
108
108
|
# Realtime transcription parameters
|
|
109
109
|
enable_realtime_transcription=False,
|
|
110
|
+
use_main_model_for_realtime=False,
|
|
110
111
|
realtime_model_type=INIT_MODEL_TRANSCRIPTION_REALTIME,
|
|
111
112
|
realtime_processing_pause=INIT_REALTIME_PROCESSING_PAUSE,
|
|
112
113
|
on_realtime_transcription_update=None,
|
|
@@ -206,6 +207,15 @@ class AudioToTextRecorder:
|
|
|
206
207
|
- enable_realtime_transcription (bool, default=False): Enables or
|
|
207
208
|
disables real-time transcription of audio. When set to True, the
|
|
208
209
|
audio will be transcribed continuously as it is being recorded.
|
|
210
|
+
- use_main_model_for_realtime (str, default=False):
|
|
211
|
+
If True, use the main transcription model for both regular and
|
|
212
|
+
real-time transcription. If False, use a separate model specified
|
|
213
|
+
by realtime_model_type for real-time transcription.
|
|
214
|
+
Using a single model can save memory and potentially improve
|
|
215
|
+
performance, but may not be optimized for real-time processing.
|
|
216
|
+
Using separate models allows for a smaller, faster model for
|
|
217
|
+
real-time transcription while keeping a more accurate model for
|
|
218
|
+
final transcription.
|
|
209
219
|
- realtime_model_type (str, default="tiny"): Specifies the machine
|
|
210
220
|
learning model to be used for real-time transcription. Valid
|
|
211
221
|
options include 'tiny', 'tiny.en', 'base', 'base.en', 'small',
|
|
@@ -229,7 +239,7 @@ class AudioToTextRecorder:
|
|
|
229
239
|
pre-trained model from Silero in the ONNX (Open Neural Network
|
|
230
240
|
Exchange) format instead of the PyTorch format. This is
|
|
231
241
|
recommended for faster performance.
|
|
232
|
-
|
|
242
|
+
- silero_deactivity_detection (bool, default=False): Enables the Silero
|
|
233
243
|
model for end-of-speech detection. More robust against background
|
|
234
244
|
noise. Utilizes additional GPU resources but improves accuracy in
|
|
235
245
|
noisy environments. When False, uses the default WebRTC VAD,
|
|
@@ -363,6 +373,7 @@ class AudioToTextRecorder:
|
|
|
363
373
|
self.on_recorded_chunk = on_recorded_chunk
|
|
364
374
|
self.on_transcription_start = on_transcription_start
|
|
365
375
|
self.enable_realtime_transcription = enable_realtime_transcription
|
|
376
|
+
self.use_main_model_for_realtime = use_main_model_for_realtime
|
|
366
377
|
self.realtime_model_type = realtime_model_type
|
|
367
378
|
self.realtime_processing_pause = realtime_processing_pause
|
|
368
379
|
self.on_realtime_transcription_update = (
|
|
@@ -410,6 +421,11 @@ class AudioToTextRecorder:
|
|
|
410
421
|
self.initial_prompt = initial_prompt
|
|
411
422
|
self.suppress_tokens = suppress_tokens
|
|
412
423
|
self.use_wake_words = wake_words or wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}
|
|
424
|
+
self.detected_language = None
|
|
425
|
+
self.detected_language_probability = 0
|
|
426
|
+
self.detected_realtime_language = None
|
|
427
|
+
self.detected_realtime_language_probability = 0
|
|
428
|
+
self.transcription_lock = threading.Lock()
|
|
413
429
|
|
|
414
430
|
# Initialize the logging configuration with the specified level
|
|
415
431
|
log_format = 'RealTimeSTT: %(name)s - %(levelname)s - %(message)s'
|
|
@@ -489,7 +505,7 @@ class AudioToTextRecorder:
|
|
|
489
505
|
)
|
|
490
506
|
|
|
491
507
|
# Initialize the realtime transcription model
|
|
492
|
-
if self.enable_realtime_transcription:
|
|
508
|
+
if self.enable_realtime_transcription and not self.use_main_model_for_realtime:
|
|
493
509
|
try:
|
|
494
510
|
logging.info("Initializing faster_whisper realtime "
|
|
495
511
|
f"transcription model {self.realtime_model_type}"
|
|
@@ -758,17 +774,16 @@ class AudioToTextRecorder:
|
|
|
758
774
|
if conn.poll(0.5):
|
|
759
775
|
audio, language = conn.recv()
|
|
760
776
|
try:
|
|
761
|
-
segments = model.transcribe(
|
|
777
|
+
segments, info = model.transcribe(
|
|
762
778
|
audio,
|
|
763
779
|
language=language if language else None,
|
|
764
780
|
beam_size=beam_size,
|
|
765
781
|
initial_prompt=initial_prompt,
|
|
766
782
|
suppress_tokens=suppress_tokens
|
|
767
783
|
)
|
|
768
|
-
segments = segments[0]
|
|
769
784
|
transcription = " ".join(seg.text for seg in segments)
|
|
770
785
|
transcription = transcription.strip()
|
|
771
|
-
conn.send(('success', transcription))
|
|
786
|
+
conn.send(('success', (transcription, info)))
|
|
772
787
|
except Exception as e:
|
|
773
788
|
logging.error(f"General transcription error: {e}")
|
|
774
789
|
conn.send(('error', str(e)))
|
|
@@ -964,16 +979,26 @@ class AudioToTextRecorder:
|
|
|
964
979
|
"""
|
|
965
980
|
self._set_state("transcribing")
|
|
966
981
|
audio_copy = copy.deepcopy(self.audio)
|
|
967
|
-
self.parent_transcription_pipe.send((self.audio, self.language))
|
|
968
|
-
status, result = self.parent_transcription_pipe.recv()
|
|
969
982
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
983
|
+
|
|
984
|
+
with self.transcription_lock:
|
|
985
|
+
try:
|
|
986
|
+
self.parent_transcription_pipe.send((self.audio, self.language))
|
|
987
|
+
status, result = self.parent_transcription_pipe.recv()
|
|
988
|
+
|
|
989
|
+
self._set_state("inactive")
|
|
990
|
+
if status == 'success':
|
|
991
|
+
segments, info = result
|
|
992
|
+
self.detected_language = info.language if info.language_probability > 0 else None
|
|
993
|
+
self.detected_language_probability = info.language_probability
|
|
994
|
+
self.last_transcription_bytes = audio_copy
|
|
995
|
+
return self._preprocess_output(segments)
|
|
996
|
+
else:
|
|
997
|
+
logging.error(f"Transcription error: {result}")
|
|
998
|
+
raise Exception(result)
|
|
999
|
+
except Exception as e:
|
|
1000
|
+
logging.error(f"Error during transcription: {str(e)}")
|
|
1001
|
+
raise e
|
|
977
1002
|
|
|
978
1003
|
def _process_wakeword(self, data):
|
|
979
1004
|
"""
|
|
@@ -1446,14 +1471,41 @@ class AudioToTextRecorder:
|
|
|
1446
1471
|
audio_array = audio_array.astype(np.float32) / \
|
|
1447
1472
|
INT16_MAX_ABS_VALUE
|
|
1448
1473
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1474
|
+
if self.use_main_model_for_realtime#:
|
|
1475
|
+
with self.transcription_lock:
|
|
1476
|
+
try:
|
|
1477
|
+
self.parent_transcription_pipe.send((audio_array, self.language))
|
|
1478
|
+
if self.parent_transcription_pipe.poll(timeout=5): # Wait for 5 seconds
|
|
1479
|
+
status, result = self.parent_transcription_pipe.recv()
|
|
1480
|
+
if status == 'success':
|
|
1481
|
+
segments, info = result
|
|
1482
|
+
self.detected_realtime_language = info.language if info.language_probability > 0 else None
|
|
1483
|
+
self.detected_realtime_language_probability = info.language_probability
|
|
1484
|
+
realtime_text = segments
|
|
1485
|
+
else:
|
|
1486
|
+
logging.error(f"Realtime transcription error: {result}")
|
|
1487
|
+
continue
|
|
1488
|
+
else:
|
|
1489
|
+
logging.warning("Realtime transcription timed out")
|
|
1490
|
+
continue
|
|
1491
|
+
except Exception as e:
|
|
1492
|
+
logging.error(f"Error in realtime transcription: {str(e)}")
|
|
1493
|
+
continue
|
|
1494
|
+
else:
|
|
1495
|
+
# Perform transcription and assemble the text
|
|
1496
|
+
segments, info = self.realtime_model_type.transcribe(
|
|
1497
|
+
audio_array,
|
|
1498
|
+
language=self.language if self.language else None,
|
|
1499
|
+
beam_size=self.beam_size_realtime,
|
|
1500
|
+
initial_prompt=self.initial_prompt,
|
|
1501
|
+
suppress_tokens=self.suppress_tokens,
|
|
1502
|
+
)
|
|
1503
|
+
|
|
1504
|
+
self.detected_realtime_language = info.language if info.language_probability > 0 else None
|
|
1505
|
+
self.detected_realtime_language_probability = info.language_probability
|
|
1506
|
+
realtime_text = " ".join(
|
|
1507
|
+
seg.text for seg in segments
|
|
1508
|
+
)
|
|
1457
1509
|
|
|
1458
1510
|
# double check recording state
|
|
1459
1511
|
# because it could have changed mid-transcription
|
|
@@ -1461,9 +1513,7 @@ class AudioToTextRecorder:
|
|
|
1461
1513
|
self.recording_start_time > 0.5:
|
|
1462
1514
|
|
|
1463
1515
|
logging.debug('Starting realtime transcription')
|
|
1464
|
-
self.realtime_transcription_text =
|
|
1465
|
-
seg.text for seg in segments[0]
|
|
1466
|
-
)
|
|
1516
|
+
self.realtime_transcription_text = realtime_text
|
|
1467
1517
|
self.realtime_transcription_text = \
|
|
1468
1518
|
self.realtime_transcription_text.strip()
|
|
1469
1519
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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,16 @@ 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==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
|
|
15
25
|
|
|
16
26
|
|
|
17
27
|
# RealtimeSTT
|
|
@@ -331,6 +341,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
331
341
|
|
|
332
342
|
- **enable_realtime_transcription** (bool, default=False): Enables or disables real-time transcription of audio. When set to True, the audio will be transcribed continuously as it is being recorded.
|
|
333
343
|
|
|
344
|
+
- **use_main_model_for_realtime** (bool, default=False): If set to True, the main transcription model will be used for both regular and real-time transcription. If False, a separate model specified by `realtime_model_type` will be used for real-time transcription. Using a single model can save memory and potentially improve performance, but may not be optimized for real-time processing. Using separate models allows for a smaller, faster model for real-time transcription while keeping a more accurate model for final transcription.
|
|
345
|
+
|
|
334
346
|
- **realtime_model_type** (str, default="tiny"): Specifies the size or path of the machine learning model to be used for real-time transcription.
|
|
335
347
|
- Valid options: 'tiny', 'tiny.en', 'base', 'base.en', 'small', 'small.en', 'medium', 'medium.en', 'large-v1', 'large-v2'.
|
|
336
348
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|