RealTimeSTT 0.3.94__tar.gz → 0.3.96__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.
Files changed (20) hide show
  1. {realtimestt-0.3.94 → realtimestt-0.3.96}/PKG-INFO +7 -5
  2. {realtimestt-0.3.94 → realtimestt-0.3.96}/README.md +5 -4
  3. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT/audio_input.py +1 -1
  4. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT/audio_recorder.py +36 -14
  5. realtimestt-0.3.96/RealtimeSTT/warmup_audio.wav +0 -0
  6. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/PKG-INFO +7 -5
  7. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/SOURCES.txt +1 -0
  8. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/requires.txt +1 -0
  9. {realtimestt-0.3.94 → realtimestt-0.3.96}/setup.py +3 -1
  10. {realtimestt-0.3.94 → realtimestt-0.3.96}/LICENSE +0 -0
  11. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT/__init__.py +0 -0
  12. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT/audio_recorder_client.py +0 -0
  13. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/dependency_links.txt +0 -0
  14. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/entry_points.txt +0 -0
  15. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT.egg-info/top_level.txt +0 -0
  16. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT_server/__init__.py +0 -0
  17. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT_server/install_packages.py +0 -0
  18. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT_server/stt_cli_client.py +0 -0
  19. {realtimestt-0.3.94 → realtimestt-0.3.96}/RealtimeSTT_server/stt_server.py +0 -0
  20. {realtimestt-0.3.94 → realtimestt-0.3.96}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.3.94
3
+ Version: 0.3.96
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
@@ -24,10 +24,11 @@ Requires-Dist: openwakeword>=0.4.0
24
24
  Requires-Dist: websockets==14.2
25
25
  Requires-Dist: websocket-client==1.8.0
26
26
  Requires-Dist: numpy<2.0.0
27
+ Requires-Dist: soundfile==0.13.1
27
28
 
28
29
  # RealtimeSTT
