RealTimeSTT 0.2.1__tar.gz → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.2.1
3
+ Version: 0.2.3
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
@@ -47,7 +47,7 @@ https://github.com/KoljaB/RealtimeSTT/assets/7604638/207cb9a2-4482-48e7-9d2b-072
47
47
 
48
48
  ### Updates
49
49
 
50
- Latest Version: v0.2.0
50
+ Latest Version: v0.2.2
51
51
 
52
52
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
53
53
 
@@ -358,6 +358,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
358
358
 
359
359
  - **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.
360
360
 
361
+ - **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.
362
+
361
363
  - **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.
362
364
 
363
365
  - **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.0
25
+ Latest Version: v0.2.2
26
26
 
27
27
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
28
28
 
@@ -333,6 +333,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
333
333
 
334
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.
335
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
+
336
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.
337
339
 
338
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
@@ -402,6 +410,10 @@ class AudioToTextRecorder:
402
410
  self.initial_prompt = initial_prompt
403
411
  self.suppress_tokens = suppress_tokens
404
412
  self.use_wake_words = wake_words or wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}
413
+ self.detected_language = None
414
+ self.detected_language_probability = 0
415
+ self.detected_realtime_language = None
416
+ self.detected_realtime_language_probability = 0
405
417
 
406
418
  # Initialize the logging configuration with the specified level
407
419
  log_format = 'RealTimeSTT: %(name)s - %(levelname)s - %(message)s'
@@ -750,17 +762,16 @@ class AudioToTextRecorder:
750
762
  if conn.poll(0.5):
751
763
  audio, language = conn.recv()
752
764
  try:
753
- segments = model.transcribe(
765
+ segments, info = model.transcribe(
754
766
  audio,
755
767
  language=language if language else None,
756
768
  beam_size=beam_size,
757
769
  initial_prompt=initial_prompt,
758
770
  suppress_tokens=suppress_tokens
759
771
  )
760
- segments = segments[0]
761
772
  transcription = " ".join(seg.text for seg in segments)
762
773
  transcription = transcription.strip()
763
- conn.send(('success', transcription))
774
+ conn.send(('success', (transcription, info)))
764
775
  except Exception as e:
765
776
  logging.error(f"General transcription error: {e}")
766
777
  conn.send(('error', str(e)))
@@ -961,8 +972,11 @@ class AudioToTextRecorder:
961
972
 
962
973
  self._set_state("inactive")
963
974
  if status == 'success':
975
+ segments, info = result
976
+ self.detected_language = info.language if info.language_probability > 0 else None
977
+ self.detected_language_probability = info.language_probability
964
978
  self.last_transcription_bytes = audio_copy
965
- return self._preprocess_output(result)
979
+ return self._preprocess_output(segments)
966
980
  else:
967
981
  logging.error(result)
968
982
  raise Exception(result)
@@ -1350,14 +1364,16 @@ class AudioToTextRecorder:
1350
1364
 
1351
1365
  # Stop the recording if silence is detected after speech
1352
1366
  if self.stop_recording_on_voice_deactivity:
1367
+ is_speech = (
1368
+ self._is_silero_speech(data) if self.silero_deactivity_detection
1369
+ else self._is_webrtc_speech(data, True)
1370
+ )
1353
1371
 
1354
- if not self._is_webrtc_speech(data, True):
1355
-
1372
+ if not is_speech:
1356
1373
  # Voice deactivity was detected, so we start
1357
1374
  # measuring silence time before stopping recording
1358
1375
  if self.speech_end_silence_start == 0:
1359
1376
  self.speech_end_silence_start = time.time()
1360
-
1361
1377
  else:
1362
1378
  self.speech_end_silence_start = 0
1363
1379
 
@@ -1437,7 +1453,7 @@ class AudioToTextRecorder:
1437
1453
  INT16_MAX_ABS_VALUE
1438
1454
 
1439
1455
  # Perform transcription and assemble the text
1440
- segments = self.realtime_model_type.transcribe(
1456
+ segments, info = self.realtime_model_type.transcribe(
1441
1457
  audio_array,
1442
1458
  language=self.language if self.language else None,
1443
1459
  beam_size=self.beam_size_realtime,
@@ -1445,6 +1461,9 @@ class AudioToTextRecorder:
1445
1461
  suppress_tokens=self.suppress_tokens,
1446
1462
  )
1447
1463
 
1464
+ self.detected_realtime_language = info.language if info.language_probability > 0 else None
1465
+ self.detected_realtime_language_probability = info.language_probability
1466
+
1448
1467
  # double check recording state
1449
1468
  # because it could have changed mid-transcription
1450
1469
  if self.is_recording and time.time() - \
@@ -1452,7 +1471,7 @@ class AudioToTextRecorder:
1452
1471
 
1453
1472
  logging.debug('Starting realtime transcription')
1454
1473
  self.realtime_transcription_text = " ".join(
1455
- seg.text for seg in segments[0]
1474
+ seg.text for seg in segments
1456
1475
  )
1457
1476
  self.realtime_transcription_text = \
1458
1477
  self.realtime_transcription_text.strip()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.2.1
3
+ Version: 0.2.3
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
@@ -47,7 +47,7 @@ https://github.com/KoljaB/RealtimeSTT/assets/7604638/207cb9a2-4482-48e7-9d2b-072
47
47
 
48
48
  ### Updates
49
49
 
50
- Latest Version: v0.2.0
50
+ Latest Version: v0.2.2
51
51
 
52
52
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
53
53
 
@@ -358,6 +358,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
358
358
 
359
359
  - **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.
360
360
 
361
+ - **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.
362
+
361
363
  - **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.
362
364
 
363
365
  - **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.
@@ -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
@@ -9,7 +9,7 @@ with open('requirements.txt') as f:
9
9
 
10
10
  setuptools.setup(
11
11
  name="RealtimeSTT",
12
- version="0.2.1",
12
+ version="0.2.3",
13
13
  author="Kolja Beigel",
14
14
  author_email="kolja.beigel@web.de",
15
15
  description="A fast Voice Activity Detection and Transcription System",
File without changes
File without changes