Skip to content

Commit 3a51cab

Browse files
committedSep 5, 2023
Added new callbacks
1 parent 865de2c commit 3a51cab

File tree

3 files changed

+174
-48
lines changed

3 files changed

+174
-48
lines changed
 

‎README.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ This library uses:
4343
pip install RealtimeSTT
4444
```
4545

46-
This will install all the necessary dependencies, including a CPU support only version of PyTorch.
46+
This will install all the necessary dependencies, including a **CPU support only** version of PyTorch.
4747

4848
### GPU Support with CUDA (recommended)
4949

50-
Additional steps are needed for a GPU-optimized installation. These steps are recommended for those who require better performance and have a compatible NVIDIA GPU.
50+
Additional steps are needed for a **GPU-optimized** installation. These steps are recommended for those who require **better performance** and have a compatible NVIDIA GPU.
5151

52-
If you plan to use RealtimeSTT with GPU support via CUDA, please follow these steps:
52+
To use RealtimeSTT with GPU support via CUDA please follow these steps:
5353

5454
1. **Install NVIDIA CUDA Toolkit 11.8**:
5555
- Visit [NVIDIA CUDA Toolkit Archive](https://developer.nvidia.com/cuda-11-8-0-download-archive).
@@ -106,7 +106,7 @@ print(recorder.text())
106106

107107
### Callbacks
108108

109-
You can set callback functions to be executed when recording starts or stops:
109+
You can set callback functions to be executed on different events (see [Configuration](#configuration)) :
110110

111111
```python
112112
def my_start_callback():
@@ -151,7 +151,9 @@ The test subdirectory contains a set of scripts to help you evaluate and underst
151151
152152
### Initialization Parameters for `AudioToTextRecorder`
153153
154-
When you initialize the `AudioToTextRecorder` class, you have various options to customize its behavior. Here are the available parameters:
154+
When you initialize the `AudioToTextRecorder` class, you have various options to customize its behavior.
155+
156+
#### General Parameters
155157
156158
- **model** (str, default="tiny"): Model size or path for transcription.
157159
- Options: 'tiny', 'tiny.en', 'base', 'base.en', 'small', 'small.en', 'medium', 'medium.en', 'large-v1', 'large-v2'.
@@ -163,10 +165,14 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
163165
164166
- **on_recording_stop**: A callable function triggered when recording ends.
165167
168+
- **on_transcription_start**: A callable function triggered when transcription starts.
169+
166170
- **spinner** (bool, default=True): Provides a spinner animation text with information about the current recorder state.
167171
168172
- **level** (int, default=logging.WARNING): Logging level.
169173
174+
#### Voice Activation Parameters
175+
170176
- **silero_sensitivity** (float, default=0.6): Sensitivity for Silero's voice activity detection ranging from 0 (least sensitive) to 1 (most sensitive). Default is 0.6.
171177

172178
- **webrtc_sensitivity** (int, default=3): Sensitivity for the WebRTC Voice Activity Detection engine ranging from 1 (least sensitive) to 3 (most sensitive). Default is 3.
@@ -179,6 +185,8 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
179185
180186
- **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.
181187
188+
#### Wake Word Parameters
189+
182190
- **wake_words** (str, default=""): Wake words for initiating the recording. Multiple wake words can be provided as a comma-separated string. Supported wake words are: alexa, americano, blueberry, bumblebee, computer, grapefruits, grasshopper, hey google, hey siri, jarvis, ok google, picovoice, porcupine, terminator
183191
184192
- **wake_words_sensitivity** (float, default=0.6): Sensitivity level for wake word detection (0 for least sensitive, 1 for most sensitive).
@@ -191,6 +199,10 @@ When you initialize the `AudioToTextRecorder` class, you have various options to
191199
192200
- **on_wakeword_timeout**: Callback function to be called when the system goes back to an inactive state after when no speech was detected after wake word activation.
193201
202+
- **on_wakeword_detection_start**: Callback function to be called the system starts to listen for wake words
203+
204+
- **on_wakeword_detection_end**: Callback function to be called when stopping to listen for wake words (e.g. because of timeout or wake word detected)
205+
194206
195207
## Contribution
196208

0 commit comments

Comments
 (0)