sensein / b2aiprep

Apache License 2.0
5 stars 6 forks source link

from_file in process.Audio dimension issue #4

Closed Rahul-Brito closed 5 months ago

Rahul-Brito commented 5 months ago

https://github.com/sensein/b2aiprep/blob/ac73e7b1cf043415d2bec1a2338755c1199b9ce6/src/b2aiprep/process.py#L34

When I run from_file on data/test_audio.wav I get the error:

IndexError: too many indices for tensor of dimension 1

Since the signal that gets loaded only has one dimension. Is this a data issue or is the code handling the situation incorrectly?

satra commented 5 months ago

i thought i checked two types of files. but this is where tensor shapes on different channel data can be different. if you simply load it what does the shape look like?

i would change that to:

if len(signal.shape) > 1 and ...
    ...
else:
    signal = signal[:, None]
Rahul-Brito commented 5 months ago

That audio looks like this:

image

It was a mono 44khz audio I recorded in audacity.

I can make the change