#! /usr/bin/env python # -*- coding: utf-8 -*- """ Compare the speed of several methods for reading and loading a sound file. This file depends on audioread and librosa: https://github.com/beetbox/audioread https://github.com/bmcfee/librosa """ import numpy as np import aubio import audioread import librosa 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 = '