Skip to main content

No project description provided

Project description

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 Installation: To install Easy Audio Interfaces, use pip: pip install easy-audio-interfaces Usage: The library provides various audio interfaces and processing blocks that can be used to build audio processing pipelines. Here are some examples:

  1. Basic Friend Recorder (examples/basic_friend_recorder.py): This example demonstrates how to use SocketReceiver, RechunkingBlock, SileroVad, and VoiceGate to record voice segments from a network stream. To run: python -m easy_audio_interfaces.examples.basic_friend_recorder File Network Transfer (examples/file_network_transfer.py): This example shows how to transfer audio files over a network using SocketStreamer and SocketReceiver. To run as a sender: python -m easy_audio_interfaces.examples.file_network_transfer sender input_file.wav --host localhost --port 8080 To run as a receiver: python -m easy_audio_interfaces.examples.file_network_transfer receiver output_file.wav --host 0.0.0.0 --port 8080 Main Components:
  2. 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.
  3. Processing Blocks: CollectorBlock: Collects audio samples for a specified duration. ResamplingBlock: Resamples audio to a different sample rate. 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. To use these components, you can create audio processing pipelines by chaining them together. For example: 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) This pipeline receives audio from a socket, rechunks it, resamples it to 16kHz, and saves it to a local file. For more detailed usage and API documentation, please refer to the docstrings in the source code or the generated API documentation.

Essential Extras

Based on the functinoality you require, you should consider installing with following extras: optional-dependencies = { stt = [ "faster-whisper", ], silero-vad = [ "torch", "torchaudio", ], bluetooth = [ "bleak", ], local-audio = [ "pyaudio", ] }

Installing in your project

You can install using uv: uv add "https://github.com/AnkushMalaker/python-audio-interfaces.git"

or with extras,

uv add "https://github.com/AnkushMalaker/python-audio-interfaces.git[local-audio]"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy_audio_interfaces-0.2.5.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy_audio_interfaces-0.2.5-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file easy_audio_interfaces-0.2.5.tar.gz.

File metadata

File hashes

Hashes for easy_audio_interfaces-0.2.5.tar.gz
Algorithm Hash digest
SHA256 8d11ee2717b2d5e2aff646c688e0778af9d02188f99e11e2888622305b711260
MD5 69e7dc78868c9f258c5004b9e8b71eac
BLAKE2b-256 fd90b5e2e9aa0a906885e1f5c6dd73a5b3905de7b06b50b2fc0dbf321d50407f

See more details on using hashes here.

File details

Details for the file easy_audio_interfaces-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for easy_audio_interfaces-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bddd68a8a7cb364b56a149e7300b592c1315966359e2f9ec4baedea26e1b72a3
MD5 c63129e4a2400cfe0bffe949c0efa5a8
BLAKE2b-256 233ed504233b888322cea892ee1aee16829fb5917386599cdd0b6f864b7d0293

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page