savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.39k stars 128 forks source link

Discord input in liquidsoap #462

Open Yamakaky opened 7 years ago

Yamakaky commented 7 years ago

I'm working on a bridge between Discord voice chat and liquidsoap. The Discord server doesn't do the mixing. Each client receives a stream of PCM frames with an id indicating the user speaking in this frame. That way, a client can mute an other user, for example. I would like to use a Discord channel as input for liquidsoap. How would you handle that? Bonus point if it's possible to control the volume of the audio from each user. Keep in mind that users can connect and deconnect at will.

There isn't a library wrapper in ocaml, so I plan to do it in Rust.

Example of wrapper for the audio API: https://docs.rs/discord/0.8.0/discord/voice/trait.AudioReceiver.html

toots commented 7 years ago

Hi,

It is unfortunate that the Discord library does not have a C client.. Since there is a Javascript implementation, have you tried at using input.harbor as the input sources? input.harbor can accept websockets connections coming from a web browsers, as demonstrated here: https://github.com/webcast/webcast.js. Full client is available here: https://github.com/webcast/webcaster

Yamakaky commented 7 years ago

Hum, interesting... How would the mixing be, then?

toots commented 7 years ago

Well, input.harbor behave as regular source so you can then use the liquidsoap script operators to mix it.

Another option could be to let the JS UI mix the streams, just like it is currently done in the webcaster client between microphone and playlists.