Similarly to the previous answer, you can also checkout the audio classification tutorial 23 and update the line tensors += [waveform] in collate_fn to tensors += [transform(waveform)] where transform is whatever transform you want.
If your goal is to apply the transform, save the transformed waveform to disk to avoid recomputing it later, and then create a new dataset with this, then you could also try to cache dynamically your dataset using something like diskcache_iterator.