Skip to content

irgendwr/audio2numpy

 
 

Repository files navigation

audio2numpy

Build Status

Description

audio2numpy load an audio file and directly ouputs the audio data as a numpy array and its sampling rate. Supports .wav, .aiff via python's standard library, and other formats via ffmpeg.

Installation

Using pip:

pip install git+https://github.com/irgendwr/audio2numpy

FFmpeg for decoding mp3

audio2numpy requires ffmpeg to decode mp3 files. You would need to install ffmpeg in order to have mp3 support.

macOS

homebrew install ffmpeg

Linux

  • Debian/Ubuntu: sudo apt-get install ffmpeg
  • Arch: sudo pacman -S ffmpeg

Check here for other installation methods for different Linux distributions.

Windows

  1. Download ffmpeg
  2. Extract it into a folder, for example C:\FFmpeg
  3. Add the ffmpeg bin folder to your PATH Environment Variable.

Here is a guide that explains the process in detail.

Colab

!apt install ffmpeg

Usage

from audio2numpy import open_audio
path = "./examples/word.mp3"
signal, sampling_rate = open_audio(path)

Version History

0.1.4 (09.09.2021)

0.1.3 (17.10.2019)

  • Add Colab ffmpeg installation guide.
  • Remove ffmpeg from requirements.txt. Users should install it separately

0.1.2 (20.08.2019)

Add instructions to install ffmpeg if load mp3 failed with ffmpeg backend not available.

0.1.1 (14.08.2019)

Initial release.

About

load audio files into numpy array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%