Use audio stream as an audio input in ml5.js

106 Views Asked by At

I need to use ml5.js for recognition of an audio to detect if the voice is from an animal (like bark or meow) or a background noise.

Everything works, but I would like to know if is possible to use an audio instead of granting microphone access and try to listen to the audio and detect.

I've looked in ml5 docs but I didn't find anything. I've tried to look in ml5 source too but I didn't find nothing.

If someone has a solution, please let me know by sending me a doc. Thanks.

1

There are 1 best solutions below

0
Kokodoko On

You'd have to look into the actual tensorflowjs source. ML5 is just a wrapper for tensorflow.js!

https://www.tensorflow.org/js

The tensorflow docs say you CAN use a spectogram (a Float32Array) to classify sound. That means you have to create that spectogram from your audio file (a .wav file) yourself.

Spectogram documentation