RealTimeSTT 0.3.99__tar.gz → 0.3.101__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.99/realtimestt.egg-info → realtimestt-0.3.101}/PKG-INFO +8 -5
- {realtimestt-0.3.99 → realtimestt-0.3.101}/README.md +5 -1
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT/audio_recorder.py +93 -44
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT/audio_recorder_client.py +17 -9
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT_server/stt_server.py +4 -9
- {realtimestt-0.3.99 → realtimestt-0.3.101/realtimestt.egg-info}/PKG-INFO +8 -5
- {realtimestt-0.3.99 → realtimestt-0.3.101}/realtimestt.egg-info/requires.txt +2 -3
- {realtimestt-0.3.99 → realtimestt-0.3.101}/requirements.txt +2 -3
- {realtimestt-0.3.99 → realtimestt-0.3.101}/setup.py +1 -1
- {realtimestt-0.3.99 → realtimestt-0.3.101}/LICENSE +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/MANIFEST.in +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT/__init__.py +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT/audio_input.py +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT/warmup_audio.wav +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT_server/__init__.py +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT_server/install_packages.py +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/RealtimeSTT_server/stt_cli_client.py +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/realtimestt.egg-info/SOURCES.txt +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/realtimestt.egg-info/dependency_links.txt +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/realtimestt.egg-info/entry_points.txt +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/realtimestt.egg-info/top_level.txt +0 -0
- {realtimestt-0.3.99 → realtimestt-0.3.101}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: realtimestt
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.101
|
|
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
|
|
@@ -17,11 +17,10 @@ Requires-Dist: webrtcvad-wheels==2.0.14
|
|
|
17
17
|
Requires-Dist: halo==0.0.31
|
|
18
18
|
Requires-Dist: torch
|
|
19
19
|
Requires-Dist: torchaudio
|
|
20
|
-
Requires-Dist: scipy==1.15.
|
|
20
|
+
Requires-Dist: scipy==1.15.2
|
|
21
21
|
Requires-Dist: openwakeword>=0.4.0
|
|
22
|
-
Requires-Dist: websockets==
|
|
22
|
+
Requires-Dist: websockets==15.0.1
|
|
23
23
|
Requires-Dist: websocket-client==1.8.0
|
|
24
|
-
Requires-Dist: numpy<2.0.0
|
|
25
24
|
Requires-Dist: soundfile==0.13.1
|
|
26
25
|
Dynamic: author
|
|
27
26
|
Dynamic: author-email
|
|
@@ -67,7 +66,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
67
66
|
|
|
68
67
|
### Updates
|
|
69
68
|
|
|
70
|
-
Latest Version: v0.3.
|
|
69
|
+
Latest Version: v0.3.100
|
|
71
70
|
|
|
72
71
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
73
72
|
|
|
@@ -553,6 +552,10 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
553
552
|
|
|
554
553
|
- **pre_recording_buffer_duration** (float, default=0.2): The time span, in seconds, during which audio is buffered prior to formal recording. This helps counterbalancing the latency inherent in speech activity detection, ensuring no initial audio is missed.
|
|
555
554
|
|
|
555
|
+
- **on_vad_start**: A callable function triggered when the system has detected the start of voice activity presence.
|
|
556
|
+
|
|
557
|
+
- **on_vad_stop**: A callable function triggered when the system has detected the stop of voice activity presence.
|
|
558
|
+
|
|
556
559
|
- **on_vad_detect_start**: A callable function triggered when the system starts to listen for voice activity.
|
|
557
560
|
|
|
558
561
|
- **on_vad_detect_stop**: A callable function triggered when the system stops to listen for voice activity.
|
|
@@ -30,7 +30,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
30
30
|
|
|
31
31
|
### Updates
|
|
32
32
|
|
|
33
|
-
Latest Version: v0.3.
|
|
33
|
+
Latest Version: v0.3.100
|
|
34
34
|
|
|
35
35
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
36
36
|
|
|
@@ -516,6 +516,10 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
516
516
|
|
|
517
517
|
- **pre_recording_buffer_duration** (float, default=0.2): The time span, in seconds, during which audio is buffered prior to formal recording. This helps counterbalancing the latency inherent in speech activity detection, ensuring no initial audio is missed.
|
|
518
518
|
|
|
519
|
+
- **on_vad_start**: A callable function triggered when the system has detected the start of voice activity presence.
|
|
520
|
+
|
|
521
|
+
- **on_vad_stop**: A callable function triggered when the system has detected the stop of voice activity presence.
|
|
522
|
+
|
|
519
523
|
- **on_vad_detect_start**: A callable function triggered when the system starts to listen for voice activity.
|
|
520
524
|
|
|
521
525
|
- **on_vad_detect_stop**: A callable function triggered when the system stops to listen for voice activity.
|
|
@@ -273,11 +273,13 @@ class AudioToTextRecorder:
|
|
|
273
273
|
pre_recording_buffer_duration: float = (
|
|
274
274
|
INIT_PRE_RECORDING_BUFFER_DURATION
|
|
275
275
|
),
|
|
276
|
+
on_vad_start=None,
|
|
277
|
+
on_vad_stop=None,
|
|
276
278
|
on_vad_detect_start=None,
|
|
277
279
|
on_vad_detect_stop=None,
|
|
278
280
|
|
|
279
281
|
# Wake word parameters
|
|
280
|
-
wakeword_backend: str = "
|
|
282
|
+
wakeword_backend: str = "",
|
|
281
283
|
openwakeword_model_paths: str = None,
|
|
282
284
|
openwakeword_inference_framework: str = "onnx",
|
|
283
285
|
wake_words: str = "",
|
|
@@ -422,10 +424,18 @@ class AudioToTextRecorder:
|
|
|
422
424
|
- pre_recording_buffer_duration (float, default=0.2): Duration in
|
|
423
425
|
seconds for the audio buffer to maintain pre-roll audio
|
|
424
426
|
(compensates speech activity detection latency)
|
|
427
|
+
- on_vad_start (callable, default=None): Callback function to be called
|
|
428
|
+
when the system detected the start of voice activity presence.
|
|
429
|
+
- on_vad_stop (callable, default=None): Callback function to be called
|
|
430
|
+
when the system detected the stop (end) of voice activity presence.
|
|
425
431
|
- on_vad_detect_start (callable, default=None): Callback function to
|
|
426
|
-
be called when the system listens for voice activity.
|
|
432
|
+
be called when the system listens for voice activity. This is not
|
|
433
|
+
called when VAD actually happens (use on_vad_start for this), but
|
|
434
|
+
when the system starts listening for it.
|
|
427
435
|
- on_vad_detect_stop (callable, default=None): Callback function to be
|
|
428
|
-
called when the system stops listening for voice activity.
|
|
436
|
+
called when the system stops listening for voice activity. This is
|
|
437
|
+
not called when VAD actually stops (use on_vad_stop for this), but
|
|
438
|
+
when the system stops listening for it.
|
|
429
439
|
- wakeword_backend (str, default="pvporcupine"): Specifies the backend
|
|
430
440
|
library to use for wake word detection. Supported options include
|
|
431
441
|
'pvporcupine' for using the Porcupine wake word engine or 'oww' for
|
|
@@ -550,6 +560,8 @@ class AudioToTextRecorder:
|
|
|
550
560
|
self.on_recording_stop = on_recording_stop
|
|
551
561
|
self.on_wakeword_detected = on_wakeword_detected
|
|
552
562
|
self.on_wakeword_timeout = on_wakeword_timeout
|
|
563
|
+
self.on_vad_start = on_vad_start
|
|
564
|
+
self.on_vad_stop = on_vad_stop
|
|
553
565
|
self.on_vad_detect_start = on_vad_detect_start
|
|
554
566
|
self.on_vad_detect_stop = on_vad_detect_stop
|
|
555
567
|
self.on_wakeword_detection_start = on_wakeword_detection_start
|
|
@@ -629,6 +641,7 @@ class AudioToTextRecorder:
|
|
|
629
641
|
self.early_transcription_on_silence = early_transcription_on_silence
|
|
630
642
|
self.use_extended_logging = use_extended_logging
|
|
631
643
|
self.faster_whisper_vad_filter = faster_whisper_vad_filter
|
|
644
|
+
self.awaiting_speech_end = False
|
|
632
645
|
|
|
633
646
|
# ----------------------------------------------------------------------------
|
|
634
647
|
# Named logger configuration
|
|
@@ -759,7 +772,7 @@ class AudioToTextRecorder:
|
|
|
759
772
|
"transcription model initialized successfully")
|
|
760
773
|
|
|
761
774
|
# Setup wake word detection
|
|
762
|
-
if wake_words or wakeword_backend in {'oww', 'openwakeword', 'openwakewords'}:
|
|
775
|
+
if wake_words or wakeword_backend in {'oww', 'openwakeword', 'openwakewords', 'pvp', 'pvporcupine'}:
|
|
763
776
|
self.wakeword_backend = wakeword_backend
|
|
764
777
|
|
|
765
778
|
self.wake_words_list = [
|
|
@@ -1427,41 +1440,15 @@ class AudioToTextRecorder:
|
|
|
1427
1440
|
self.shutdown()
|
|
1428
1441
|
raise # Re-raise the exception after cleanup
|
|
1429
1442
|
|
|
1430
|
-
def transcribe(self):
|
|
1431
|
-
"""
|
|
1432
|
-
Transcribes audio captured by this class instance using the
|
|
1433
|
-
`faster_whisper` model.
|
|
1434
|
-
|
|
1435
|
-
Automatically starts recording upon voice activity if not manually
|
|
1436
|
-
started using `recorder.start()`.
|
|
1437
|
-
Automatically stops recording upon voice deactivity if not manually
|
|
1438
|
-
stopped with `recorder.stop()`.
|
|
1439
|
-
Processes the recorded audio to generate transcription.
|
|
1440
|
-
|
|
1441
|
-
Args:
|
|
1442
|
-
on_transcription_finished (callable, optional): Callback function
|
|
1443
|
-
to be executed when transcription is ready.
|
|
1444
|
-
If provided, transcription will be performed asynchronously,
|
|
1445
|
-
and the callback will receive the transcription as its argument.
|
|
1446
|
-
If omitted, the transcription will be performed synchronously,
|
|
1447
|
-
and the result will be returned.
|
|
1448
1443
|
|
|
1449
|
-
|
|
1450
|
-
str: The transcription of the recorded audio.
|
|
1451
|
-
|
|
1452
|
-
Raises:
|
|
1453
|
-
Exception: If there is an error during the transcription process.
|
|
1454
|
-
"""
|
|
1455
|
-
self._set_state("transcribing")
|
|
1456
|
-
audio_copy = copy.deepcopy(self.audio)
|
|
1444
|
+
def perform_final_transcription(self, audio_bytes=None):
|
|
1457
1445
|
start_time = 0
|
|
1458
1446
|
with self.transcription_lock:
|
|
1459
|
-
|
|
1460
1447
|
try:
|
|
1461
1448
|
if self.transcribe_count == 0:
|
|
1462
1449
|
logger.debug("Adding transcription request, no early transcription started")
|
|
1463
1450
|
start_time = time.time() # Start timing
|
|
1464
|
-
self.parent_transcription_pipe.send((
|
|
1451
|
+
self.parent_transcription_pipe.send((audio_bytes, self.language))
|
|
1465
1452
|
self.transcribe_count += 1
|
|
1466
1453
|
|
|
1467
1454
|
while self.transcribe_count > 0:
|
|
@@ -1481,7 +1468,7 @@ class AudioToTextRecorder:
|
|
|
1481
1468
|
segments, info = result
|
|
1482
1469
|
self.detected_language = info.language if info.language_probability > 0 else None
|
|
1483
1470
|
self.detected_language_probability = info.language_probability
|
|
1484
|
-
self.last_transcription_bytes = copy.deepcopy(
|
|
1471
|
+
self.last_transcription_bytes = copy.deepcopy(audio_bytes)
|
|
1485
1472
|
self.last_transcription_bytes_b64 = base64.b64encode(self.last_transcription_bytes.tobytes()).decode('utf-8')
|
|
1486
1473
|
transcription = self._preprocess_output(segments)
|
|
1487
1474
|
end_time = time.time() # End timing
|
|
@@ -1500,6 +1487,43 @@ class AudioToTextRecorder:
|
|
|
1500
1487
|
logger.error(f"Error during transcription: {str(e)}", exc_info=True)
|
|
1501
1488
|
raise e
|
|
1502
1489
|
|
|
1490
|
+
|
|
1491
|
+
def transcribe(self):
|
|
1492
|
+
"""
|
|
1493
|
+
Transcribes audio captured by this class instance using the
|
|
1494
|
+
`faster_whisper` model.
|
|
1495
|
+
|
|
1496
|
+
Automatically starts recording upon voice activity if not manually
|
|
1497
|
+
started using `recorder.start()`.
|
|
1498
|
+
Automatically stops recording upon voice deactivity if not manually
|
|
1499
|
+
stopped with `recorder.stop()`.
|
|
1500
|
+
Processes the recorded audio to generate transcription.
|
|
1501
|
+
|
|
1502
|
+
Args:
|
|
1503
|
+
on_transcription_finished (callable, optional): Callback function
|
|
1504
|
+
to be executed when transcription is ready.
|
|
1505
|
+
If provided, transcription will be performed asynchronously,
|
|
1506
|
+
and the callback will receive the transcription as its argument.
|
|
1507
|
+
If omitted, the transcription will be performed synchronously,
|
|
1508
|
+
and the result will be returned.
|
|
1509
|
+
|
|
1510
|
+
Returns (if no callback is set):
|
|
1511
|
+
str: The transcription of the recorded audio.
|
|
1512
|
+
|
|
1513
|
+
Raises:
|
|
1514
|
+
Exception: If there is an error during the transcription process.
|
|
1515
|
+
"""
|
|
1516
|
+
audio_copy = copy.deepcopy(self.audio)
|
|
1517
|
+
self._set_state("transcribing")
|
|
1518
|
+
if self.on_transcription_start:
|
|
1519
|
+
abort_value = self.on_transcription_start(audio_copy)
|
|
1520
|
+
if not abort_value:
|
|
1521
|
+
return self.perform_final_transcription(audio_copy)
|
|
1522
|
+
return None
|
|
1523
|
+
else:
|
|
1524
|
+
return self.perform_final_transcription(audio_copy)
|
|
1525
|
+
|
|
1526
|
+
|
|
1503
1527
|
def _process_wakeword(self, data):
|
|
1504
1528
|
"""
|
|
1505
1529
|
Processes audio data to detect wake words.
|
|
@@ -1985,8 +2009,8 @@ class AudioToTextRecorder:
|
|
|
1985
2009
|
|
|
1986
2010
|
if self._is_voice_active():
|
|
1987
2011
|
|
|
1988
|
-
if self.
|
|
1989
|
-
self.
|
|
2012
|
+
if self.on_vad_start:
|
|
2013
|
+
self.on_vad_start()
|
|
1990
2014
|
|
|
1991
2015
|
if self.use_extended_logging:
|
|
1992
2016
|
logger.debug('Debug: Voice activity detected')
|
|
@@ -2072,6 +2096,7 @@ class AudioToTextRecorder:
|
|
|
2072
2096
|
(time.time() - self.recording_start_time > self.min_length_of_recording):
|
|
2073
2097
|
|
|
2074
2098
|
self.speech_end_silence_start = time.time()
|
|
2099
|
+
self.awaiting_speech_end = True
|
|
2075
2100
|
|
|
2076
2101
|
if self.use_extended_logging:
|
|
2077
2102
|
logger.debug('Debug: Checking early transcription conditions')
|
|
@@ -2092,6 +2117,7 @@ class AudioToTextRecorder:
|
|
|
2092
2117
|
self.allowed_to_early_transcribe = False
|
|
2093
2118
|
|
|
2094
2119
|
else:
|
|
2120
|
+
self.awaiting_speech_end = False
|
|
2095
2121
|
if self.use_extended_logging:
|
|
2096
2122
|
logger.debug('Debug: Handling speech detection')
|
|
2097
2123
|
if self.speech_end_silence_start:
|
|
@@ -2106,8 +2132,9 @@ class AudioToTextRecorder:
|
|
|
2106
2132
|
if self.speech_end_silence_start and time.time() - \
|
|
2107
2133
|
self.speech_end_silence_start >= \
|
|
2108
2134
|
self.post_speech_silence_duration:
|
|
2109
|
-
|
|
2110
|
-
|
|
2135
|
+
|
|
2136
|
+
if self.on_vad_stop:
|
|
2137
|
+
self.on_vad_stop()
|
|
2111
2138
|
|
|
2112
2139
|
if self.use_extended_logging:
|
|
2113
2140
|
logger.debug('Debug: Formatting silence start time')
|
|
@@ -2139,6 +2166,8 @@ class AudioToTextRecorder:
|
|
|
2139
2166
|
logger.debug('Debug: Setting failed_stop_attempt to True')
|
|
2140
2167
|
failed_stop_attempt = True
|
|
2141
2168
|
|
|
2169
|
+
self.awaiting_speech_end = False
|
|
2170
|
+
|
|
2142
2171
|
if self.use_extended_logging:
|
|
2143
2172
|
logger.debug('Debug: Checking if recording stopped')
|
|
2144
2173
|
if not self.is_recording and was_recording:
|
|
@@ -2194,6 +2223,8 @@ class AudioToTextRecorder:
|
|
|
2194
2223
|
logger.debug('Debug: Exiting _recording_worker method')
|
|
2195
2224
|
|
|
2196
2225
|
|
|
2226
|
+
|
|
2227
|
+
|
|
2197
2228
|
def _realtime_worker(self):
|
|
2198
2229
|
"""
|
|
2199
2230
|
Performs real-time transcription if the feature is enabled.
|
|
@@ -2213,14 +2244,29 @@ class AudioToTextRecorder:
|
|
|
2213
2244
|
if not self.enable_realtime_transcription:
|
|
2214
2245
|
return
|
|
2215
2246
|
|
|
2216
|
-
#
|
|
2247
|
+
# Track time of last transcription
|
|
2248
|
+
last_transcription_time = time.time()
|
|
2249
|
+
|
|
2217
2250
|
while self.is_running:
|
|
2218
2251
|
|
|
2219
|
-
# Check if the recording is active
|
|
2220
2252
|
if self.is_recording:
|
|
2221
2253
|
|
|
2222
|
-
#
|
|
2223
|
-
|
|
2254
|
+
# MODIFIED SLEEP LOGIC:
|
|
2255
|
+
# Wait until realtime_processing_pause has elapsed,
|
|
2256
|
+
# but check often so we can respond to changes quickly.
|
|
2257
|
+
while (
|
|
2258
|
+
time.time() - last_transcription_time
|
|
2259
|
+
) < self.realtime_processing_pause:
|
|
2260
|
+
time.sleep(0.001)
|
|
2261
|
+
if not self.is_running or not self.is_recording:
|
|
2262
|
+
break
|
|
2263
|
+
|
|
2264
|
+
if self.awaiting_speech_end:
|
|
2265
|
+
time.sleep(0.001)
|
|
2266
|
+
continue
|
|
2267
|
+
|
|
2268
|
+
# Update transcription time
|
|
2269
|
+
last_transcription_time = time.time()
|
|
2224
2270
|
|
|
2225
2271
|
# Convert the buffer frames to a NumPy array
|
|
2226
2272
|
audio_array = np.frombuffer(
|
|
@@ -2524,12 +2570,17 @@ class AudioToTextRecorder:
|
|
|
2524
2570
|
logger.info(f"State changed from '{old_state}' to '{new_state}'")
|
|
2525
2571
|
|
|
2526
2572
|
# Execute callbacks based on transitioning FROM a particular state
|
|
2527
|
-
if old_state == "
|
|
2573
|
+
if old_state == "listening":
|
|
2574
|
+
if self.on_vad_detect_stop:
|
|
2575
|
+
self.on_vad_detect_stop()
|
|
2576
|
+
elif old_state == "wakeword":
|
|
2528
2577
|
if self.on_wakeword_detection_end:
|
|
2529
2578
|
self.on_wakeword_detection_end()
|
|
2530
2579
|
|
|
2531
2580
|
# Execute callbacks based on transitioning TO a particular state
|
|
2532
2581
|
if new_state == "listening":
|
|
2582
|
+
if self.on_vad_detect_start:
|
|
2583
|
+
self.on_vad_detect_start()
|
|
2533
2584
|
self._set_spinner("speak now")
|
|
2534
2585
|
if self.spinner and self.halo:
|
|
2535
2586
|
self.halo._interval = 250
|
|
@@ -2540,8 +2591,6 @@ class AudioToTextRecorder:
|
|
|
2540
2591
|
if self.spinner and self.halo:
|
|
2541
2592
|
self.halo._interval = 500
|
|
2542
2593
|
elif new_state == "transcribing":
|
|
2543
|
-
if self.on_transcription_start:
|
|
2544
|
-
self.on_transcription_start()
|
|
2545
2594
|
self._set_spinner("transcribing")
|
|
2546
2595
|
if self.spinner and self.halo:
|
|
2547
2596
|
self.halo._interval = 50
|
|
@@ -257,10 +257,13 @@ class AudioToTextRecorderClient:
|
|
|
257
257
|
|
|
258
258
|
|
|
259
259
|
if self.server_already_running:
|
|
260
|
-
self.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
if not self.connection_established.wait(timeout=10):
|
|
261
|
+
print("Server connection not established within 10 seconds.")
|
|
262
|
+
else:
|
|
263
|
+
self.set_parameter("language", self.language)
|
|
264
|
+
print(f"Language set to {self.language}")
|
|
265
|
+
self.set_parameter("wake_word_activation_delay", self.wake_word_activation_delay)
|
|
266
|
+
print(f"Wake word activation delay set to {self.wake_word_activation_delay}")
|
|
264
267
|
|
|
265
268
|
def text(self, on_transcription_finished=None):
|
|
266
269
|
self.realtime_text = ""
|
|
@@ -490,11 +493,16 @@ class AudioToTextRecorderClient:
|
|
|
490
493
|
print("STT server start command issued. Please wait a moment for it to initialize.", file=sys.stderr)
|
|
491
494
|
|
|
492
495
|
def is_server_running(self):
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
try:
|
|
497
|
+
# Attempt a proper WebSocket handshake to the control URL.
|
|
498
|
+
from websocket import create_connection
|
|
499
|
+
ws = create_connection(self.control_url, timeout=3)
|
|
500
|
+
ws.close()
|
|
501
|
+
return True
|
|
502
|
+
except Exception as e:
|
|
503
|
+
if self.debug_mode:
|
|
504
|
+
print(f"Server connectivity check failed: {e}")
|
|
505
|
+
return False
|
|
498
506
|
|
|
499
507
|
def ensure_server_running(self):
|
|
500
508
|
if not self.is_server_running():
|
|
@@ -290,14 +290,12 @@ def text_detected(text, loop):
|
|
|
290
290
|
print(f"\r[{timestamp}] {bcolors.OKCYAN}{text}{bcolors.ENDC}", flush=True, end='')
|
|
291
291
|
|
|
292
292
|
def on_recording_start(loop):
|
|
293
|
-
# Send a message to the client indicating recording has started
|
|
294
293
|
message = json.dumps({
|
|
295
294
|
'type': 'recording_start'
|
|
296
295
|
})
|
|
297
296
|
asyncio.run_coroutine_threadsafe(audio_queue.put(message), loop)
|
|
298
297
|
|
|
299
298
|
def on_recording_stop(loop):
|
|
300
|
-
# Send a message to the client indicating recording has stopped
|
|
301
299
|
message = json.dumps({
|
|
302
300
|
'type': 'recording_stop'
|
|
303
301
|
})
|
|
@@ -316,28 +314,24 @@ def on_vad_detect_stop(loop):
|
|
|
316
314
|
asyncio.run_coroutine_threadsafe(audio_queue.put(message), loop)
|
|
317
315
|
|
|
318
316
|
def on_wakeword_detected(loop):
|
|
319
|
-
# Send a message to the client when wake word detection starts
|
|
320
317
|
message = json.dumps({
|
|
321
318
|
'type': 'wakeword_detected'
|
|
322
319
|
})
|
|
323
320
|
asyncio.run_coroutine_threadsafe(audio_queue.put(message), loop)
|
|
324
321
|
|
|
325
322
|
def on_wakeword_detection_start(loop):
|
|
326
|
-
# Send a message to the client when wake word detection starts
|
|
327
323
|
message = json.dumps({
|
|
328
324
|
'type': 'wakeword_detection_start'
|
|
329
325
|
})
|
|
330
326
|
asyncio.run_coroutine_threadsafe(audio_queue.put(message), loop)
|
|
331
327
|
|
|
332
328
|
def on_wakeword_detection_end(loop):
|
|
333
|
-
# Send a message to the client when wake word detection ends
|
|
334
329
|
message = json.dumps({
|
|
335
330
|
'type': 'wakeword_detection_end'
|
|
336
331
|
})
|
|
337
332
|
asyncio.run_coroutine_threadsafe(audio_queue.put(message), loop)
|
|
338
333
|
|
|
339
|
-
def on_transcription_start(loop):
|
|
340
|
-
# Send a message to the client when transcription starts
|
|
334
|
+
def on_transcription_start(_audio_bytes, loop):
|
|
341
335
|
message = json.dumps({
|
|
342
336
|
'type': 'transcription_start'
|
|
343
337
|
})
|
|
@@ -460,8 +454,8 @@ def parse_arguments():
|
|
|
460
454
|
parser.add_argument('--wake_word_timeout', type=float, default=5.0,
|
|
461
455
|
help='Maximum time in seconds that the system will wait for a wake word before timing out. After this timeout, the system stops listening for wake words until reactivated. Default is 5.0 seconds.')
|
|
462
456
|
|
|
463
|
-
parser.add_argument('--wake_word_activation_delay', type=float, default=
|
|
464
|
-
help='The delay in seconds before the wake word detection is activated after the system starts listening. This prevents false positives during the start of a session. Default is 0
|
|
457
|
+
parser.add_argument('--wake_word_activation_delay', type=float, default=0,
|
|
458
|
+
help='The delay in seconds before the wake word detection is activated after the system starts listening. This prevents false positives during the start of a session. Default is 0 seconds.')
|
|
465
459
|
|
|
466
460
|
parser.add_argument('--wakeword_backend', type=str, default='none',
|
|
467
461
|
help='The backend used for wake word detection. You can specify different backends such as "default" or any custom implementations depending on your setup. Default is "pvporcupine".')
|
|
@@ -776,6 +770,7 @@ async def main_async():
|
|
|
776
770
|
'use_main_model_for_realtime': args.use_main_model_for_realtime,
|
|
777
771
|
'spinner': False,
|
|
778
772
|
'use_microphone': False,
|
|
773
|
+
|
|
779
774
|
'on_realtime_transcription_update': make_callback(loop, text_detected),
|
|
780
775
|
'on_recording_start': make_callback(loop, on_recording_start),
|
|
781
776
|
'on_recording_stop': make_callback(loop, on_recording_stop),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: realtimestt
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.101
|
|
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
|
|
@@ -17,11 +17,10 @@ Requires-Dist: webrtcvad-wheels==2.0.14
|
|
|
17
17
|
Requires-Dist: halo==0.0.31
|
|
18
18
|
Requires-Dist: torch
|
|
19
19
|
Requires-Dist: torchaudio
|
|
20
|
-
Requires-Dist: scipy==1.15.
|
|
20
|
+
Requires-Dist: scipy==1.15.2
|
|
21
21
|
Requires-Dist: openwakeword>=0.4.0
|
|
22
|
-
Requires-Dist: websockets==
|
|
22
|
+
Requires-Dist: websockets==15.0.1
|
|
23
23
|
Requires-Dist: websocket-client==1.8.0
|
|
24
|
-
Requires-Dist: numpy<2.0.0
|
|
25
24
|
Requires-Dist: soundfile==0.13.1
|
|
26
25
|
Dynamic: author
|
|
27
26
|
Dynamic: author-email
|
|
@@ -67,7 +66,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
67
66
|
|
|
68
67
|
### Updates
|
|
69
68
|
|
|
70
|
-
Latest Version: v0.3.
|
|
69
|
+
Latest Version: v0.3.100
|
|
71
70
|
|
|
72
71
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
73
72
|
|
|
@@ -553,6 +552,10 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
|
|
|
553
552
|
|
|
554
553
|
- **pre_recording_buffer_duration** (float, default=0.2): The time span, in seconds, during which audio is buffered prior to formal recording. This helps counterbalancing the latency inherent in speech activity detection, ensuring no initial audio is missed.
|
|
555
554
|
|
|
555
|
+
- **on_vad_start**: A callable function triggered when the system has detected the start of voice activity presence.
|
|
556
|
+
|
|
557
|
+
- **on_vad_stop**: A callable function triggered when the system has detected the stop of voice activity presence.
|
|
558
|
+
|
|
556
559
|
- **on_vad_detect_start**: A callable function triggered when the system starts to listen for voice activity.
|
|
557
560
|
|
|
558
561
|
- **on_vad_detect_stop**: A callable function triggered when the system stops to listen for voice activity.
|
|
@@ -14,7 +14,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
14
14
|
|
|
15
15
|
setuptools.setup(
|
|
16
16
|
name="realtimestt",
|
|
17
|
-
version="0.3.
|
|
17
|
+
version="0.3.101",
|
|
18
18
|
author="Kolja Beigel",
|
|
19
19
|
author_email="kolja.beigel@web.de",
|
|
20
20
|
description="A fast Voice Activity Detection and Transcription System",
|
|
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
|
|
File without changes
|