Torchaudio.load ignores normalize=False for 8 bit ulaw

According to the docs, torchaudio.load(normalize=False) shouldn’t convert to floats when loading wav files. But it appears to ignore normalize=False when the file uses 8 bit mu-law encoding:

audio = torch.sin(2 * torch.pi * torch.linspace(0, 1, 100))'temp.wav', audio[None, :], format='wav', encoding='ULAW', bits_per_sample=8, sample_rate=16_000)
info ='temp.wav')
print(info) # sample_rate=16000, num_frames=100, num_channels=1, bits_per_sample=8, encoding=ULAW
data = torchaudio.load('temp.wav', normalize=False)
print(data[0].dtype) # torch.float32 ?! expected uint8

Testing with torchaudio.__version__ == 0.13.1+cu116

Hi @robz, I can reproduce the issue.
To broadcast it to torchaudio maintainers, could you post it to the GitHub issue page? Sign in to GitHub · GitHub


1 Like

Sure thing, posted here: Torchaudio.load ignores normalize=False for 8 bit ulaw · Issue #3256 · pytorch/audio · GitHub

1 Like