In [1]:
import torchaudio
import torch
import waloviz as wv

wv.extension()
No description has been provided for this image No description has been provided for this image
In [2]:
def envelope(wav, sr):
    return torch.nn.functional.max_pool1d(wav.abs(), 1001, 500, padding=500)

wav, sr = torchaudio.load("https://catalog.ldc.upenn.edu/desc/addenda/LDC97S42.sph")
wv.Audio((wav[:, sr*5:sr*10], sr), {"envelope": envelope}, minimal=True)
Out[2]:

👆⬆️ Press to Play the Audio sample! ⬆️👆¶