#Getting user's speaking data that are connected to the same voice channel as the bot.

10 messages · Page 1 of 1 (latest)

candid portal
#

Hi! I am trying to make a speech to text bot but i have difficulties to get speaking data... i have almost everything i want but cannot get something working like voiceConnection.on("speaking", ...) or anything like this. If a bot is in a voice channel how can i add the functionality of getting each speaking user's voice data/packets? Is it even possible? I am trying to figure it out but cannot find a way...

"dependencies": {
"@discordjs/voice": "^0.16.0",
"discord.js": "^14.11.0",
"ibm-watson": "^8.0.0"
}

graceful siloBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Explain what exactly your issue is.
  • Not a discord.js issue? Check out #useful-servers.
  • Issue solved? Press the button!
candid portal
#

Also i am on Ubuntu 22.04.2 LTS

candid portal
#

but i don't know what else and how to exactly...

stable orbit
#

<VoiceConection>.receiver.subscribe(<userId>) returns an opus packet stream for the given user
this can be decoded to pcm with the opus.Decoder class from prism-media (which is a dependency of @discordjs/voice)
you can detect when a user starts and stops speaking with the start and stop events on <VoiceConnection>.receiver.speaking
https://discord.js.org/docs/packages/voice/0.16.0/VoiceReceiver:Class#subscribe
https://amishshah.github.io/prism-media/opus.Decoder.html
https://discord.js.org/docs/packages/voice/0.16.0/SpeakingMap:Class#on

candid portal
#

Thank you! I'll keep this open until i try the things you said.

candid portal
#

With the information i managed to get buffers when talking. Is there a "free" speech to text service (that converts hungarian speech) that i could use? If yes how should I? Should i concat the buffers into one and send it on speaking stop or should i send the buffer stream as it comes?