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.
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Version 0.2.4 (2020-08-31)
Fixed: CHANGELOG format for PyPI server
Version 0.2.3 (2020-08-31)
Fixed: catch SoxiError in audiofile.read()
Fixed: test for more advanced audio files like OPUS, AMR, …
Version 0.2.2 (2019-10-04)
Changed: switch to keep a changelog format
Changed: define package in setup.cfg
Version 0.2.1 (2019-05-02)
Fixed: module only package
Version 0.2.0 (2019-05-02)
Changed: improve documentation
Changed: switch to single audiofile.py module
Fixed: skip tests if download fails
Version 0.1.3 (2019-03-27)
Fixed: metadata samples and duration for MP3 files
Version 0.1.2 (2019-03-25)
Fixed: metadata for pypi.org
Version 0.1.1 (2019-03-25)
Fixed: license statement in PyPI package
Version 0.1.0 (2019-03-25)
Added: First public release
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.4.tar.gz
.
File metadata
- Download URL: audiofile-0.2.4.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e59a1104e47f79c43709b5600b4d18cf223b0f6ff419e76ad5dc635bf28ddd3 |
|
MD5 | 2a03e255ff88a571aa031672a0b59fe8 |
|
BLAKE2b-256 | 73cc6813a0b14c300f486aecd0d7a3b3ea589c911a1dcdbebc018553b4311459 |
File details
Details for the file audiofile-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: audiofile-0.2.4-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42afb0b59d7e283a2532ac92795ee4416714aad3db66c8f87723dcc5f4f61cf0 |
|
MD5 | 8556cdd16ebd7ad593408d4043dac8da |
|
BLAKE2b-256 | b87d84122c2ffcdeab0d2e9d88119b01d6780e3db707ebf54a39f7ea9dc1b88d |