audiotools icon indicating copy to clipboard operation
audiotools copied to clipboard

signal.loudness() fails for signals with channels > 5

Open hugofloresgarcia opened this issue 11 months ago • 0 comments

>>> import audiotools as at
>>> sig = AudioSignal.wave(100, 1.0, 44100, num_channels=6, shape='sine')
>>> sig = at.AudioSignal.wave(100, 1.0, 44100, num_channels=6, shape='sine')
/home/hugo/descript/audiotools/audiotools/core/audio_signal.py:376: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  wave_data = torch.tensor(wave_data, dtype=torch.float32)
>>> sig.loudness()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hugo/descript/audiotools/audiotools/core/loudness.py", line 313, in loudness
    loudness = meter.integrated_loudness(self.audio_data.permute(0, 2, 1))
  File "/home/hugo/descript/audiotools/audiotools/core/loudness.py", line 215, in integrated_loudness
    l = -0.691 + 10.0 * torch.log10((G[None, :nch, None] * z).sum(1, keepdim=True))
RuntimeError: The size of tensor a (5) must match the size of tensor b (6) at non-singleton dimension 1

hugofloresgarcia avatar Aug 28 '23 21:08 hugofloresgarcia