Fast reading of all kind of audio files
Project description
The python package audiofile provides a meta package to handle all kind of audio files under Python with a focus on reading speed.
Documentation: https://audiofile.readthedocs.io/
Installation
It is recommended to first create a Python virtual environment using a tool like virtualenv, e.g.
virtualenv --python=/usr/bin/python3 --no-site-packages _env
source _env/bin/activate
Afterwards install audiofile with
pip install audiofile
In order to handle all possible audio files, please make sure ffmpeg and mediainfo are installed on your system.
If you want to use Python 2.7 make sure you install the following backports package as well:
pip install backports.tempfile
Usage
Import the package and use it to write or read an audio file, or get information about its metadata:
import numpy as np
import audiofile as af
sampling_rate = 8000 # in Hz
noise = np.random.normal(0, 1, sampling_rate)
noise /= np.amax(np.abs(noise))
af.write('noise.wav', noise, sampling_rate)
af.channels('noise.wav')
af.duration('noise.wav')
sig, fs = af.read('noise.wav')
It should work with every audio file you will work with. WAV, FLAC, and OGG files are handled by soundfile. The reading of all other audio files is managed by converting them to a temporary WAV file by pysox or ffmpeg, which means it can handle audio from video files as well.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file audiofile-0.2.0.tar.gz
.
File metadata
- Download URL: audiofile-0.2.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e04399a63c567165d5c74027ce4965fa066ce612b9035ce97de0d0c15775509 |
|
MD5 | 068f28d561205f0445ee6fbbb5360366 |
|
BLAKE2b-256 | 0b498d6b15c83232cc52eb717ebb4fab784c7207512fd9137558aeef18612baf |
File details
Details for the file audiofile-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: audiofile-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af98915432bfe3ffc4a3eb04ee9a7b8a61cbb19d2a164cac0af5c2658962e83c |
|
MD5 | 1c074e032f3c24ea3fd3d2db6dce6b48 |
|
BLAKE2b-256 | fadc942d4a67e12fc2c289252e4ed8ad698b449ca256281c35d7db6cfcb7975b |