#! /usr/bin/env python # -*- coding: utf-8 -*- """ Compare the speed of several methods for reading and loading a sound file. Optionally, this file can make use of the following packages: - audioread https://github.com/beetbox/audioread - scipy https://scipy.org - librosa https://github.com/bmcfee/librosa - pydub https://github.com/jiaaro/pydub Uncomment the function names below and send us your speed results! """ test_functions = [ "read_file_aubio", "load_file_aubio", #"load_file_scipy", #"load_file_scipy_mmap", #"read_file_audioread", #"load_file_librosa", #"read_file_pydub", #"load_file_pydub", ] import numpy as np def read_file_audioread(filename): import audioread # 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 = '