Exercise

Loading wav data

To work with any non-standard data using Dask bags, you will need to write a lot of functions yourself. For this task, you are analyzing audio data, and so you need a custom function to load it.

Some of the audio recordings failed, and the audio is silent in these. Regular audio data looks like a wave, where the amplitude goes to large positive and negative values. Therefore, to check if a recording is silent, you can check whether the audio clip has very small amplitudes overall.

The scipy.io.wavfile module has been imported into your environment as wavfile, and numpy has been imported as np.

Instructions

100 XP
  • Inside the load_wav() function, use wavfile.read() to load the audio data and sampling frequency.
  • Inside load_wav(), construct the returned dictionary.
  • Inside the not_silent() function, return a boolean of whether the 'audio' array inside the input dictionary has a mean absolute value of greater than 100, by using numpy's abs() and mean() functions.