How really @discord.js/voice receives audio?

I looked up the source code, but I really have no idea how he's handling that. I'm thankful for any kind of reply. I want to implement audio receiving in Koe.
27 Replies
d.js toolkit
d.js toolkit•12mo 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!
d.js docs
d.js docs•12mo ago
discord Voice Connections read more
ThePedroo
ThePedroo•12mo ago
In Discord API receiving audio is not documented. The most important part of voice receive is the parser, which parses the packets received by the udp connection
Fyphen
FyphenOP•12mo ago
Yeah, I already know that. I just want to know how Discord voice server sends packets to us and how discord.js receive that?
ThePedroo
ThePedroo•12mo ago
Well, all of those are made through the UDP connection created
Fyphen
FyphenOP•12mo ago
Yeah, I also know that. I WANT to know HOW Discord voice server sends packets to client? like JSON or raw rpc onUdpMessage?
ThePedroo
ThePedroo•12mo ago
Please don't act like that towards me, I'm only wanting to help. No, they are not JSONs, they are buffers, then you use readUInt*... to read them That'll be the function that is executed when a message is received
Fyphen
FyphenOP•12mo ago
Oh sorry Oh wait a sec
ThePedroo
ThePedroo•12mo ago
Yes?
Fyphen
FyphenOP•12mo ago
What calls onUdpMessage()?
Fyphen
FyphenOP•12mo ago
um
ThePedroo
ThePedroo•12mo ago
But tecnically everything comes from here ?
Fyphen
FyphenOP•12mo ago
Sorry sir
ThePedroo
ThePedroo•12mo ago
No need to sorry, I'm just confused of what you're confused This sounded very funny for some reason
Fyphen
FyphenOP•12mo ago
you confused due to what I'm confused lol
ThePedroo
ThePedroo•12mo ago
Yeah 🤣
Fyphen
FyphenOP•12mo ago
It comes for clients through WS right?
ThePedroo
ThePedroo•12mo ago
All information from the voice itself comes from UDP, none is transmitted by the websocket
Fyphen
FyphenOP•12mo ago
oh hum
Fyphen
FyphenOP•12mo ago
Actually, I want to receive audio in repo called Koe, which you can find here: https://github.com/KyokoBot/koe
GitHub
GitHub - KyokoBot/koe: Tiny and embeddable Discord media transport ...
Tiny and embeddable Discord media transport library based on Netty. - GitHub - KyokoBot/koe: Tiny and embeddable Discord media transport library based on Netty.
ThePedroo
ThePedroo•12mo ago
Oh, I know Koe From Lavalink 🤣
Fyphen
FyphenOP•12mo ago
Because I use Lavalink for my music bot. oh me too lol and I want to implement receiving audio but Koe does not support audio receiving so I wanna implement for myself but I'm really not sure how can I implement that in Java
ThePedroo
ThePedroo•12mo ago
Note that for voice sending a UDP connection is necessary, so you're only going to need to decrypt it* And the same libraries that are used to encrypt it are used to decrypt it
Fyphen
FyphenOP•12mo ago
tweetnacl-java
ThePedroo
ThePedroo•12mo ago
Yes, tweetnacl itself does have them In NodeJs the tweetnacl function is tweetnacl.secretbox, it must be similar in tweetnacl-java
Fyphen
FyphenOP•12mo ago
I think so
Want results from more Discord servers?
Add your server