Brief overview about some of the main python libraries which promote input and output of digital audio files.
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import Audio
import numpy as np
from _utils import *
from scipy.io import wavfile
%%time
try:
fs, x_scipy = wavfile.read('../_data/A4_cello01.wav')
x_scipy = x_scipy.astype(np.float32)
x_scipy /= np.abs(x_scipy).max(axis=0)
except:
print('Can not load audio!')
Wall time: 26 ms
audiovis(x_scipy, fs)
audio stereo
Audio(x_scipy.min(axis=1), rate=fs)
summary(x_scipy)
L R min: -0.9645 -0.9377 1st Quar: -0.2134 -0.1654 median: -0.0060 -0.0115 mean: -0.0017 -0.0016 3rd Quar: 0.1955 0.1379 max: 1.0000 1.0000 sigma: 0.3149 0.2663
%%time
spectrogram(x_scipy, fs=fs, ws=2048)
audio stereo