Skip to main content

Fast reading of all kind of audio files

Project description

audiofile on TravisCI audiofile's documentation on Read the Docs audiofile's MIT license

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.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


Download files

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

Source Distribution

audiofile-0.2.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

audiofile-0.2.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file audiofile-0.2.2.tar.gz.

File metadata

  • Download URL: audiofile-0.2.2.tar.gz
  • Upload date:
  • Size: 12.2 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

Hashes for audiofile-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6e83209075860dc7645fedfea4b9994d101f363729842cc3b819985a7e9e52ef
MD5 3474c6b32c3ce3d9c038dfd87747020a
BLAKE2b-256 31c6a718ec73332c394c81c66e123426e1f07b7e4e08557fe516ddc461031cb9

See more details on using hashes here.

File details

Details for the file audiofile-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: audiofile-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 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

Hashes for audiofile-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9bfb2ba3edaf7593db88e9fbd86132311b3bde879c99e9a35a560f2b5fc05a1
MD5 392333de2156557f9443fe0f076e2ed7
BLAKE2b-256 c35a7539455c9fa6ba41f70f71c385f532435d0d0ad981d98c7f9b10e8fb879a

See more details on using hashes here.

Supported by

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