# `examples.mic_live`

Live Speech Transcription - Real-time with Voice Activity Detection Transcribes speech as you talk, detecting when you pause to process audio.

[View the complete module source at #L1-L245](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L1-L245).

## 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_live
    options:
      members:
        - MODEL_ALIASES
        - SAMPLE_RATE
        - LiveTranscriber
        - main
      filters: []
      show_if_no_docstring: true

## 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.

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber</code> · class</summary>

```python
examples.mic_live.LiveTranscriber(model_name: str, language: str = None)
```

Live transcription with voice activity detection.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model_name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `language` | `str` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Constructs: `examples.mic_live.LiveTranscriber`

**Exceptions and behavior**

Class `LiveTranscriber` declares 7 direct member(s).
No direct `raise` statement appears in this definition.

[View source #L42-L201](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L42-L201).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.__init__" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.__init__</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.__init__(model_name: str, language: str = None) -> not annotated
```

Method `LiveTranscriber.__init__` updates `self.model_name`, `self.language`, `self.silence_threshold`, `self.speech_pad_ms`; calls `deque`, `queue.Queue`.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `model_name` | `str` | `yes` | `none` | Required positional or keyword input. |
| `language` | `str` | `no` | `None` | Optional positional or keyword input; defaults to `None`. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `LiveTranscriber.__init__` updates `self.model_name`, `self.language`, `self.silence_threshold`, `self.speech_pad_ms`; calls `deque`, `queue.Queue`.
No direct `raise` statement appears in this definition.

[View source #L45-L68](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L45-L68).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.load_model" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.load_model</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.load_model() -> not annotated
```

Load STT model.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `LiveTranscriber.load_model` updates `self.engine`; calls `print`, `STTEngine`, `self.engine.load`.
No direct `raise` statement appears in this definition.

[View source #L70-L76](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L70-L76).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.get_audio_level" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.get_audio_level</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.get_audio_level(audio) -> not annotated
```

Get RMS audio level.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `audio` | `not annotated` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `np.sqrt(np.mean(audio ** 2))`

**Exceptions and behavior**

Method `LiveTranscriber.get_audio_level` calls `np.sqrt`, `np.mean`; returns `np.sqrt(np.mean(audio ** 2))`.
No direct `raise` statement appears in this definition.

[View source #L78-L80](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L78-L80).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.audio_callback" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.audio_callback</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.audio_callback(indata, frames, time_info, status) -> not annotated
```

Audio input callback.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `indata` | `not annotated` | `yes` | `none` | Required positional or keyword input. |
| `frames` | `not annotated` | `yes` | `none` | Required positional or keyword input. |
| `time_info` | `not annotated` | `yes` | `none` | Required positional or keyword input. |
| `status` | `not annotated` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `LiveTranscriber.audio_callback` calls `self.audio_queue.put`, `time.time`, `indata.copy().flatten`, `indata.copy`.
No direct `raise` statement appears in this definition.

[View source #L82-L85](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L82-L85).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.transcribe_audio" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.transcribe_audio</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.transcribe_audio(audio) -> not annotated
```

Transcribe audio array.

**Parameters**

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `audio` | `not annotated` | `yes` | `none` | Required positional or keyword input. |

**Returns**

- Type: `not annotated`
- Direct return expressions: `result.text.strip()`

**Exceptions and behavior**

Method `LiveTranscriber.transcribe_audio` calls `tempfile.NamedTemporaryFile`, `sf.write`, `self.engine.transcribe`, `result.text.strip`; returns `result.text.strip()`.
No direct `raise` statement appears in this definition.

[View source #L87-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L87-L99).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.process_audio_stream" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.process_audio_stream</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.process_audio_stream() -> not annotated
```

Process audio with VAD.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Method `LiveTranscriber.process_audio_stream` updates `self.is_speaking`, `self.speech_start`, `self.last_speech_time`; calls `self.audio_queue.get`, `self.get_audio_level`, `print`, `speech_buffer.extend`.
No direct `raise` statement appears in this definition.

[View source #L101-L160](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L101-L160).

</details>

<details class="api-contract" id="contract-examples.mic_live.LiveTranscriber.run" markdown="1">
<summary><code>examples.mic_live.LiveTranscriber.run</code> · method</summary>

```python
examples.mic_live.LiveTranscriber.run() -> not annotated
```

Start live transcription.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`
- Direct return expressions: `self.full_transcript`

**Exceptions and behavior**

Method `LiveTranscriber.run` updates `self.running`; calls `print`, `threading.Thread`, `process_thread.start`, `sd.InputStream`; returns `self.full_transcript`.
No direct `raise` statement appears in this definition.

[View source #L162-L201](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L162-L201).

</details>

<details class="api-contract" id="contract-examples.mic_live.main" markdown="1">
<summary><code>examples.mic_live.main</code> · function</summary>

```python
examples.mic_live.main() -> not annotated
```

Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`.

**Parameters**

This callable has no explicit inputs.

**Returns**

- Type: `not annotated`

**Exceptions and behavior**

Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`.
No direct `raise` statement appears in this definition.

[View source #L204-L241](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L204-L241).

</details>

## 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 |
| --- | --- | --- | --- | --- |
| [`LiveTranscriber`](#contract-examples.mic_live.LiveTranscriber) | class | `LiveTranscriber(model_name: str, language: str = None)` | Live transcription with voice activity detection. | [#L42-L201](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L42-L201) |
| [`LiveTranscriber.__init__`](#contract-examples.mic_live.LiveTranscriber.__init__) | method | `LiveTranscriber.__init__(model_name: str, language: str = None) -> not annotated` | Method `LiveTranscriber.__init__` updates `self.model_name`, `self.language`, `self.silence_threshold`, `self.speech_pad_ms`; calls `deque`, `queue.Queue`. | [#L45-L68](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L45-L68) |
| [`LiveTranscriber.load_model`](#contract-examples.mic_live.LiveTranscriber.load_model) | method | `LiveTranscriber.load_model() -> not annotated` | Load STT model. | [#L70-L76](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L70-L76) |
| [`LiveTranscriber.get_audio_level`](#contract-examples.mic_live.LiveTranscriber.get_audio_level) | method | `LiveTranscriber.get_audio_level(audio) -> not annotated` | Get RMS audio level. | [#L78-L80](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L78-L80) |
| [`LiveTranscriber.audio_callback`](#contract-examples.mic_live.LiveTranscriber.audio_callback) | method | `LiveTranscriber.audio_callback(indata, frames, time_info, status) -> not annotated` | Audio input callback. | [#L82-L85](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L82-L85) |
| [`LiveTranscriber.transcribe_audio`](#contract-examples.mic_live.LiveTranscriber.transcribe_audio) | method | `LiveTranscriber.transcribe_audio(audio) -> not annotated` | Transcribe audio array. | [#L87-L99](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L87-L99) |
| [`LiveTranscriber.process_audio_stream`](#contract-examples.mic_live.LiveTranscriber.process_audio_stream) | method | `LiveTranscriber.process_audio_stream() -> not annotated` | Process audio with VAD. | [#L101-L160](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L101-L160) |
| [`LiveTranscriber.run`](#contract-examples.mic_live.LiveTranscriber.run) | method | `LiveTranscriber.run() -> not annotated` | Start live transcription. | [#L162-L201](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L162-L201) |
| [`main`](#contract-examples.mic_live.main) | function | `main() -> not annotated` | Function `main` calls `argparse.ArgumentParser`, `parser.add_argument`, `parser.parse_args`, `print`. | [#L204-L241](https://github.com/waybarrios/vllm-mlx/blob/a69d47912bcb21d8fe04d48f75fa896b620ffcfa/examples/mic_live.py#L204-L241) |
