RealTimeSTT 0.3.6__tar.gz → 0.3.7__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.6 → realtimestt-0.3.7}/PKG-INFO +2 -2
- {realtimestt-0.3.6 → realtimestt-0.3.7}/README.md +1 -1
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/PKG-INFO +2 -2
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT_server/stt_cli_client.py +73 -45
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT_server/stt_server.py +63 -67
- {realtimestt-0.3.6 → realtimestt-0.3.7}/setup.py +1 -1
- {realtimestt-0.3.6 → realtimestt-0.3.7}/LICENSE +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT/__init__.py +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT/audio_recorder.py +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT/audio_recorder_client.py +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/SOURCES.txt +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/dependency_links.txt +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/entry_points.txt +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/requires.txt +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT.egg-info/top_level.txt +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT_server/__init__.py +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/RealtimeSTT_server/install_packages.py +0 -0
- {realtimestt-0.3.6 → realtimestt-0.3.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7
|
|
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
|
|
@@ -55,7 +55,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
55
55
|
|
|
56
56
|
### Updates
|
|
57
57
|
|
|
58
|
-
Latest Version: v0.3.
|
|
58
|
+
Latest Version: v0.3.7
|
|
59
59
|
|
|
60
60
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
61
61
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: RealtimeSTT
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.7
|
|
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
|
|
@@ -55,7 +55,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
|
|
|
55
55
|
|
|
56
56
|
### Updates
|
|
57
57
|
|
|
58
|
-
Latest Version: v0.3.
|
|
58
|
+
Latest Version: v0.3.7
|
|
59
59
|
|
|
60
60
|
See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
|
|
61
61
|
|
|
@@ -7,19 +7,19 @@ Usage:
|
|
|
7
7
|
stt [--control-url CONTROL_URL] [--data-url DATA_URL] [--debug] [--norealtime] [--set-param PARAM VALUE] [--call-method METHOD [ARGS ...]] [--get-param PARAM]
|
|
8
8
|
|
|
9
9
|
Options:
|
|
10
|
-
--control
|
|
11
|
-
--data
|
|
12
|
-
--debug
|
|
13
|
-
--norealtime
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
- `-c, --control, --control_url`: STT Control WebSocket URL; default `DEFAULT_CONTROL_URL`.
|
|
11
|
+
- `-d, --data, --data_url`: STT Data WebSocket URL; default `DEFAULT_DATA_URL`.
|
|
12
|
+
- `-D, --debug`: Enable debug mode.
|
|
13
|
+
- `-n, --norealtime`: Disable real-time output.
|
|
14
|
+
- `-W, --write`: Save recorded audio to a WAV file.
|
|
15
|
+
- `-s, --set`: Set a recorder parameter with format `PARAM VALUE`; can be used multiple times.
|
|
16
|
+
- `-m, --method`: Call a recorder method with optional arguments; can be used multiple times.
|
|
17
|
+
- `-g, --get`: Get a recorder parameter's value; can be used multiple times.
|
|
18
|
+
- `-l, --loop`: Continuously transcribe speech without exiting.
|
|
17
19
|
"""
|
|
18
20
|
|
|
19
21
|
from urllib.parse import urlparse
|
|
20
|
-
from scipy import signal
|
|
21
22
|
from queue import Queue
|
|
22
|
-
import numpy as np
|
|
23
23
|
import subprocess
|
|
24
24
|
import threading
|
|
25
25
|
import websocket
|
|
@@ -53,12 +53,12 @@ init()
|
|
|
53
53
|
websocket.enableTrace(False)
|
|
54
54
|
|
|
55
55
|
class STTWebSocketClient:
|
|
56
|
-
def __init__(self, control_url, data_url, debug=False, file_output=None, norealtime=False, writechunks=None):
|
|
56
|
+
def __init__(self, control_url, data_url, debug=False, file_output=None, norealtime=False, writechunks=None, continuous=False):
|
|
57
57
|
self.control_url = control_url
|
|
58
58
|
self.data_url = data_url
|
|
59
59
|
self.control_ws = None
|
|
60
60
|
self.data_ws_app = None
|
|
61
|
-
self.data_ws_connected = None
|
|
61
|
+
self.data_ws_connected = None
|
|
62
62
|
self.is_running = True
|
|
63
63
|
self.debug = debug
|
|
64
64
|
self.file_output = file_output
|
|
@@ -72,7 +72,8 @@ class STTWebSocketClient:
|
|
|
72
72
|
self.stop_event = threading.Event()
|
|
73
73
|
self.chunks_sent = 0
|
|
74
74
|
self.last_chunk_time = time.time()
|
|
75
|
-
self.writechunks = writechunks
|
|
75
|
+
self.writechunks = writechunks
|
|
76
|
+
self.continuous = continuous
|
|
76
77
|
|
|
77
78
|
self.debug_print("Initializing STT WebSocket Client")
|
|
78
79
|
self.debug_print(f"Control URL: {control_url}")
|
|
@@ -80,6 +81,7 @@ class STTWebSocketClient:
|
|
|
80
81
|
self.debug_print(f"File Output: {file_output}")
|
|
81
82
|
self.debug_print(f"No Realtime: {norealtime}")
|
|
82
83
|
self.debug_print(f"Write Chunks: {writechunks}")
|
|
84
|
+
self.debug_print(f"Continuous Mode: {continuous}")
|
|
83
85
|
|
|
84
86
|
# Audio attributes
|
|
85
87
|
self.audio_interface = None
|
|
@@ -144,7 +146,6 @@ class STTWebSocketClient:
|
|
|
144
146
|
self.debug_print(f"Error while connecting to the server: {str(e)}")
|
|
145
147
|
return False
|
|
146
148
|
|
|
147
|
-
|
|
148
149
|
def on_control_open(self, ws):
|
|
149
150
|
self.debug_print("Control WebSocket connection opened successfully")
|
|
150
151
|
self.connection_established.set()
|
|
@@ -157,14 +158,16 @@ class STTWebSocketClient:
|
|
|
157
158
|
|
|
158
159
|
def on_error(self, ws, error):
|
|
159
160
|
self.debug_print(f"WebSocket error occurred: {str(error)}")
|
|
160
|
-
self.debug_print(f"WebSocket object: {ws}")
|
|
161
161
|
self.debug_print(f"Error type: {type(error)}")
|
|
162
162
|
|
|
163
163
|
def on_close(self, ws, close_status_code, close_msg):
|
|
164
|
-
self.
|
|
165
|
-
|
|
166
|
-
self.
|
|
167
|
-
|
|
164
|
+
if ws == self.data_ws_connected:
|
|
165
|
+
self.debug_print(f"Data connection closed (code {close_status_code}, msg: {close_msg})")
|
|
166
|
+
elif ws == self.control_ws:
|
|
167
|
+
self.debug_print(f"Control connection closed (code {close_status_code}, msg: {close_msg})")
|
|
168
|
+
else:
|
|
169
|
+
self.debug_print(f"Unknown connection closed (code {close_status_code}, msg: {close_msg})")
|
|
170
|
+
|
|
168
171
|
self.is_running = False
|
|
169
172
|
self.stop_event.set()
|
|
170
173
|
|
|
@@ -290,6 +293,7 @@ class STTWebSocketClient:
|
|
|
290
293
|
self.last_text = data['text']
|
|
291
294
|
if not self.norealtime:
|
|
292
295
|
self.update_progress_bar(self.last_text)
|
|
296
|
+
|
|
293
297
|
elif message_type == 'fullSentence':
|
|
294
298
|
self.debug_print(f"Full sentence received: {data['text']}")
|
|
295
299
|
if self.file_output:
|
|
@@ -303,7 +307,11 @@ class STTWebSocketClient:
|
|
|
303
307
|
else:
|
|
304
308
|
self.finish_progress_bar()
|
|
305
309
|
print(f"{data['text']}")
|
|
306
|
-
|
|
310
|
+
|
|
311
|
+
if not self.continuous:
|
|
312
|
+
self.is_running = False
|
|
313
|
+
self.stop_event.set()
|
|
314
|
+
|
|
307
315
|
elif message_type in {
|
|
308
316
|
'vad_detect_start',
|
|
309
317
|
'vad_detect_stop',
|
|
@@ -364,11 +372,12 @@ class STTWebSocketClient:
|
|
|
364
372
|
self.data_ws_connected.close()
|
|
365
373
|
|
|
366
374
|
# Join threads to ensure they finish before exiting
|
|
367
|
-
|
|
375
|
+
current_thread = threading.current_thread()
|
|
376
|
+
if self.control_ws_thread and self.control_ws_thread != current_thread:
|
|
368
377
|
self.control_ws_thread.join()
|
|
369
|
-
if self.data_ws_thread:
|
|
378
|
+
if self.data_ws_thread and self.data_ws_thread != current_thread:
|
|
370
379
|
self.data_ws_thread.join()
|
|
371
|
-
if self.recording_thread:
|
|
380
|
+
if self.recording_thread and self.recording_thread != current_thread:
|
|
372
381
|
self.recording_thread.join()
|
|
373
382
|
|
|
374
383
|
# Clean up audio resources
|
|
@@ -399,7 +408,7 @@ class STTWebSocketClient:
|
|
|
399
408
|
self.debug_print("Starting audio recording and transmission")
|
|
400
409
|
self.show_initial_indicator()
|
|
401
410
|
|
|
402
|
-
while self.is_running:
|
|
411
|
+
while self.is_running and not self.stop_event.is_set():
|
|
403
412
|
try:
|
|
404
413
|
audio_data = self.stream.read(CHUNK)
|
|
405
414
|
self.chunks_sent += 1
|
|
@@ -418,8 +427,10 @@ class STTWebSocketClient:
|
|
|
418
427
|
metadata_length = len(metadata_json)
|
|
419
428
|
message = struct.pack('<I', metadata_length) + metadata_json.encode('utf-8') + audio_data
|
|
420
429
|
|
|
421
|
-
self.
|
|
422
|
-
|
|
430
|
+
if self.is_running and not self.stop_event.is_set():
|
|
431
|
+
self.debug_print(f"Sending audio chunk {self.chunks_sent}: {len(audio_data)} bytes, metadata: {metadata_json}")
|
|
432
|
+
self.data_ws_connected.send(message, opcode=websocket.ABNF.OPCODE_BINARY)
|
|
433
|
+
|
|
423
434
|
self.last_chunk_time = current_time
|
|
424
435
|
|
|
425
436
|
except Exception as e:
|
|
@@ -545,17 +556,26 @@ class STTWebSocketClient:
|
|
|
545
556
|
|
|
546
557
|
def main():
|
|
547
558
|
parser = argparse.ArgumentParser(description="STT Client")
|
|
548
|
-
|
|
549
|
-
parser.add_argument("
|
|
550
|
-
|
|
551
|
-
parser.add_argument("-
|
|
552
|
-
|
|
553
|
-
parser.add_argument("
|
|
554
|
-
help="
|
|
555
|
-
parser.add_argument("
|
|
556
|
-
help="
|
|
557
|
-
parser.add_argument("
|
|
558
|
-
help="
|
|
559
|
+
|
|
560
|
+
parser.add_argument("-c", "--control", "--control_url", default=DEFAULT_CONTROL_URL,
|
|
561
|
+
help="STT Control WebSocket URL")
|
|
562
|
+
parser.add_argument("-d", "--data", "--data_url", default=DEFAULT_DATA_URL,
|
|
563
|
+
help="STT Data WebSocket URL")
|
|
564
|
+
parser.add_argument("-D", "--debug", action="store_true",
|
|
565
|
+
help="Enable debug mode")
|
|
566
|
+
parser.add_argument("-n", "--norealtime", action="store_true",
|
|
567
|
+
help="Disable real-time output")
|
|
568
|
+
parser.add_argument("-W", "--write", metavar="FILE",
|
|
569
|
+
help="Save recorded audio to a WAV file")
|
|
570
|
+
parser.add_argument("-s", "--set", nargs=2, metavar=('PARAM', 'VALUE'), action='append',
|
|
571
|
+
help="Set a recorder parameter (can be used multiple times)")
|
|
572
|
+
parser.add_argument("-m", "--method", nargs='+', metavar='METHOD', action='append',
|
|
573
|
+
help="Call a recorder method with optional arguments")
|
|
574
|
+
parser.add_argument("-g", "--get", nargs=1, metavar='PARAM', action='append',
|
|
575
|
+
help="Get a recorder parameter's value (can be used multiple times)")
|
|
576
|
+
parser.add_argument("-l", "--loop", action="store_true",
|
|
577
|
+
help="Continuously transcribe speech without exiting")
|
|
578
|
+
|
|
559
579
|
args = parser.parse_args()
|
|
560
580
|
|
|
561
581
|
# Check if output is being redirected
|
|
@@ -564,7 +584,16 @@ def main():
|
|
|
564
584
|
else:
|
|
565
585
|
file_output = None
|
|
566
586
|
|
|
567
|
-
|
|
587
|
+
|
|
588
|
+
client = STTWebSocketClient(
|
|
589
|
+
args.control,
|
|
590
|
+
args.data,
|
|
591
|
+
args.debug,
|
|
592
|
+
file_output,
|
|
593
|
+
args.norealtime, # Adjusted logic for real-time output
|
|
594
|
+
args.write,
|
|
595
|
+
continuous=args.loop
|
|
596
|
+
)
|
|
568
597
|
|
|
569
598
|
def signal_handler(sig, frame):
|
|
570
599
|
client.stop()
|
|
@@ -576,8 +605,8 @@ def main():
|
|
|
576
605
|
try:
|
|
577
606
|
if client.connect():
|
|
578
607
|
# Process command-line parameters
|
|
579
|
-
if args.
|
|
580
|
-
for param, value in args.
|
|
608
|
+
if args.set:
|
|
609
|
+
for param, value in args.set:
|
|
581
610
|
try:
|
|
582
611
|
if '.' in value:
|
|
583
612
|
value = float(value)
|
|
@@ -592,16 +621,16 @@ def main():
|
|
|
592
621
|
'value': value
|
|
593
622
|
})
|
|
594
623
|
|
|
595
|
-
if args.
|
|
596
|
-
for param_list in args.
|
|
624
|
+
if args.get:
|
|
625
|
+
for param_list in args.get:
|
|
597
626
|
param = param_list[0]
|
|
598
627
|
client.add_command({
|
|
599
628
|
'type': 'get_parameter',
|
|
600
629
|
'parameter': param
|
|
601
630
|
})
|
|
602
631
|
|
|
603
|
-
if args.
|
|
604
|
-
for method_call in args.
|
|
632
|
+
if args.method:
|
|
633
|
+
for method_call in args.method:
|
|
605
634
|
method = method_call[0]
|
|
606
635
|
args_list = method_call[1:] if len(method_call) > 1 else []
|
|
607
636
|
client.add_command({
|
|
@@ -611,7 +640,7 @@ def main():
|
|
|
611
640
|
})
|
|
612
641
|
|
|
613
642
|
# If command-line parameters were used (like --get-param), wait for them to be processed
|
|
614
|
-
if args.
|
|
643
|
+
if args.set or args.get or args.method:
|
|
615
644
|
while not client.commands.empty():
|
|
616
645
|
time.sleep(0.1)
|
|
617
646
|
|
|
@@ -628,4 +657,3 @@ def main():
|
|
|
628
657
|
|
|
629
658
|
if __name__ == "__main__":
|
|
630
659
|
main()
|
|
631
|
-
|
|
@@ -17,45 +17,40 @@ stt-server [OPTIONS]
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
### Available Parameters:
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
- `--
|
|
31
|
-
|
|
32
|
-
- `--min_length_of_recording
|
|
33
|
-
|
|
34
|
-
- `--
|
|
35
|
-
|
|
36
|
-
- `--
|
|
37
|
-
|
|
38
|
-
- `--
|
|
39
|
-
|
|
40
|
-
- `--
|
|
41
|
-
|
|
42
|
-
- `--
|
|
43
|
-
|
|
44
|
-
- `--
|
|
45
|
-
|
|
46
|
-
- `--
|
|
47
|
-
|
|
48
|
-
- `--
|
|
49
|
-
|
|
50
|
-
- `--
|
|
51
|
-
|
|
52
|
-
- `--
|
|
53
|
-
|
|
54
|
-
- `--mid_sentence_detection_pause` (float, default: 2.0): Duration of pause (in seconds) to consider as a mid-sentence break.
|
|
55
|
-
|
|
56
|
-
- `--control_port` (int, default: 8011): Port for the control WebSocket connection.
|
|
57
|
-
|
|
58
|
-
- `--data_port` (int, default: 8012): Port for the data WebSocket connection.
|
|
20
|
+
- `-m, --model`: Model path or size; default 'large-v2'.
|
|
21
|
+
- `-r, --rt-model, --realtime_model_type`: Real-time model size; default 'tiny.en'.
|
|
22
|
+
- `-l, --lang, --language`: Language code for transcription; default 'en'.
|
|
23
|
+
- `-i, --input-device, --input_device_index`: Audio input device index; default 1.
|
|
24
|
+
- `-c, --control, --control_port`: WebSocket control port; default 8011.
|
|
25
|
+
- `-d, --data, --data_port`: WebSocket data port; default 8012.
|
|
26
|
+
- `-w, --wake_words`: Wake word(s) to trigger listening; default "".
|
|
27
|
+
- `-D, --debug`: Enable debug logging.
|
|
28
|
+
- `-W, --write`: Save audio to WAV file.
|
|
29
|
+
- `--silero_sensitivity`: Silero VAD sensitivity (0-1); default 0.05.
|
|
30
|
+
- `--silero_use_onnx`: Use Silero ONNX model; default False.
|
|
31
|
+
- `--webrtc_sensitivity`: WebRTC VAD sensitivity (0-3); default 3.
|
|
32
|
+
- `--min_length_of_recording`: Minimum recording duration in seconds; default 1.1.
|
|
33
|
+
- `--min_gap_between_recordings`: Min time between recordings in seconds; default 0.
|
|
34
|
+
- `--enable_realtime_transcription`: Enable real-time transcription; default True.
|
|
35
|
+
- `--realtime_processing_pause`: Pause between audio chunk processing; default 0.02.
|
|
36
|
+
- `--silero_deactivity_detection`: Use Silero for end-of-speech detection; default True.
|
|
37
|
+
- `--early_transcription_on_silence`: Start transcription after silence in seconds; default 0.2.
|
|
38
|
+
- `--beam_size`: Beam size for main model; default 5.
|
|
39
|
+
- `--beam_size_realtime`: Beam size for real-time model; default 3.
|
|
40
|
+
- `--initial_prompt`: Initial transcription guidance prompt.
|
|
41
|
+
- `--end_of_sentence_detection_pause`: Silence duration for sentence end detection; default 0.45.
|
|
42
|
+
- `--unknown_sentence_detection_pause`: Pause duration for incomplete sentence detection; default 0.7.
|
|
43
|
+
- `--mid_sentence_detection_pause`: Pause for mid-sentence break; default 2.0.
|
|
44
|
+
- `--wake_words_sensitivity`: Wake word detection sensitivity (0-1); default 0.5.
|
|
45
|
+
- `--wake_word_timeout`: Wake word timeout in seconds; default 5.0.
|
|
46
|
+
- `--wake_word_activation_delay`: Delay before wake word activation; default 20.
|
|
47
|
+
- `--wakeword_backend`: Backend for wake word detection; default 'none'.
|
|
48
|
+
- `--openwakeword_model_paths`: Paths to OpenWakeWord models.
|
|
49
|
+
- `--openwakeword_inference_framework`: OpenWakeWord inference framework; default 'tensorflow'.
|
|
50
|
+
- `--wake_word_buffer_duration`: Wake word buffer duration in seconds; default 1.0.
|
|
51
|
+
- `--use_main_model_for_realtime`: Use main model for real-time transcription.
|
|
52
|
+
- `--use_extended_logging`: Enable extensive log messages.
|
|
53
|
+
- `--logchunks`: Log incoming audio chunks.
|
|
59
54
|
|
|
60
55
|
### WebSocket Interface:
|
|
61
56
|
The server supports two WebSocket connections:
|
|
@@ -306,17 +301,31 @@ def parse_arguments():
|
|
|
306
301
|
import argparse
|
|
307
302
|
parser = argparse.ArgumentParser(description='Start the Speech-to-Text (STT) server with various configuration options.')
|
|
308
303
|
|
|
309
|
-
parser.add_argument('--model', type=str, default='large-v2',
|
|
304
|
+
parser.add_argument('-m', '--model', type=str, default='large-v2',
|
|
310
305
|
help='Path to the STT model or model size. Options include: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large-v1, large-v2, or any huggingface CTranslate2 STT model such as deepdml/faster-whisper-large-v3-turbo-ct2. Default is large-v2.')
|
|
311
306
|
|
|
312
|
-
parser.add_argument('--realtime_model_type', type=str, default='tiny.en',
|
|
313
|
-
help='Model size for real-time transcription.
|
|
307
|
+
parser.add_argument('-r', '--rt-model', '--realtime_model_type', type=str, default='tiny.en',
|
|
308
|
+
help='Model size for real-time transcription. Options same as --model. This is used only if real-time transcription is enabled (enable_realtime_transcription). Default is tiny.en.')
|
|
309
|
+
|
|
310
|
+
parser.add_argument('-l', '--lang', '--language', type=str, default='en',
|
|
311
|
+
help='Language code for the STT model to transcribe in a specific language. Leave this empty for auto-detection based on input audio. Default is en. List of supported language codes: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py#L11-L110')
|
|
312
|
+
|
|
313
|
+
parser.add_argument('-i', '--input-device', '--input_device_index', type=int, default=1,
|
|
314
|
+
help='Index of the audio input device to use. Use this option to specify a particular microphone or audio input device based on your system. Default is 1.')
|
|
315
|
+
|
|
316
|
+
parser.add_argument('-c', '--control', '--control_port', type=int, default=8011,
|
|
317
|
+
help='The port number used for the control WebSocket connection. Control connections are used to send and receive commands to the server. Default is port 8011.')
|
|
318
|
+
|
|
319
|
+
parser.add_argument('-d', '--data', '--data_port', type=int, default=8012,
|
|
320
|
+
help='The port number used for the data WebSocket connection. Data connections are used to send audio data and receive transcription updates in real time. Default is port 8012.')
|
|
321
|
+
|
|
322
|
+
parser.add_argument('-w', '--wake_words', type=str, default="",
|
|
323
|
+
help='Specify the wake word(s) that will trigger the server to start listening. For example, setting this to "Jarvis" will make the system start transcribing when it detects the wake word "Jarvis". Default is "Jarvis".')
|
|
314
324
|
|
|
315
|
-
parser.add_argument('--
|
|
316
|
-
help='Language code for the STT model to transcribe in a specific language. Leave this empty for auto-detection based on input audio. Default is en.')
|
|
325
|
+
parser.add_argument('-D', '--debug', action='store_true', help='Enable debug logging for detailed server operations')
|
|
317
326
|
|
|
318
|
-
parser.add_argument(
|
|
319
|
-
help=
|
|
327
|
+
parser.add_argument("-W", "--write", metavar="FILE",
|
|
328
|
+
help="Save received audio to a WAV file")
|
|
320
329
|
|
|
321
330
|
parser.add_argument('--silero_sensitivity', type=float, default=0.05,
|
|
322
331
|
help='Sensitivity level for Silero Voice Activity Detection (VAD), with a range from 0 to 1. Lower values make the model less sensitive, useful for noisy environments. Default is 0.05.')
|
|
@@ -364,15 +373,6 @@ def parse_arguments():
|
|
|
364
373
|
parser.add_argument('--mid_sentence_detection_pause', type=float, default=2.0,
|
|
365
374
|
help='The duration of pause (in seconds) that the model should interpret as a mid-sentence break. Longer pauses can indicate a pause in speech but not necessarily the end of a sentence. Default is 2.0 seconds.')
|
|
366
375
|
|
|
367
|
-
parser.add_argument('--control_port', type=int, default=8011,
|
|
368
|
-
help='The port number used for the control WebSocket connection. Control connections are used to send and receive commands to the server. Default is port 8011.')
|
|
369
|
-
|
|
370
|
-
parser.add_argument('--data_port', type=int, default=8012,
|
|
371
|
-
help='The port number used for the data WebSocket connection. Data connections are used to send audio data and receive transcription updates in real time. Default is port 8012.')
|
|
372
|
-
|
|
373
|
-
parser.add_argument('--wake_words', type=str, default="",
|
|
374
|
-
help='Specify the wake word(s) that will trigger the server to start listening. For example, setting this to "Jarvis" will make the system start transcribing when it detects the wake word "Jarvis". Default is "Jarvis".')
|
|
375
|
-
|
|
376
376
|
parser.add_argument('--wake_words_sensitivity', type=float, default=0.5,
|
|
377
377
|
help='Sensitivity level for wake word detection, with a range from 0 (most sensitive) to 1 (least sensitive). Adjust this value based on your environment to ensure reliable wake word detection. Default is 0.5.')
|
|
378
378
|
|
|
@@ -400,18 +400,14 @@ def parse_arguments():
|
|
|
400
400
|
parser.add_argument('--use_extended_logging', action='store_true',
|
|
401
401
|
help='Writes extensive log messages for the recording worker, that processes the audio chunks.')
|
|
402
402
|
|
|
403
|
-
parser.add_argument('--debug', action='store_true', help='Enable debug logging for detailed server operations')
|
|
404
|
-
|
|
405
403
|
parser.add_argument('--logchunks', action='store_true', help='Enable logging of incoming audio chunks (periods)')
|
|
406
404
|
|
|
407
|
-
parser.add_argument("--writechunks", metavar="FILE", help="Save received audio chunks to a WAV file")
|
|
408
|
-
|
|
409
405
|
# Parse arguments
|
|
410
406
|
args = parser.parse_args()
|
|
411
407
|
|
|
412
408
|
debug_logging = args.debug
|
|
413
409
|
extended_logging = args.use_extended_logging
|
|
414
|
-
writechunks = args.
|
|
410
|
+
writechunks = args.write
|
|
415
411
|
log_incoming_chunks = args.logchunks
|
|
416
412
|
|
|
417
413
|
if debug_logging:
|
|
@@ -644,9 +640,9 @@ async def main_async():
|
|
|
644
640
|
|
|
645
641
|
recorder_config = {
|
|
646
642
|
'model': args.model,
|
|
647
|
-
'realtime_model_type': args.
|
|
648
|
-
'language': args.
|
|
649
|
-
'input_device_index': args.
|
|
643
|
+
'realtime_model_type': args.rt_model,
|
|
644
|
+
'language': args.lang,
|
|
645
|
+
'input_device_index': args.input_device,
|
|
650
646
|
'silero_sensitivity': args.silero_sensitivity,
|
|
651
647
|
'silero_use_onnx': args.silero_use_onnx,
|
|
652
648
|
'webrtc_sensitivity': args.webrtc_sensitivity,
|
|
@@ -688,10 +684,10 @@ async def main_async():
|
|
|
688
684
|
|
|
689
685
|
try:
|
|
690
686
|
# Attempt to start control and data servers
|
|
691
|
-
control_server = await websockets.serve(control_handler, "localhost", args.
|
|
692
|
-
data_server = await websockets.serve(data_handler, "localhost", args.
|
|
693
|
-
print(f"{bcolors.OKGREEN}Control server started on {bcolors.OKBLUE}ws://localhost:{args.
|
|
694
|
-
print(f"{bcolors.OKGREEN}Data server started on {bcolors.OKBLUE}ws://localhost:{args.
|
|
687
|
+
control_server = await websockets.serve(control_handler, "localhost", args.control)
|
|
688
|
+
data_server = await websockets.serve(data_handler, "localhost", args.data)
|
|
689
|
+
print(f"{bcolors.OKGREEN}Control server started on {bcolors.OKBLUE}ws://localhost:{args.control}{bcolors.ENDC}")
|
|
690
|
+
print(f"{bcolors.OKGREEN}Data server started on {bcolors.OKBLUE}ws://localhost:{args.data}{bcolors.ENDC}")
|
|
695
691
|
|
|
696
692
|
# Start the broadcast and recorder threads
|
|
697
693
|
broadcast_task = asyncio.create_task(broadcast_audio_messages())
|
|
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
|