Easy Audio Interfaces
Easy Audio Interfaces is a Python library that provides a simple and flexible way to work with audio streams, including recording, playback, network transfer, and processing.
Features
- Socket-based audio streaming
- Local file reading and writing
- Audio resampling and rechunking
- Voice activity detection (VAD) using Silero VAD model
- Network file transfer
Quick Start
Here's a simple example to get you started - record audio from a socket, process it, and save to a file:
from easy_audio_interfaces import SocketReceiver, LocalFileSink, RechunkingBlock, ResamplingBlock
async with SocketReceiver() as receiver, LocalFileSink("output.wav") as sink:
rechunker = RechunkingBlock(chunk_size=512)
resampler = ResamplingBlock(original_sample_rate=receiver.sample_rate, resample_rate=16000)
rechunked_stream = rechunker.rechunk(receiver)
resampled_stream = resampler.resample(rechunked_stream)
await sink.write_from(resampled_stream)
Advanced Usage: Manual Chunk Processing with ResamplingBlock
For more control over individual audio chunks, you can use process_chunk and process_chunk_last:
from easy_audio_interfaces import ResamplingBlock
from wyoming.audio import AudioChunk
resampler = ResamplingBlock(resample_rate=16000)
await resampler.open()
# Process individual chunks
for chunk in audio_chunks:
async for resampled_chunk in resampler.process_chunk(chunk):
# Handle each resampled chunk
process_audio(resampled_chunk)
# Important: Flush remaining buffered samples
async for final_chunk in resampler.process_chunk_last():
process_audio(final_chunk)
await resampler.close()
Installation
From PyPI
uv add easy-audio-interfaces
From Source
uv add "https://github.com/AnkushMalaker/python-audio-interfaces.git"
Optional Dependencies
Based on the functionality you require, you should consider installing with the following extras:
# For speech-to-text
uv add "easy-audio-interfaces[stt]"
# For voice activity detection
uv add "easy-audio-interfaces[silero-vad]"
# For Bluetooth audio
uv add "easy-audio-interfaces[bluetooth]"
# For local audio devices
uv add "easy-audio-interfaces[local-audio]"
Usage
Main Components
Audio Sources
- SocketReceiver: Receives audio data over a WebSocket connection
- LocalFileStreamer: Streams audio data from a local file
Audio Sinks
- SocketStreamer: Sends audio data over a WebSocket connection
- LocalFileSink: Writes audio data to a local file
Processing Blocks
- CollectorBlock: Collects audio samples for a specified duration
- ResamplingBlock: Resamples audio to a different sample rate
process_chunk_last(): Flushes remaining buffered samples from the resampler. Call this after processing all chunks to ensure no audio data is lost due to internal buffering.
- RechunkingBlock: Rechunks audio data into fixed-size chunks
Voice Activity Detection
- SileroVad: Uses the Silero VAD model for voice activity detection
- VoiceGate: Applies voice activity detection to segment audio
Examples
Basic Friend Recorder
Records voice segments from a network stream using VAD:
python -m easy_audio_interfaces.examples.basic_friend_recorder
File Network Transfer
Transfer audio files over a network:
# Sender
python -m easy_audio_interfaces.examples.file_network_transfer sender input_file.wav --host localhost --port 8080
# Receiver
python -m easy_audio_interfaces.examples.file_network_transfer receiver output_file.wav --host 0.0.0.0 --port 8080
For more detailed usage and API documentation, please refer to the docstrings in the source code.
Metadata
Release files for easy-audio-interfaces 0.8.0
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 |
|---|---|---|---|---|
| easy_audio_interfaces-0.8.0.tar.gz | 36.6 kB | Without provenance | Details for easy_audio_interfaces-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| easy_audio_interfaces-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for easy_audio_interfaces-0.8.0-py3-none-any.whl |
Total release size: 79.8 kB
Release files / easy_audio_interfaces-0.8.0.tar.gz
| Download URL | easy_audio_interfaces-0.8.0.tar.gz |
|---|---|
| Size | 36.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
818668ad5f9439b1efe6190c1c21f92c68c69a925841c22fa8a9d91ee129c340
|
|
BLAKE2b-256 checksum How to use checksums |
5f66a461d7155f41b5d542d2dbb77d038b05305345daffebb632f70d56fc3402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / easy_audio_interfaces-0.8.0-py3-none-any.whl
| Download URL | easy_audio_interfaces-0.8.0-py3-none-any.whl |
|---|---|
| Size | 43.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38e9c3cb6c65489c6b3ef77d7257f190542456720c4c1715940fdd1c3524c653
|
|
BLAKE2b-256 checksum How to use checksums |
1c1e4e28d686c9cf700f3755af3e2897da6ad8a4617ea21e03091e3e0003d9b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for easy-audio-interfaces 0.8.0
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.