STT

I would like to make a bot that listen to voice orders. Any idea how to ?
11 Replies
d.js toolkit
d.js toolkit9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Sykexz
Sykexz9mo ago
yes
Fyphen
Fyphen8mo ago
Hi, and actually I have a solution for this. Could you wait a little bit?
ThePedroo
ThePedroo8mo ago
You can receive the audio and then use some library that converts speech to text
ayman
ayman8mo ago
Sure
Fyphen
Fyphen8mo ago
Fyphen
Fyphen8mo ago
voiceConnection can be replaced with d.js voiceConnection class and you must join the channel while not deafend bot* and you have to download vosk model and put it in /vosk-model and creating rec folder is also needed If you not want to use vosk, you can use Google STT instead
ayman
ayman8mo ago
Cant i exchange a buffer directly with out having to save ?
Fyphen
Fyphen8mo ago
yeah of course u can
const fs = rewquire("fs");

fs.unlinkSync(`${filename}.pcm`);
fs.unlinkSync(`${filename}.wav`);
const fs = rewquire("fs");

fs.unlinkSync(`${filename}.pcm`);
fs.unlinkSync(`${filename}.wav`);
and the above code is not needed cuz in the code we do not write any to disk mainly, it receives PCM audio, and passes it to prism media's encoder to convert it to wav stream and passes it to vosk (voice recognizer) and receive the final result
ThePedroo
ThePedroo8mo ago
Avoid relying on IO as much as possible, as it's slower than most other operations To read the file later it will end up creating a stream, a buffer
ayman
ayman8mo ago
Alright I will try when I will be free