29
30
  [![PyPI](https://img.shields.io/pypi/v/RealtimeSTT)](https://pypi.org/project/RealtimeSTT/)
30
- [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://pepy.tech/project/KoljaB/RealtimeSTT)
31
+ [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://www.pepy.tech/projects/realtimestt)
31
32
  [![GitHub release](https://img.shields.io/github/release/KoljaB/RealtimeSTT.svg)](https://GitHub.com/KoljaB/RealtimeSTT/releases/)
32
33
  [![GitHub commits](https://badgen.net/github/commits/KoljaB/RealtimeSTT)](https://GitHub.com/Naereen/KoljaB/RealtimeSTT/commit/)
33
34
  [![GitHub forks](https://img.shields.io/github/forks/KoljaB/RealtimeSTT.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/KoljaB/RealtimeSTT/network/)
@@ -51,11 +52,13 @@ It's ideal for:
51
52
  - **Voice Assistants**
52
53
  - Applications requiring **fast and precise** speech-to-text conversion
53
54
 
54
- https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
55
+ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
56
+
57
+ [CLI demo code (reproduces the video above)](tests/realtimestt_test.py)
55
58
 
56
59
  ### Updates
57
60
 
58
- Latest Version: v0.3.92
61
+ Latest Version: v0.3.96
59
62
 
60
63
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
61
64
 
@@ -67,7 +70,6 @@ See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
67
70
 
68
71
  ```python
69
72
  from RealtimeSTT import AudioToTextRecorder
70
- import pyautogui
71
73
 
72
74
  def process_text(text):
73
75
  print(text)
@@ -1,6 +1,6 @@
1
1
  # RealtimeSTT
2
2
  [![PyPI](https://img.shields.io/pypi/v/RealtimeSTT)](https://pypi.org/project/RealtimeSTT/)
3
- [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://pepy.tech/project/KoljaB/RealtimeSTT)
3
+ [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://www.pepy.tech/projects/realtimestt)
4
4
  [![GitHub release](https://img.shields.io/github/release/KoljaB/RealtimeSTT.svg)](https://GitHub.com/KoljaB/RealtimeSTT/releases/)
5
5
  [![GitHub commits](https://badgen.net/github/commits/KoljaB/RealtimeSTT)](https://GitHub.com/Naereen/KoljaB/RealtimeSTT/commit/)
6
6
  [![GitHub forks](https://img.shields.io/github/forks/KoljaB/RealtimeSTT.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/KoljaB/RealtimeSTT/network/)
@@ -24,11 +24,13 @@ It's ideal for:
24
24
  - **Voice Assistants**
25
25
  - Applications requiring **fast and precise** speech-to-text conversion
26
26
 
27
- https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
27
+ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
28
+
29
+ [CLI demo code (reproduces the video above)](tests/realtimestt_test.py)
28
30
 
29
31
  ### Updates
30
32
 
31
- Latest Version: v0.3.92
33
+ Latest Version: v0.3.96
32
34
 
33
35
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
34
36
 
@@ -40,7 +42,6 @@ See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
40
42
 
41
43
  ```python
42
44
  from RealtimeSTT import AudioToTextRecorder
43
- import pyautogui
44
45
 
45
46
  def process_text(text):
46
47
  print(text)
@@ -204,7 +204,7 @@ class AudioInput:
204
204
 
205
205
  def read_chunk(self):
206
206
  """Read a chunk of audio data"""
207
- return self.stream.read(self.CHUNK, exception_on_overflow=False)
207
+ return self.stream.read(self.chunk_size, exception_on_overflow=False)
208
208
 
209
209
  def cleanup(self):
210
210
  """Clean up audio resources"""
@@ -26,15 +26,15 @@ Author: Kolja Beigel
26
26
 
27
27
  """
28
28
 
29
+ from faster_whisper import WhisperModel, BatchedInferencePipeline
29
30
  from typing import Iterable, List, Optional, Union
30
- import torch.multiprocessing as mp
31
- import torch
32
- from ctypes import c_bool
33
31
  from openwakeword.model import Model
32
+ import torch.multiprocessing as mp
34
33
  from scipy.signal import resample
35
- from scipy import signal
36
34
  import signal as system_signal
37
- from faster_whisper import WhisperModel, BatchedInferencePipeline
35
+ from ctypes import c_bool
36
+ from scipy import signal
37
+ import soundfile as sf
38
38
  import faster_whisper
39
39
  import openwakeword
40
40
  import collections
@@ -43,14 +43,13 @@ import pvporcupine
43
43
  import traceback
44
44
  import threading
45
45
  import webrtcvad
46
- import itertools
47
46
  import datetime
48
47
  import platform
49
- import pyaudio
50
48
  import logging
51
49
  import struct
52
50
  import base64
53
51
  import queue
52
+ import torch
54
53
  import halo
55
54
  import time
56
55
  import copy
@@ -144,8 +143,13 @@ class TranscriptionWorker:
144
143
  model = BatchedInferencePipeline(model=model)
145
144
 
146
145
  # Run a warm-up transcription
147
- dummy_audio = np.zeros(16000, dtype=np.float32)
148
- model.transcribe(dummy_audio, language="en", beam_size=1)
146
+ current_dir = os.path.dirname(os.path.realpath(__file__))
147
+ warmup_audio_path = os.path.join(
148
+ current_dir, "warmup_audio.wav"
149
+ )
150
+ warmup_audio_data, _ = sf.read(warmup_audio_path, dtype="float32")
151
+ segments, info = model.transcribe(warmup_audio_data, language="en", beam_size=1)
152
+ model_warmup_transcription = " ".join(segment.text for segment in segments)
149
153
  except Exception as e:
150
154
  logging.exception(f"Error initializing main faster_whisper transcription model: {e}")
151
155
  raise
@@ -728,8 +732,15 @@ class AudioToTextRecorder:
728
732
  )
729
733
  if self.realtime_batch_size > 0:
730
734
  self.realtime_model_type = BatchedInferencePipeline(model=self.realtime_model_type)
731
- dummy_audio = np.zeros(16000, dtype=np.float32)
732
- self.realtime_model_type.transcribe(dummy_audio, language="en", beam_size=1)
735
+
736
+ # Run a warm-up transcription
737
+ current_dir = os.path.dirname(os.path.realpath(__file__))
738
+ warmup_audio_path = os.path.join(
739
+ current_dir, "warmup_audio.wav"
740
+ )
741
+ warmup_audio_data, _ = sf.read(warmup_audio_path, dtype="float32")
742
+ segments, info = self.realtime_model_type.transcribe(warmup_audio_data, language="en", beam_size=1)
743
+ model_warmup_transcription = " ".join(segment.text for segment in segments)
733
744
  except Exception as e:
734
745
  logging.exception("Error initializing faster_whisper "
735
746
  f"realtime transcription model: {e}"
@@ -1265,12 +1276,17 @@ class AudioToTextRecorder:
1265
1276
  self.listen_start = time.time()
1266
1277
 
1267
1278
  def abort(self):
1279
+ state = self.state
1268
1280
  self.start_recording_on_voice_activity = False
1269
1281
  self.stop_recording_on_voice_deactivity = False
1270
- self._set_state("inactive")
1271
1282
  self.interrupt_stop_event.set()
1272
- self.was_interrupted.wait()
1283
+ if self.state != "inactive": # if inactive, was_interrupted will never be set
1284
+ self.was_interrupted.wait()
1285
+ self._set_state("transcribing")
1273
1286
  self.was_interrupted.clear()
1287
+ if self.is_recording: # if recording, make sure to stop the recorder
1288
+ self.stop()
1289
+
1274
1290
 
1275
1291
  def wait_audio(self):
1276
1292
  """
@@ -1416,6 +1432,12 @@ class AudioToTextRecorder:
1416
1432
 
1417
1433
  while self.transcribe_count > 0:
1418
1434
  logging.debug(F"Receive from parent_transcription_pipe after sendiung transcription request, transcribe_count: {self.transcribe_count}")
1435
+ if not self.parent_transcription_pipe.poll(0.1): # check if transcription done
1436
+ if self.interrupt_stop_event.is_set(): # check if interrupted
1437
+ self.was_interrupted.set()
1438
+ self._set_state("inactive")
1439
+ return "" # return empty string if interrupted
1440
+ continue
1419
1441
  status, result = self.parent_transcription_pipe.recv()
1420
1442
  self.transcribe_count -= 1
1421
1443
 
@@ -1436,7 +1458,7 @@ class AudioToTextRecorder:
1436
1458
  print(f"Model {self.main_model_type} completed transcription in {transcription_time:.2f} seconds")
1437
1459
  else:
1438
1460
  logging.debug(f"Model {self.main_model_type} completed transcription in {transcription_time:.2f} seconds")
1439
- return transcription
1461
+ return "" if self.interrupt_stop_event.is_set() else transcription # if interrupted return empty string
1440
1462
  else:
1441
1463
  logging.error(f"Transcription error: {result}")
1442
1464
  raise Exception(result)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: RealtimeSTT
3
- Version: 0.3.94
3
+ Version: 0.3.96
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
@@ -24,10 +24,11 @@ Requires-Dist: openwakeword>=0.4.0
24
24
  Requires-Dist: websockets==14.2
25
25
  Requires-Dist: websocket-client==1.8.0
26
26
  Requires-Dist: numpy<2.0.0
27
+ Requires-Dist: soundfile==0.13.1
27
28
 
28
29
  # RealtimeSTT
29
30
  [![PyPI](https://img.shields.io/pypi/v/RealtimeSTT)](https://pypi.org/project/RealtimeSTT/)
30
- [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://pepy.tech/project/KoljaB/RealtimeSTT)
31
+ [![Downloads](https://static.pepy.tech/badge/RealtimeSTT)](https://www.pepy.tech/projects/realtimestt)
31
32
  [![GitHub release](https://img.shields.io/github/release/KoljaB/RealtimeSTT.svg)](https://GitHub.com/KoljaB/RealtimeSTT/releases/)
32
33
  [![GitHub commits](https://badgen.net/github/commits/KoljaB/RealtimeSTT)](https://GitHub.com/Naereen/KoljaB/RealtimeSTT/commit/)
33
34
  [![GitHub forks](https://img.shields.io/github/forks/KoljaB/RealtimeSTT.svg?style=social&label=Fork&maxAge=2592000)](https://GitHub.com/KoljaB/RealtimeSTT/network/)
@@ -51,11 +52,13 @@ It's ideal for:
51
52
  - **Voice Assistants**
52
53
  - Applications requiring **fast and precise** speech-to-text conversion
53
54
 
54
- https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
55
+ https://github.com/user-attachments/assets/797e6552-27cd-41b1-a7f3-e5cbc72094f5
56
+
57
+ [CLI demo code (reproduces the video above)](tests/realtimestt_test.py)
55
58
 
56
59
  ### Updates
57
60
 
58
- Latest Version: v0.3.92
61
+ Latest Version: v0.3.96
59
62
 
60
63
  See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
61
64
 
@@ -67,7 +70,6 @@ See [release history](https://github.com/KoljaB/RealtimeSTT/releases).
67
70
 
68
71
  ```python
69
72
  from RealtimeSTT import AudioToTextRecorder
70
- import pyautogui
71
73
 
72
74
  def process_text(text):
73
75
  print(text)
@@ -5,6 +5,7 @@ RealtimeSTT/__init__.py
5
5
  RealtimeSTT/audio_input.py
6
6
  RealtimeSTT/audio_recorder.py
7
7
  RealtimeSTT/audio_recorder_client.py
8
+ RealtimeSTT/warmup_audio.wav
8
9
  RealtimeSTT.egg-info/PKG-INFO
9
10
  RealtimeSTT.egg-info/SOURCES.txt
10
11
  RealtimeSTT.egg-info/dependency_links.txt
@@ -10,3 +10,4 @@ openwakeword>=0.4.0
10
10
  websockets==14.2
11
11
  websocket-client==1.8.0
12
12
  numpy<2.0.0
13
+ soundfile==0.13.1
@@ -9,7 +9,7 @@ with open('requirements.txt') as f:
9
9
 
10
10
  setuptools.setup(
11
11
  name="RealtimeSTT",
12
- version="0.3.94",
12
+ version="0.3.96",
13
13
  author="Kolja Beigel",
14
14
  author_email="kolja.beigel@web.de",
15
15
  description="A fast Voice Activity Detection and Transcription System",
@@ -25,6 +25,8 @@ setuptools.setup(
25
25
  python_requires='>=3.6',
26
26
  install_requires=requirements,
27
27
  keywords="real-time, audio, transcription, speech-to-text, voice-activity-detection, VAD, real-time-transcription, ambient-noise-detection, microphone-input, faster_whisper, speech-recognition, voice-assistants, audio-processing, buffered-transcription, pyaudio, ambient-noise-level, voice-deactivity",
28
+ package_data={"RealtimeSTT": ["warmup_audio.wav"]},
29
+ include_package_data=True,
28
30
  entry_points={
29
31
  'console_scripts': [
30
32
  'stt-server=RealtimeSTT_server.stt_server:main',
File without changes
File without changes