examples.mic_transcribe¶
Live Microphone Transcription with Whisper - vllm-mlx Records audio from your Mac's microphone and transcribes it using Whisper.
View the complete module source at #L1-L221.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
examples.mic_transcribe
¶
Live Microphone Transcription with Whisper - vllm-mlx
Records audio from your Mac's microphone and transcribes it using Whisper.
Usage
python examples/mic_transcribe.py # Record until Enter python examples/mic_transcribe.py --duration 5 # Record for 5 seconds python examples/mic_transcribe.py --model whisper-small # Use smaller model python examples/mic_transcribe.py --continuous # Continuous mode
Requirements
pip install sounddevice soundfile
examples.mic_transcribe.MODEL_ALIASES
module-attribute
¶
MODEL_ALIASES = {'whisper-large-v3': 'mlx-community/whisper-large-v3-mlx', 'whisper-large': 'mlx-community/whisper-large-v3-mlx', 'whisper-turbo': 'mlx-community/whisper-large-v3-turbo', 'whisper-medium': 'mlx-community/whisper-medium-mlx', 'whisper-small': 'mlx-community/whisper-small-mlx', 'parakeet': 'mlx-community/parakeet-tdt-0.6b-v2', 'parakeet-v3': 'mlx-community/parakeet-tdt-0.6b-v3'}
examples.mic_transcribe.record_audio
¶
Record audio from microphone.
Parameters:
-
duration–Recording duration in seconds. If None, records until Enter.
-
sample_rate–Audio sample rate (16000 Hz for Whisper)
Returns:
-
–
numpy array of audio data
Source code in examples/mic_transcribe.py
examples.mic_transcribe.save_audio
¶
examples.mic_transcribe.main
¶
Source code in examples/mic_transcribe.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
examples.mic_transcribe.record_audio · function
Record audio from microphone.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
duration |
not annotated |
no |
None |
Recording duration in seconds. If None, records until Enter. |
sample_rate |
not annotated |
no |
16000 |
Audio sample rate (16000 Hz for Whisper) |
Returns
- Type:
not annotated - Direct return expressions:
(audio.flatten(), sample_rate)
Exceptions and behavior
Function record_audio calls print, sd.rec, int, sd.wait; returns (audio.flatten(), sample_rate).
No direct raise statement appears in this definition.
examples.mic_transcribe.record_audio.wait_for_enter · nested function
Nested Function record_audio.wait_for_enter calls input, stop_recording.set.
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated
Exceptions and behavior
Nested Function record_audio.wait_for_enter calls input, stop_recording.set.
No direct raise statement appears in this definition.
examples.mic_transcribe.save_audio · function
Save audio to WAV file.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
audio |
not annotated |
yes |
none |
Required positional or keyword input. |
sample_rate |
not annotated |
yes |
none |
Required positional or keyword input. |
path |
not annotated |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
not annotated
Exceptions and behavior
Function save_audio calls sf.write.
No direct raise statement appears in this definition.
examples.mic_transcribe.main · function
Function main calls argparse.ArgumentParser, parser.add_argument, parser.parse_args, print; returns None.
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated - Direct return expressions:
None
Exceptions and behavior
Function main calls argparse.ArgumentParser, parser.add_argument, parser.parse_args, print; returns None.
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
record_audio |
function | record_audio(duration = None, sample_rate = 16000) -> not annotated |
Record audio from microphone. | #L39-L93 |
record_audio.wait_for_enter |
nested function | record_audio.wait_for_enter() -> not annotated |
Nested Function record_audio.wait_for_enter calls input, stop_recording.set. |
#L71-L73 |
save_audio |
function | save_audio(audio, sample_rate, path) -> not annotated |
Save audio to WAV file. | #L96-L99 |
main |
function | main() -> not annotated |
Function main calls argparse.ArgumentParser, parser.add_argument, parser.parse_args, print; returns None. |
#L102-L217 |