eoryl / DiscordAudioStream

An audio streaming tool for Discord based on Discord.net and NAudio
MIT License
10 stars 2 forks source link
audio csharp discord

DiscordAudioStream

A simple tool for Windows to stream audio on Discord: stream what you are playing or recording on your computer to a Discord voice channel at higher quality audio via a secondary bot connection.

alt text

Video (in French) on how to setup and configure the tool https://www.youtube.com/watch?v=D8GaGncp84o And another one on how to use it https://www.youtube.com/watch?v=Dm1fqSWtyho

Setup

System level audio configuration

Application settings

FAQ

Usually that means you have not set your bot token. See the Setup section for instructions on how to create your bot token. This could also mean your token is already in use by another instance of DiscordAudioStream. Don't run multiple DiscordAudioStream with the same token and don't share your key it's private and should remain secret only known to you.

Once you have created the bot and its token you must add it to your server and grant it right to list, connect and talk on the voice channel. This means somebody with the "manage server" role must add it to the server. See above in setup

The most compatible mode is probably MME. The most performant is WASAPI but it requires settings the device sample rate to 48kHz (see above).

That's because you are in WASAPI mode. Discord expcets 48kHz audio and there is no real time sample rate conversion in that mode. In Windows go to Settings > Sounds > Sound Control Pannel > Recording|Playback > your card endpoint > Properties > Advanced and set 48khz (ideally 16bit stereo). If your card does't support it switch to MME.

MME capture mode, 100ms capture buffer, Mixed content, 96kbps, 15% packet loss, 1000 ms network buffer.

WASAPI capture mode, 40ms capture buffer, Music content, 128kbps, 20% packet loss, 200 ms or less network buffer.

Discord API won't allow it on regular servers. Non boosted servers are in fact defaulted at 64kbps and capped at 96kbps, but stream via the bot connection can go up to 128kbps. Higher bitrate could be possible. But not test have been done sor far. According to xiph.org tests (https://opus-codec.org/comparison/) after 96kbps you are already past the point of dimnishing returns for the Opus codec anyway.

There are no file based logs at the moment but you can get some logs with debugview (https://docs.microsoft.com/en-us/sysinternals/downloads/debugview).

Check the setup instructions about prerequisites.

Check the setup instructions about prerequisites. More specifically Visual C++ 2019 x86 redist. That's when libsodium and opus.dll are used they are the ones that depend on the VC++ redist.

Maybe something isn't right in the config. Just delete %APPDATA%\Local\DiscordAudioStream (C:\Users\\\AppData\Local\DiscordAudioStream) and reset your bot token and other params.

Only tested on up to date Windows 10 64bit. Althought it should work on Windows 10 32bit as the app runs in 32 bit mode. Windows 7 should also be supported as well but is untested.

Compiling

Compilation should work without tinkering using visual studio 2019 with .Net desktop development workload. Note some nugets and their repsective dependencies are required :

Visual studio should resolve all for you.

After compilation add the dependencies dlls (32bit version) opus.dll and libsodium.dll in the bin/[profile] folder

If you want to recompile them as well instead of using the provided ones, source code is available on their respective website:

Alternatives