axio-audio 0.12.2__tar.gz → 0.12.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: axio-audio
3
- Version: 0.12.2
3
+ Version: 0.12.3
4
4
  Summary: Microphone and speaker helpers for Axio realtime agents
5
5
  Project-URL: Documentation, https://docs.axio-agent.com
6
6
  Project-URL: Homepage, https://github.com/mosquito/axio-agent
@@ -0,0 +1,70 @@
1
+ # axio-audio
2
+
3
+ Microphone capture and speaker playback for Axio realtime agents. Provides
4
+ `Microphone`, `Speaker`, and `DuplexAudio` on top of sounddevice and NumPy.
5
+ A separately installed realtime transport connects the agent to the model.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install axio-audio
11
+ ```
12
+
13
+ Audio capture and playback require working PortAudio input/output devices.
14
+ Install a realtime transport, such as `axio-transport-openai` or
15
+ `axio-transport-google`, to build a voice agent.
16
+
17
+ ## Capture audio
18
+
19
+ ```python
20
+ import asyncio
21
+
22
+ from axio_audio import Microphone
23
+
24
+
25
+ async def main() -> None:
26
+ async with Microphone(sample_rate=24000, chunk_ms=50) as microphone:
27
+ async for block in microphone:
28
+ print(block.media_type, len(block.data))
29
+ break
30
+
31
+
32
+ asyncio.run(main())
33
+ ```
34
+
35
+ This example opens the microphone. Chunks are `axio.AudioBlock` objects
36
+ containing PCM16 mono audio. Send them to an open `RealtimeAgent` using
37
+ `await agent.send(block)`.
38
+
39
+ ## Play audio
40
+
41
+ Use `Speaker` as an async context manager and feed raw PCM16 bytes received
42
+ from the model:
43
+
44
+ ```python
45
+ from axio.events import AudioOutputDelta
46
+ from axio_audio import Speaker
47
+
48
+
49
+ async def play(agent) -> None:
50
+ async with Speaker(sample_rate=24000) as speaker:
51
+ async for event in agent.events():
52
+ if isinstance(event, AudioOutputDelta):
53
+ await speaker.feed(event.data)
54
+ ```
55
+
56
+ Match capture and playback sample rates to the transport's input and output
57
+ formats. `speaker.stop()` clears queued playback when the user interrupts.
58
+ Context managers close devices even when a task fails or is cancelled.
59
+
60
+ ## Duplex audio
61
+
62
+ `DuplexAudio` opens one PortAudio stream for input and output, so both use the
63
+ same device clock. Use `mic_chunks()` for capture and `feed_speaker()` for
64
+ playback. Its defaults are 48 kHz and 20 ms chunks. A shared clock helps an
65
+ echo cancellation pipeline; it does not implement echo cancellation itself.
66
+
67
+ See the [realtime audio guide](https://github.com/mosquito/axio-agent/blob/main/docs/guides/realtime-audio.md)
68
+ for a complete voice agent and the
69
+ [API reference](https://github.com/mosquito/axio-agent/blob/main/docs/api/audio.md) for device
70
+ and buffering options.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "axio-audio"
3
- version = "0.12.2"
3
+ version = "0.12.3"
4
4
  description = "Microphone and speaker helpers for Axio realtime agents"
5
5
  requires-python = ">=3.12"
6
6
  license = {text = "MIT"}
File without changes
File without changes