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 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!
d.js docs
d.js docs13mo ago
discord Voice Connections read more
ThePedroo
ThePedroo13mo 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
FyphenOP13mo 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
ThePedroo13mo ago
Well, all of those are made through the UDP connection created
Fyphen
FyphenOP13mo 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
ThePedroo13mo 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
FyphenOP13mo ago
Oh sorry Oh wait a sec
ThePedroo
ThePedroo13mo ago
Yes?
Fyphen
FyphenOP13mo ago
What calls onUdpMessage()?
Fyphen
FyphenOP13mo ago
um
ThePedroo
ThePedroo13mo ago
But tecnically everything comes from here ?
Fyphen
FyphenOP13mo ago
Sorry sir
ThePedroo
ThePedroo13mo ago
No need to sorry, I'm just confused of what you're confused This sounded very funny for some reason
Fyphen
FyphenOP13mo ago
you confused due to what I'm confused lol
ThePedroo
ThePedroo13mo ago
Yeah 🤣
Fyphen
FyphenOP13mo ago
It comes for clients through WS right?
ThePedroo
ThePedroo13mo ago
All information from the voice itself comes from UDP, none is transmitted by the websocket
Fyphen
FyphenOP13mo ago
oh hum
Fyphen
FyphenOP13mo 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
ThePedroo13mo ago
Oh, I know Koe From Lavalink 🤣
Fyphen
FyphenOP13mo 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
ThePedroo13mo 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
FyphenOP13mo ago
tweetnacl-java
ThePedroo
ThePedroo13mo ago
Yes, tweetnacl itself does have them In NodeJs the tweetnacl function is tweetnacl.secretbox, it must be similar in tweetnacl-java
Fyphen
FyphenOP13mo ago
I think so
Want results from more Discord servers?
Add your server