tensorflow/io

`tfio.audio.decode_flac` returns an empty tensor

diffunity opened this issue · 1 comments

Description

I am trying to use tfio to load flac files, but am currently running into issues. I am using the audio files from the project peoples-speech. I initially intended to use librosa (which on the inside calls soundfile when loading flac files), but due to the error code below (referred to as librosa error), I was forced to use tfio. Using tfio ultimately returns an empty tensor, without raising any errors. What may be the cause of this, and is it supposed to not return any errors?

(loading using torchaudio works)

librosa error
ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size

Reproduce

>>> import torchaudio
>>> import tensorflow as tf
>>> import tensorflow_io as tfio
>>> audio = torchaudio.load("./FILE.flac")
>>> audio
(tensor([[ 0.0024,  -0.0010,  -0.0027,   ...,  0.0027,  0.0021,  0.0013]]),  16000)
>>> audio_read = tf.io.read_file("./FILE.flac")
>>> audio = tfio.audio.decode_flac(audio_read, dtype=tf.int16) # nothing other than this dtype argument works
>>> audio
<tf.Tensor: shape=(0, 1), dtype=int16, numpy=array([], shape=(0, 1), dtype=int16)>

Resolved