RealTimeSTT 0.3.103__tar.gz → 1.0.0__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 (50) hide show
  1. realtimestt-1.0.0/MANIFEST.in +13 -0
  2. realtimestt-1.0.0/PKG-INFO +241 -0
  3. realtimestt-1.0.0/README.md +165 -0
  4. realtimestt-1.0.0/RealtimeSTT/__init__.py +36 -0
  5. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT/audio_recorder.py +1615 -600
  6. realtimestt-1.0.0/RealtimeSTT/realtime_boundary_detector.py +491 -0
  7. realtimestt-1.0.0/RealtimeSTT/realtime_text_stabilizer.py +891 -0
  8. realtimestt-1.0.0/RealtimeSTT/transcription_engines/__init__.py +20 -0
  9. realtimestt-1.0.0/RealtimeSTT/transcription_engines/_model_utils.py +82 -0
  10. realtimestt-1.0.0/RealtimeSTT/transcription_engines/base.py +70 -0
  11. realtimestt-1.0.0/RealtimeSTT/transcription_engines/cohere_transcribe_engine.py +24 -0
  12. realtimestt-1.0.0/RealtimeSTT/transcription_engines/factory.py +51 -0
  13. realtimestt-1.0.0/RealtimeSTT/transcription_engines/faster_whisper_engine.py +62 -0
  14. realtimestt-1.0.0/RealtimeSTT/transcription_engines/granite_speech_engine.py +24 -0
  15. realtimestt-1.0.0/RealtimeSTT/transcription_engines/hf_transformers_engines.py +380 -0
  16. realtimestt-1.0.0/RealtimeSTT/transcription_engines/kroko_onnx_engine.py +296 -0
  17. realtimestt-1.0.0/RealtimeSTT/transcription_engines/moonshine_engine.py +30 -0
  18. realtimestt-1.0.0/RealtimeSTT/transcription_engines/openai_api_engine.py +15 -0
  19. realtimestt-1.0.0/RealtimeSTT/transcription_engines/openai_whisper_engine.py +93 -0
  20. realtimestt-1.0.0/RealtimeSTT/transcription_engines/parakeet_engine.py +117 -0
  21. realtimestt-1.0.0/RealtimeSTT/transcription_engines/qwen3_asr_engine.py +128 -0
  22. realtimestt-1.0.0/RealtimeSTT/transcription_engines/sherpa_onnx_engine.py +302 -0
  23. realtimestt-1.0.0/RealtimeSTT/transcription_engines/whisper_cpp_engine.py +86 -0
  24. realtimestt-1.0.0/realtimestt.egg-info/PKG-INFO +241 -0
  25. realtimestt-1.0.0/realtimestt.egg-info/SOURCES.txt +39 -0
  26. realtimestt-1.0.0/realtimestt.egg-info/requires.txt +96 -0
  27. realtimestt-1.0.0/requirements.txt +12 -0
  28. realtimestt-1.0.0/setup.py +210 -0
  29. realtimestt-0.3.103/MANIFEST.in +0 -3
  30. realtimestt-0.3.103/PKG-INFO +0 -641
  31. realtimestt-0.3.103/README.md +0 -605
  32. realtimestt-0.3.103/RealtimeSTT/__init__.py +0 -3
  33. realtimestt-0.3.103/realtimestt.egg-info/PKG-INFO +0 -641
  34. realtimestt-0.3.103/realtimestt.egg-info/SOURCES.txt +0 -21
  35. realtimestt-0.3.103/realtimestt.egg-info/requires.txt +0 -12
  36. realtimestt-0.3.103/requirements.txt +0 -12
  37. realtimestt-0.3.103/setup.py +0 -41
  38. {realtimestt-0.3.103 → realtimestt-1.0.0}/LICENSE +0 -0
  39. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT/audio_input.py +0 -0
  40. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT/audio_recorder_client.py +0 -0
  41. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT/safepipe.py +0 -0
  42. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT/warmup_audio.wav +0 -0
  43. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT_server/__init__.py +0 -0
  44. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT_server/install_packages.py +0 -0
  45. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT_server/stt_cli_client.py +0 -0
  46. {realtimestt-0.3.103 → realtimestt-1.0.0}/RealtimeSTT_server/stt_server.py +0 -0
  47. {realtimestt-0.3.103 → realtimestt-1.0.0}/realtimestt.egg-info/dependency_links.txt +0 -0
  48. {realtimestt-0.3.103 → realtimestt-1.0.0}/realtimestt.egg-info/entry_points.txt +0 -0
  49. {realtimestt-0.3.103 → realtimestt-1.0.0}/realtimestt.egg-info/top_level.txt +0 -0
  50. {realtimestt-0.3.103 → realtimestt-1.0.0}/setup.cfg +0 -0
