In [4]:
import torchaudio
import torch
import waloviz as wv
wv.extension()
In [7]:
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[7]: