#! /usr/bin/env python # -*- coding: utf-8 -*- """ Compare the speed of several methods for reading and loading a sound file. This file depends on the following packages: - audioread https://github.com/beetbox/audioread - librosa https://github.com/bmcfee/librosa - pydub https://github.com/jiaaro/pydub """ import numpy as np import aubio """ import audioread import librosa import scipy.io.wavfile from pydub import AudioSegment """ def read_file_audioread(filename): # taken from librosa.util.utils def convert_buffer_to_float(buf, n_bytes = 2, dtype = np.float32): # Invert the scale of the data scale = 1./float(1 << ((8 * n_bytes) - 1)) # Construct the format string fmt = '