Reinforcing your learning
The key objectives of the
_audio_transform() helper function are selecting a random clip, performing the augmentation using the Audiomentations library function, displaying the WaveForm graph using the
_draw_audio() helper functions, and showing the audio play button. The key code lines are as follows:
# code snippet, use Pandas to select a random/sample record p = df.sample(dsize) # fetch the audio data data_amp, sam_rate, fname = self._fetch_audio_data(lname) # do the transformation xaug = xtransform(data_amp, sample_rate=sam_rate) # display the Waveform graphs and the audio play button self._draw_audio(xaug, sam_rate, title + ' Augmented: ' + fname) display(IPython.display.Audio(xaug, rate=sam_rate))
The full function’s code can be found in the Python Notebook. Pluto will write the Python wrapper functions for audio augmentation in the same order as previously discussed. In particular, they are as follows:...