STT

I would like to make a bot that listen to voice orders. Any idea how to ?
11 Replies
d.js toolkit
d.js toolkit13mo 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
Sykexz13mo ago
yes
Fyphen
Fyphen12mo ago
Hi, and actually I have a solution for this. Could you wait a little bit?
ThePedroo
ThePedroo12mo ago
You can receive the audio and then use some library that converts speech to text
ayman
aymanOP12mo ago
Sure
Fyphen
Fyphen12mo ago
Fyphen
Fyphen12mo 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
aymanOP12mo ago
Cant i exchange a buffer directly with out having to save ?
Fyphen
Fyphen12mo 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
ThePedroo12mo 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
aymanOP12mo ago
Alright I will try when I will be free
Want results from more Discord servers?
Add your server