October 2018
Intermediate to advanced
472 pages
10h 57m
English
Let's explore the dataset in detail. First, let's look into the audio file by reading it from the file and plotting it. To read the audio file, we will use the pysoundfile package with the following command:
pip install pysoundfile
Next, we will import the modules, read the audio files, and plot them with the following code block:
import soundfile as sfimport matplotlib.pyplot as pltdef plot_audio(audio): fig, axs = plt.subplots(4, 1, figsize=(20, 7)) axs[0].plot(audio[0]); axs[0].set_title('Raw Audio Signals') axs[1].plot(audio[1]); axs[2].plot(audio[2]); axs[3].plot(audio[3]); audio_list =[]for i in xrange(4): file_path = 'data/128684/911-128684-000{}.flac'.format(i+1) a, sample_rate = sf.read(file_path) audio_list.append(a) ...Read now
Unlock full access