autourgos-micinput
Standalone, provider-agnostic microphone capture for the Autourgos framework. Extracted out of autourgos-live so any package -- autourgos-live, autourgos-openaichat, autourgos-responses, autourgos-agent, or plain application code -- can capture raw PCM audio from the system microphone without depending on autourgos-live for it. This package knows nothing about any specific LLM API; it just yields bytes.
import asyncio
from autourgos_micinput import MicrophoneStream
async def main():
async with MicrophoneStream(sample_rate=16000) as mic:
async for chunk in mic:
print(len(chunk), "bytes captured, mime_type =", mic.mime_type)
break # just capture one chunk for this example
asyncio.run(main())
Install
pip install "autourgos-micinput[mic]"
sounddevice is required to actually open a MicrophoneStream and is gated behind the mic extra -- import autourgos_micinput alone never requires it. Requires Python 3.10+.
Usage
With autourgos-live (voice input to Gemini Live)
autourgos-live does not depend on this package or re-export MicrophoneStream -- that was tried and reverted (see autourgos-live's CHANGELOG, 0.3.0/0.4.0) because it made this package a mandatory install even for callers who never touch local audio (telephony, browser WebRTC, text-only). Install both separately and forward chunks yourself -- three lines:
from autourgos_live import GeminiLiveSession
from autourgos_micinput import MicrophoneStream
async def pipe_microphone(session, **kwargs):
async with MicrophoneStream(**kwargs) as mic:
async for chunk in mic:
await session.send_audio_chunk(chunk, mime_type=mic.mime_type)
With autourgos-openaichat / autourgos-responses (voice input to a request/response call)
These packages don't integrate with autourgos-micinput directly -- capture audio yourself, run it through your own speech-to-text step, then pass the resulting text to invoke()/create():
import asyncio
from autourgos_micinput import MicrophoneStream
async def record_utterance(seconds: float = 3.0) -> bytes:
chunks = []
frames_needed = int(seconds * 1000 / 100) # default chunk_ms=100
async with MicrophoneStream(sample_rate=16000) as mic:
async for chunk in mic:
chunks.append(chunk)
if len(chunks) >= frames_needed:
break
return b"".join(chunks)
# pcm = asyncio.run(record_utterance())
# text = my_own_speech_to_text(pcm)
# response = my_openaichat_model.invoke(text)
With autourgos-agent (as a tool)
Wrap capture in an @tool-decorated function the same way any other tool is defined:
from autourgos_agent import tool
from autourgos_micinput import MicrophoneStream
import asyncio
@tool
def record_audio(seconds: float = 3.0) -> bytes:
"""Record `seconds` of audio from the microphone and return raw 16kHz PCM bytes."""
async def _record():
chunks = []
async with MicrophoneStream(sample_rate=16000) as mic:
async for chunk in mic:
chunks.append(chunk)
if len(chunks) * 0.1 >= seconds:
break
return b"".join(chunks)
return asyncio.run(_record())
API Reference
MicrophoneStream
Async context manager; async-iterates raw 16-bit PCM chunks from the input device.
| Parameter | Type | Default | Description |
|---|---|---|---|
sample_rate |
int |
16000 |
PCM sample rate |
chunk_ms |
int |
100 |
Capture chunk size in milliseconds |
channels |
int |
1 |
Audio channel count |
device |
int |
None |
Input device index; None uses the system default |
max_queue_chunks |
int |
50 |
Bounds the internal capture buffer (50 x 100ms = 5s default). Once full, the oldest buffered chunk is dropped for the newest one -- see .dropped_chunk_count |
| Attribute | Description |
|---|---|
.mime_type |
Pre-formatted "audio/pcm;rate=<sample_rate>", ready to hand to a live-session send_audio_chunk()-style call |
.dropped_chunk_count |
How many buffered chunks have been dropped due to a full queue (slow consumer / stall) |
Raises ImportError (with an install hint) on __aenter__ if the mic extra isn't installed -- never on import autourgos_micinput.
License
Apache License 2.0, Copyright (c) 2026 Jitin Kumar Sengar
Metadata
Release files for autourgos-micinput 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autourgos_micinput-0.1.2.tar.gz | 18.3 kB | Without provenance | Details for autourgos_micinput-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autourgos_micinput-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for autourgos_micinput-0.1.2-py3-none-any.whl |
Total release size: 33.3 kB
Release files / autourgos_micinput-0.1.2.tar.gz
| Download URL | autourgos_micinput-0.1.2.tar.gz |
|---|---|
| Size | 18.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
487822d3dc8a814fb6de26feb9bb472a2771e6d80b22f86a0f7cd5714c8bc57f
|
|
BLAKE2b-256 checksum How to use checksums |
37d14d91541b7ee8d5202f5aca802864ad032c3c389005801053aae0e35f01ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Release files / autourgos_micinput-0.1.2-py3-none-any.whl
| Download URL | autourgos_micinput-0.1.2-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
890f965b66f9d9cf07f8e64091730ad24795b48569c347af4fb7bd2f34c80f7a
|
|
BLAKE2b-256 checksum How to use checksums |
c5a4acc2e70d6d4cbff04b2130f509f3d1fb542e9ab1bf3bf99a5a7a58d5b819
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.9
|
Security for autourgos-micinput 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.