@@ -0,0 +1,13 @@
1
+ include requirements.txt
2
+ include README.md
3
+ include LICENSE
4
+ prune docs/development
5
+ prune dev-log
6
+ prune roadmap
7
+ prune test-model-cache
8
+ prune test-results
9
+ prune docs_private
10
+ prune tests_private
11
+ global-exclude *Kopie*.py
12
+ global-exclude *.bak
13
+ global-exclude *.tmp
@@ -0,0 +1,241 @@
1
+ Metadata-Version: 2.1
2
+ Name: realtimestt
3
+ Version: 1.0.0
4
+ Summary: A fast Voice Activity Detection and Transcription System
5
+ Home-page: https://github.com/KoljaB/RealTimeSTT
6
+ Author: Kolja Beigel
7
+ Author-email: kolja.beigel@web.de
8
+ License: MIT
9
+ 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
10
+ Requires-Python: >=3.6
11
+ Description-Content-Type: text/markdown
12
+ Provides-Extra: minimal
13
+ Provides-Extra: faster-whisper
14
+ Provides-Extra: whisper-cpp
15
+ Provides-Extra: whispercpp
16
+ Provides-Extra: openai-whisper
17
+ Provides-Extra: sherpa-onnx
18
+ Provides-Extra: sherpa
19
+ Provides-Extra: transformers
20
+ Provides-Extra: moonshine
21
+ Provides-Extra: granite
22
+ Provides-Extra: cohere
23
+ Provides-Extra: parakeet
24
+ Provides-Extra: nvidia-parakeet
25
+ Provides-Extra: qwen
26
+ Provides-Extra: qwen3-asr
27
+ Provides-Extra: qwen-vllm
28
+ Provides-Extra: porcupine
29
+ Provides-Extra: pvporcupine
30
+ Provides-Extra: pvp
31
+ Provides-Extra: openwakeword
32
+ Provides-Extra: oww
33
+ Provides-Extra: wakewords
34
+ Provides-Extra: wake-words
35
+ Provides-Extra: recommended
36
+ Provides-Extra: default
37
+ Provides-Extra: all
38
+ License-File: LICENSE
39
+
40
+
41
+ RealtimeSTT lets you choose the transcription and wake-word dependencies you
42
+ want to install.
43
+
44
+ Recommended default local Whisper install:
45
+
46
+ pip install "realtimestt[faster-whisper]"
47
+
48
+ Core package only, without a transcription engine or wake-word backend:
49
+
50
+ pip install realtimestt
51
+
52
+ Install multiple extras by separating them with commas:
53
+
54
+ pip install "realtimestt[faster-whisper,porcupine]"
55
+ pip install "realtimestt[whisper-cpp,openwakeword]"
56
+
57
+ Available extras include:
58
+
59
+ - faster-whisper: default CTranslate2 Whisper backend
60
+ - whisper-cpp: whisper.cpp backend through pywhispercpp
61
+ - openai-whisper: original OpenAI Whisper Python backend
62
+ - sherpa-onnx: sherpa-onnx CPU backends
63
+ - parakeet: NVIDIA NeMo Parakeet backend
64
+ - transformers: shared Transformers dependency for Moonshine, Granite, and Cohere
65
+ - moonshine, granite, cohere: aliases for the Transformers dependency set
66
+ - qwen: Qwen ASR backend
67
+ - qwen-vllm: Qwen ASR with vLLM extras
68
+ - porcupine: Porcupine wake-word backend
69
+ - openwakeword: OpenWakeWord wake-word backend
70
+ - wakewords: both wake-word backends
71
+ - recommended/default: faster-whisper backend
72
+ - all: all PyPI-installable optional backends
73
+
74
+ The WebRTC VAD and Silero VAD dependencies are still part of the core install
75
+ because AudioToTextRecorder currently initializes both VAD paths.
76
+
77
+ # RealtimeSTT
78
+
79
+ RealtimeSTT is a Python speech-to-text library for applications that need
80
+ voice activity detection, fast transcription, optional realtime text updates,
81
+ wake words, and direct access to audio streams. It is designed for assistants,
82
+ dictation tools, browser streaming servers, and prototypes that need to turn
83
+ speech into text with only a few lines of code.
84
+
85
+ The recommended default path uses `faster_whisper`. Other engines are available
86
+ through install extras when their optional dependencies and models are present.
87
+
88
+ ## Install
89
+
90
+ ```bash
91
+ pip install "RealtimeSTT[faster-whisper]"
92
+ ```
93
+
94
+ On Linux, install PortAudio headers before installing the package:
95
+
96
+ ```bash
97
+ sudo apt-get update
98
+ sudo apt-get install python3-dev portaudio19-dev
99
+ ```
100
+
101
+ On macOS:
102
+
103
+ ```bash
104
+ brew install portaudio
105
+ ```
106
+
107
+ For CUDA, platform notes, and optional engine stacks, see
108
+ [docs/installation.md](docs/installation.md).
109
+
110
+ ## Microphone Example
111
+
112
+ This waits for speech, stops after the detected utterance, and prints the final
113
+ transcript:
114
+
115
+ ```python
116
+ from RealtimeSTT import AudioToTextRecorder
117
+
118
+ if __name__ == "__main__":
119
+ with AudioToTextRecorder() as recorder:
120
+ print("Speak now")
121
+ print(recorder.text())
122
+ ```
123
+
124
+ Use the `if __name__ == "__main__":` guard when running scripts, especially on
125
+ Windows, because RealtimeSTT uses multiprocessing for model work.
126
+
127
+ ## Automatic Recording Loop
128
+
129
+ For continuous dictation, pass a callback to `text()` so transcription work can
130
+ complete asynchronously while your loop keeps listening:
131
+
132
+ ```python
133
+ from RealtimeSTT import AudioToTextRecorder
134
+
135
+
136
+ def process_text(text):
137
+ print(text)
138
+
139
+
140
+ if __name__ == "__main__":
141
+ recorder = AudioToTextRecorder()
142
+
143
+ while True:
144
+ recorder.text(process_text)
145
+ ```
146
+
147
+ ## External Audio
148
+
149
+ Set `use_microphone=False` when audio comes from a file, stream, websocket, or
150
+ another process. Feed 16-bit mono PCM chunks at 16 kHz, or pass the original
151
+ sample rate so RealtimeSTT can resample:
152
+
153
+ ```python
154
+ from RealtimeSTT import AudioToTextRecorder
155
+
156
+ if __name__ == "__main__":
157
+ recorder = AudioToTextRecorder(use_microphone=False)
158
+
159
+ with open("audio_chunk.pcm", "rb") as audio_file:
160
+ recorder.feed_audio(audio_file.read(), original_sample_rate=16000)
161
+
162
+ print(recorder.text())
163
+ recorder.shutdown()
164
+ ```
165
+
166
+ More examples are in [docs/quick-start.md](docs/quick-start.md) and
167
+ [docs/external-audio.md](docs/external-audio.md).
168
+
169
+ ## Configuration Reference
170
+
171
+ Every `AudioToTextRecorder` constructor parameter is documented in
172
+ [docs/configuration.md](docs/configuration.md), including model/engine
173
+ selection, realtime transcription, VAD timing, wake words, callbacks, external
174
+ audio, logging, and executor injection.
175
+
176
+ ## Features
177
+
178
+ - Voice activity detection with WebRTC VAD and Silero VAD.
179
+ - Final and realtime transcription with selectable engines.
180
+ - Optional wake word activation through Porcupine or OpenWakeWord.
181
+ - Direct microphone input or application-fed audio chunks.
182
+ - Event callbacks for recording, VAD, realtime text, transcription, and wake
183
+ word state.
184
+ - A FastAPI browser streaming server example with multi-user session isolation,
185
+ shared inference resources, metrics, and health endpoints.
186
+
187
+ ## Documentation
188
+
189
+ - [Quick start](docs/quick-start.md): shortest demos and common recording
190
+ patterns.
191
+ - [Installation](docs/installation.md): platform setup, CUDA notes, and optional
192
+ dependencies.
193
+ - [Configuration](docs/configuration.md): complete `AudioToTextRecorder`
194
+ parameter reference.
195
+ - [Transcription engines](docs/transcription-engines.md): engine selection and
196
+ setup links.
197
+ - [Wake words](docs/wake-words.md): Porcupine and OpenWakeWord setup.
198
+ - [External audio](docs/external-audio.md): feeding audio without a microphone.
199
+ - [Testing](docs/testing.md): maintained unit and opt-in golden test workflow.
200
+ - [Test scripts](docs/test-scripts.md): demos, manual tests, regressions, and
201
+ legacy experiments under `tests/`.
202
+ - [FastAPI server](docs/fastapi-server.md): browser server configuration,
203
+ protocol, metrics, and deployment notes.
204
+ - [Troubleshooting](docs/troubleshooting.md): common install, audio, CUDA,
205
+ model, dependency, and runtime errors.
206
+
207
+ Engine-specific references:
208
+
209
+ - [faster-whisper](docs/engines/faster-whisper.md)
210
+ - [whisper.cpp](docs/engines/whisper-cpp.md)
211
+ - [OpenAI Whisper](docs/engines/openai-whisper.md)
212
+ - [Moonshine](docs/engines/moonshine.md)
213
+ - [sherpa-onnx](docs/engines/sherpa-onnx.md)
214
+ - [Parakeet NeMo](docs/engines/parakeet-nemo.md)
215
+ - [Transformers engines](docs/engines/hf-transformers.md)
216
+ - [Cohere Transcribe](docs/engines/cohere.md)
217
+
218
+ ## Server Example
219
+
220
+ The browser server lives in `example_fastapi_server`:
221
+
222
+ ```bash
223
+ python -m pip install -r example_fastapi_server/requirements.txt
224
+ python example_fastapi_server/server.py --host 0.0.0.0 --port 8010
225
+ ```
226
+
227
+ Open `http://localhost:8010`. See [docs/fastapi-server.md](docs/fastapi-server.md)
228
+ for engine recipes, websocket protocol details, health checks, and metrics.
229
+
230
+ ## Contributing
231
+
232
+ Focused tests and small changes are easiest to review. The project keeps fast
233
+ unit tests separate from opt-in real-model tests; see [docs/testing.md](docs/testing.md).
234
+
235
+ ## License
236
+
237
+ MIT
238
+
239
+ ## Author
240
+
241
+ Kolja Beigel
@@ -0,0 +1,165 @@
1
+ # RealtimeSTT
2
+
3
+ RealtimeSTT is a Python speech-to-text library for applications that need
4
+ voice activity detection, fast transcription, optional realtime text updates,
5
+ wake words, and direct access to audio streams. It is designed for assistants,
6
+ dictation tools, browser streaming servers, and prototypes that need to turn
7
+ speech into text with only a few lines of code.
8
+
9
+ The recommended default path uses `faster_whisper`. Other engines are available
10
+ through install extras when their optional dependencies and models are present.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pip install "RealtimeSTT[faster-whisper]"
16
+ ```
17
+
18
+ On Linux, install PortAudio headers before installing the package:
19
+
20
+ ```bash
21
+ sudo apt-get update
22
+ sudo apt-get install python3-dev portaudio19-dev
23
+ ```
24
+
25
+ On macOS:
26
+
27
+ ```bash
28
+ brew install portaudio
29
+ ```
30
+
31
+ For CUDA, platform notes, and optional engine stacks, see
32
+ [docs/installation.md](docs/installation.md).
33
+
34
+ ## Microphone Example
35
+
36
+ This waits for speech, stops after the detected utterance, and prints the final
37
+ transcript:
38
+
39
+ ```python
40
+ from RealtimeSTT import AudioToTextRecorder
41
+
42
+ if __name__ == "__main__":
43
+ with AudioToTextRecorder() as recorder:
44
+ print("Speak now")
45
+ print(recorder.text())
46
+ ```
47
+
48
+ Use the `if __name__ == "__main__":` guard when running scripts, especially on
49
+ Windows, because RealtimeSTT uses multiprocessing for model work.
50
+
51
+ ## Automatic Recording Loop
52
+
53
+ For continuous dictation, pass a callback to `text()` so transcription work can
54
+ complete asynchronously while your loop keeps listening:
55
+
56
+ ```python
57
+ from RealtimeSTT import AudioToTextRecorder
58
+
59
+
60
+ def process_text(text):
61
+ print(text)
62
+
63
+
64
+ if __name__ == "__main__":
65
+ recorder = AudioToTextRecorder()
66
+
67
+ while True:
68
+ recorder.text(process_text)
69
+ ```
70
+
71
+ ## External Audio
72
+
73
+ Set `use_microphone=False` when audio comes from a file, stream, websocket, or
74
+ another process. Feed 16-bit mono PCM chunks at 16 kHz, or pass the original
75
+ sample rate so RealtimeSTT can resample:
76
+
77
+ ```python
78
+ from RealtimeSTT import AudioToTextRecorder
79
+
80
+ if __name__ == "__main__":
81
+ recorder = AudioToTextRecorder(use_microphone=False)
82
+
83
+ with open("audio_chunk.pcm", "rb") as audio_file:
84
+ recorder.feed_audio(audio_file.read(), original_sample_rate=16000)
85
+
86
+ print(recorder.text())
87
+ recorder.shutdown()
88
+ ```
89
+
90
+ More examples are in [docs/quick-start.md](docs/quick-start.md) and
91
+ [docs/external-audio.md](docs/external-audio.md).
92
+
93
+ ## Configuration Reference
94
+
95
+ Every `AudioToTextRecorder` constructor parameter is documented in
96
+ [docs/configuration.md](docs/configuration.md), including model/engine
97
+ selection, realtime transcription, VAD timing, wake words, callbacks, external
98
+ audio, logging, and executor injection.
99
+
100
+ ## Features
101
+
102
+ - Voice activity detection with WebRTC VAD and Silero VAD.
103
+ - Final and realtime transcription with selectable engines.
104
+ - Optional wake word activation through Porcupine or OpenWakeWord.
105
+ - Direct microphone input or application-fed audio chunks.
106
+ - Event callbacks for recording, VAD, realtime text, transcription, and wake
107
+ word state.
108
+ - A FastAPI browser streaming server example with multi-user session isolation,
109
+ shared inference resources, metrics, and health endpoints.
110
+
111
+ ## Documentation
112
+
113
+ - [Quick start](docs/quick-start.md): shortest demos and common recording
114
+ patterns.
115
+ - [Installation](docs/installation.md): platform setup, CUDA notes, and optional
116
+ dependencies.
117
+ - [Configuration](docs/configuration.md): complete `AudioToTextRecorder`
118
+ parameter reference.
119
+ - [Transcription engines](docs/transcription-engines.md): engine selection and
120
+ setup links.
121
+ - [Wake words](docs/wake-words.md): Porcupine and OpenWakeWord setup.
122
+ - [External audio](docs/external-audio.md): feeding audio without a microphone.
123
+ - [Testing](docs/testing.md): maintained unit and opt-in golden test workflow.
124
+ - [Test scripts](docs/test-scripts.md): demos, manual tests, regressions, and
125
+ legacy experiments under `tests/`.
126
+ - [FastAPI server](docs/fastapi-server.md): browser server configuration,
127
+ protocol, metrics, and deployment notes.
128
+ - [Troubleshooting](docs/troubleshooting.md): common install, audio, CUDA,
129
+ model, dependency, and runtime errors.
130
+
131
+ Engine-specific references:
132
+
133
+ - [faster-whisper](docs/engines/faster-whisper.md)
134
+ - [whisper.cpp](docs/engines/whisper-cpp.md)
135
+ - [OpenAI Whisper](docs/engines/openai-whisper.md)
136
+ - [Moonshine](docs/engines/moonshine.md)
137
+ - [sherpa-onnx](docs/engines/sherpa-onnx.md)
138
+ - [Parakeet NeMo](docs/engines/parakeet-nemo.md)
139
+ - [Transformers engines](docs/engines/hf-transformers.md)
140
+ - [Cohere Transcribe](docs/engines/cohere.md)
141
+
142
+ ## Server Example
143
+
144
+ The browser server lives in `example_fastapi_server`:
145
+
146
+ ```bash
147
+ python -m pip install -r example_fastapi_server/requirements.txt
148
+ python example_fastapi_server/server.py --host 0.0.0.0 --port 8010
149
+ ```
150
+
151
+ Open `http://localhost:8010`. See [docs/fastapi-server.md](docs/fastapi-server.md)
152
+ for engine recipes, websocket protocol details, health checks, and metrics.
153
+
154
+ ## Contributing
155
+
156
+ Focused tests and small changes are easiest to review. The project keeps fast
157
+ unit tests separate from opt-in real-model tests; see [docs/testing.md](docs/testing.md).
158
+
159
+ ## License
160
+
161
+ MIT
162
+
163
+ ## Author
164
+
165
+ Kolja Beigel
@@ -0,0 +1,36 @@
1
+ __all__ = [
2
+ "AudioToTextRecorder",
3
+ "AudioToTextRecorderClient",
4
+ "AudioInput",
5
+ "RealtimeSpeechBoundaryDetector",
6
+ "SpeechBoundaryEvent",
7
+ "SpeechBoundaryResult",
8
+ ]
9
+
10
+
11
+ def __getattr__(name):
12
+ if name == "AudioToTextRecorder":
13
+ from .audio_recorder import AudioToTextRecorder
14
+
15
+ return AudioToTextRecorder
16
+ if name == "AudioToTextRecorderClient":
17
+ from .audio_recorder_client import AudioToTextRecorderClient
18
+
19
+ return AudioToTextRecorderClient
20
+ if name == "AudioInput":
21
+ from .audio_input import AudioInput
22
+
23
+ return AudioInput
24
+ if name == "RealtimeSpeechBoundaryDetector":
25
+ from .realtime_boundary_detector import RealtimeSpeechBoundaryDetector
26
+
27
+ return RealtimeSpeechBoundaryDetector
28
+ if name == "SpeechBoundaryEvent":
29
+ from .realtime_boundary_detector import SpeechBoundaryEvent
30
+
31
+ return SpeechBoundaryEvent
32
+ if name == "SpeechBoundaryResult":
33
+ from .realtime_boundary_detector import SpeechBoundaryResult
34
+
35
+ return SpeechBoundaryResult
36
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")