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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.3.6
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.6
58
+ Latest Version: v0.3.7
59
59
 
60
60
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
61
61
 
@@ -28,7 +28,7 @@ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
28
28
 
29
29
  ### Updates
30
30
 
31
- Latest Version: v0.3.6
31
+ Latest Version: v0.3.7
32
32
 
33
33
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
34
34
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.3.6
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.6
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-url CONTROL_URL STT Control WebSocket URL
11
- --data-url DATA_URL STT Data WebSocket URL
12
- --debug Enable debug mode
13
- --norealtime Disable real-time output
14
- --set-param PARAM VALUE Set a recorder parameter. Can be used multiple times.
15
- --call-method METHOD [ARGS ...] Call a recorder method with optional arguments.
16
- --get-param PARAM Get the value of a recorder parameter. Can be used multiple times.
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 # WebSocket object that will be used for sending
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 # Add this to store the file name for writing audio chunks
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.debug_print(f"WebSocket connection closed")
165
- self.debug_print(f"Close status code: {close_status_code}")
166
- self.debug_print(f"Close message: {close_msg}")
167
- self.debug_print(f"WebSocket object: {ws}")
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
- self.stop()
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
- if self.control_ws_thread:
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.debug_print(f"Sending audio chunk {self.chunks_sent}: {len(audio_data)} bytes, metadata: {metadata_json}")
422
- self.data_ws_connected.send(message, opcode=websocket.ABNF.OPCODE_BINARY)
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
- parser.add_argument("--control-url", default=DEFAULT_CONTROL_URL, help="STT Control WebSocket URL")
549
- parser.add_argument("--data-url", default=DEFAULT_DATA_URL, help="STT Data WebSocket URL")
550
- parser.add_argument("--debug", action="store_true", help="Enable debug mode")
551
- parser.add_argument("-nort", "--norealtime", action="store_true", help="Disable real-time output")
552
- parser.add_argument("--writechunks", metavar="FILE", help="Save recorded audio chunks to a WAV file")
553
- parser.add_argument("--set-param", nargs=2, metavar=('PARAM', 'VALUE'), action='append',
554
- help="Set a recorder parameter. Can be used multiple times.")
555
- parser.add_argument("--call-method", nargs='+', metavar='METHOD', action='append',
556
- help="Call a recorder method with optional arguments.")
557
- parser.add_argument("--get-param", nargs=1, metavar='PARAM', action='append',
558
- help="Get the value of a recorder parameter. Can be used multiple times.")
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
- client = STTWebSocketClient(args.control_url, args.data_url, args.debug, file_output, args.norealtime, args.writechunks)
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.set_param:
580
- for param, value in args.set_param:
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.get_param:
596
- for param_list in args.get_param:
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.call_method:
604
- for method_call in args.call_method:
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.set_param or args.get_param or args.call_method:
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
- - `--model` (str, default: 'medium.en'): Path to the STT model or model size. Options: tiny, tiny.en, base, base.en, small, small.en, medium, medium.en, large-v1, large-v2, or any huggingface CTranslate2 STT model like `deepdml/faster-whisper-large-v3-turbo-ct2`.
21
-
22
- - `--realtime_model_type` (str, default: 'tiny.en'): Model size for real-time transcription. Same options as `--model`.
23
-
24
- - `--language` (str, default: 'en'): Language code for the STT model. Leave empty for auto-detection.
25
-
26
- - `--input_device_index` (int, default: 1): Index of the audio input device to use.
27
-
28
- - `--silero_sensitivity` (float, default: 0.05): Sensitivity for Silero Voice Activity Detection (VAD). Lower values are less sensitive.
29
-
30
- - `--webrtc_sensitivity` (int, default: 3): Sensitivity for WebRTC VAD. Higher values are less sensitive.
31
-
32
- - `--min_length_of_recording` (float, default: 1.1): Minimum duration (in seconds) for a valid recording. Prevents short recordings.
33
-
34
- - `--min_gap_between_recordings` (float, default: 0): Minimum time (in seconds) between consecutive recordings.
35
-
36
- - `--enable_realtime_transcription` (flag, default: True): Enable real-time transcription of audio.
37
-
38
- - `--realtime_processing_pause` (float, default: 0.02): Time interval (in seconds) between processing audio chunks for real-time transcription. Lower values increase responsiveness.
39
-
40
- - `--silero_deactivity_detection` (flag, default: True): Use Silero model for end-of-speech detection.
41
-
42
- - `--early_transcription_on_silence` (float, default: 0.2): Start transcription after specified seconds of silence.
43
-
44
- - `--beam_size` (int, default: 5): Beam size for the main transcription model.
45
-
46
- - `--beam_size_realtime` (int, default: 3): Beam size for the real-time transcription model.
47
-
48
- - `--initial_prompt` (str, default: '...'): Initial prompt for the transcription model to guide its output format and style.
49
-
50
- - `--end_of_sentence_detection_pause` (float, default: 0.45): Duration of pause (in seconds) to consider as the end of a sentence.
51
-
52
- - `--unknown_sentence_detection_pause` (float, default: 0.7): Duration of pause (in seconds) to consider as an unknown or incomplete sentence.
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. The options are the same as --model. This is used only if real-time transcription is enabled. Default is tiny.en.')
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('--language', type=str, default='en',
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('--input_device_index', type=int, default=1,
319
- 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.')
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.writechunks
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.realtime_model_type,
648
- 'language': args.language,
649
- 'input_device_index': args.input_device_index,
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.control_port)
692
- data_server = await websockets.serve(data_handler, "localhost", args.data_port)
693
- print(f"{bcolors.OKGREEN}Control server started on {bcolors.OKBLUE}ws://localhost:{args.control_port}{bcolors.ENDC}")
694
- print(f"{bcolors.OKGREEN}Data server started on {bcolors.OKBLUE}ws://localhost:{args.data_port}{bcolors.ENDC}")
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())
@@ -9,7 +9,7 @@ with open('requirements.txt') as f:
9
9
 
10
10
  setuptools.setup(
11
11
  name="RealtimeSTT",
12
- version="0.3.6",
12
+ version="0.3.7",
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