I'm trying to pull some audio files into Tensorflow by using tf.audio.decode_wav
.
I can see someone is looking into providing more info in the docs, but does anyone have any examples of how this should work?
tf.audio.decode_wav(
contents,
desired_channels=-1,
desired_samples=-1,
name=None
)
Args:
I'm guessing the contents is a tensor which has already been pulled from a file rather than a path?
You're right, tf.audio.decode_wav()
requires a tensor. You can provide one with
tf.io.read_file()
which reads wav file into tensor of type string.
raw_audio = tf.io.read_file(filename)
waveform = tf.audio.decode_wav(raw_audio)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With