Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
96a8a62
start by obsoleting VoiceNext
akiraveliara Sep 18, 2024
46ea60c
Squashed 'lib/libaerith/inc/dave/' content from commit 6e5ffbc1
akiraveliara Jun 6, 2025
89c22cb
Merge commit '46ea60c33670437abd5c972d66d37ac7ff15fe5b' as 'lib/libae…
akiraveliara Jun 6, 2025
ec541bb
merge master
akiraveliara Jun 6, 2025
154574c
remove the vnext project from the solution
akiraveliara Jun 6, 2025
f714bd9
push preliminary session binding code
akiraveliara Jun 7, 2025
1f73350
add Session::ProcessProposals
akiraveliara Jun 7, 2025
4c76392
add Session::GetMarshalledKeyPackage
akiraveliara Jun 7, 2025
1827887
wrap RosterMap and add bindings to c# for the remaining methods
akiraveliara Jun 7, 2025
69d40af
wrap the c++ into (relatively) usable c#
akiraveliara Jun 8, 2025
7fd252f
nulls mean "nothing of note happened" in this case
akiraveliara Jun 8, 2025
d71296f
remove the in-tree native in favour of dsharpplus/libkoana
akiraveliara Jun 13, 2025
8af34b1
retarget the MLS interop
akiraveliara Jun 16, 2025
1319b85
avoid the mistakes of our ancestors
akiraveliara Jun 16, 2025
f50b973
implement the sodium cryptors
akiraveliara Jun 19, 2025
3920c3b
add opus interop bindings
akiraveliara Jul 4, 2025
5f7ddac
Merge remote-tracking branch 'origin/master' into voice-rewrite
akiraveliara Jul 4, 2025
6546f99
implement the opus binding layer
akiraveliara Jul 22, 2025
08cf10b
rewrite the self-building guide
akiraveliara Jul 23, 2025
0c9719c
add audio buffer pooling capability
akiraveliara Aug 13, 2025
247d435
implement opus encoders and decoders
akiraveliara Aug 18, 2025
c617e67
added media transport service
RoniRaad Aug 18, 2025
68b541f
updated memory type for writing to media transport service.
RoniRaad Aug 18, 2025
c6916aa
Added xmldocs
RoniRaad Aug 18, 2025
bbbc1d1
Merge pull request #2363 from RoniRaad/voice-rewrite-features/media-t…
akiraveliara Aug 18, 2025
96349c1
add an e2ee session wrapper, move the udp transport code, throw out v…
akiraveliara Aug 18, 2025
b36df43
Initial commit for transport service.
RoniRaad Aug 18, 2025
5bc3555
Fixed naming convention and binary opCode parsing for DiscordTranspor…
RoniRaad Aug 18, 2025
5c8a990
Discord Transport Service cleanup.
RoniRaad Aug 18, 2025
50ae74f
Merge pull request #2364 from RoniRaad/voice-rewrite-features/transpo…
akiraveliara Aug 18, 2025
5b1be24
make the transport service stack DI-friendly and fix corelib build
akiraveliara Aug 18, 2025
e1f3059
Merge remote-tracking branch 'origin/master' into voice-rewrite
akiraveliara Aug 18, 2025
847985f
Initial implementation of dave negotiation handling.
RoniRaad Aug 26, 2025
cbc508c
Change constructor visibility and converted some constructors to regu…
RoniRaad Aug 26, 2025
fff212a
Moves voice related factories into a folder. Added some comments on v…
RoniRaad Aug 27, 2025
a552cbd
Added xml docs
RoniRaad Aug 28, 2025
64e3f86
Added sequence number handling
RoniRaad Aug 28, 2025
ce42c0a
Added xml comments. Added heartbeat interval handling. Added speaking…
RoniRaad Aug 30, 2025
f652070
Added more information to xml docs. Added concrete class for voice se…
RoniRaad Aug 30, 2025
8f87625
refactored VoiceState.IsSpeaking
RoniRaad Aug 30, 2025
15a3aee
Changed to use enums for opcodes
RoniRaad Aug 30, 2025
1c101e8
Organized voice models.
RoniRaad Aug 30, 2025
c06361d
Organized models for voice.
RoniRaad Aug 30, 2025
9ea8818
Minor class name changes.
RoniRaad Aug 30, 2025
abe4f52
Merge pull request #2367 from RoniRaad/voice-rewrite-features/handle-…
akiraveliara Aug 30, 2025
27035af
initial implementation of PCM writers
akiraveliara Sep 17, 2025
353ea0d
we also bundle openssl on macos
akiraveliara Sep 17, 2025
2621730
unfuck the buffer management of the pcm writers
akiraveliara Oct 18, 2025
ad4c059
the overflow buffers can use marginally less MemoryMarshal, as a treat
akiraveliara Oct 18, 2025
0b40b9e
refactor encoding to not require rtp data at encode time
akiraveliara Oct 29, 2025
b1a0e2c
shuffle namespaces
akiraveliara Oct 29, 2025
350e2a4
Merge remote-tracking branch 'origin/master' into voice-rewrite
akiraveliara Oct 29, 2025
b3e183a
merge master
akiraveliara Oct 29, 2025
6f87ea1
.net 10 and opus 1.6.0
akiraveliara Dec 19, 2025
85ddd0e
Merge branch 'master' into voice-rewrite
akiraveliara Dec 19, 2025
8c839d4
use opus' native 24-bit and float encoding support instead of normali…
akiraveliara Dec 19, 2025
fc10b46
update workflows to net10.0
akiraveliara Dec 19, 2025
cc468ee
update the test projects to net10.0 too
akiraveliara Dec 19, 2025
dffbff6
we don't have that type any more, no need to test it
akiraveliara Dec 19, 2025
0e5e34f
fix tests on net10.0
akiraveliara Dec 25, 2025
0b2e6c0
clean up VoiceConnection and DaveStateHandler
akiraveliara Dec 28, 2025
b2ccfec
null and real-time receiver implementation
akiraveliara Feb 23, 2026
394914b
a little safety, as a treat
akiraveliara Feb 23, 2026
a202a65
public receive API
akiraveliara Feb 25, 2026
a0acff9
Merge branch 'master' into voice-rewrite
akiraveliara Feb 25, 2026
1ba7442
centralize sending and receiving
akiraveliara Feb 27, 2026
645c345
implement IP discovery
akiraveliara Feb 28, 2026
13dba36
centralize transport a little and rip out old networking code
akiraveliara Mar 1, 2026
9d478af
Merge remote-tracking branch 'origin/master' into voice-rewrite
akiraveliara Mar 2, 2026
7db633c
Merge remote-tracking branch 'origin/master' into voice-rewrite
akiraveliara Mar 2, 2026
83609f5
implement vgw connecting logic
akiraveliara Mar 3, 2026
6198611
organize VoiceConnection
akiraveliara Mar 3, 2026
cb231eb
implement the main vgw loop
akiraveliara Mar 4, 2026
acd8c96
we don't actually use this type
akiraveliara Mar 4, 2026
a7a6c0b
we can also delete the old docs now
akiraveliara Mar 4, 2026
11ba305
resume/reconnect support, vgw close code support, some improvements t…
akiraveliara Mar 6, 2026
5a0560f
docs improvements and finishing touches to DAVE integration
akiraveliara Mar 6, 2026
4a89ea0
report errors and expose sending/receiving
akiraveliara Mar 7, 2026
ae03a59
fix wrong opus enum values
akiraveliara Mar 7, 2026
e84975d
squash bugs
akiraveliara Mar 7, 2026
0899125
use a more efficient mechanism for managing in-flight buffers
akiraveliara Mar 8, 2026
9a38c0c
model RTCP packets
akiraveliara Mar 9, 2026
b7b48ee
move audio handling into VoiceConnection
akiraveliara Mar 10, 2026
c959a62
squash bugs in disconnecting
akiraveliara Mar 10, 2026
17672d1
slice off binary MLS payloads at the correct point
akiraveliara Mar 10, 2026
526f25f
add our own user ID to the MLS roster
akiraveliara Mar 10, 2026
20feadf
bugfixes, round 3
akiraveliara Mar 12, 2026
cc59a39
provide a slightly more sophisticated channel for audio transmission
akiraveliara Mar 13, 2026
5a90bac
rework communication with audio receivers
akiraveliara Mar 21, 2026
694ff38
implement the new audio receiver model
akiraveliara Apr 4, 2026
72e40d8
default to the proper audio receiver
akiraveliara Apr 4, 2026
e8100f6
improve default receive behaviour
akiraveliara Apr 4, 2026
5c1ba19
rudimentary documentation for voice
akiraveliara Apr 4, 2026
231cbf9
Merge commit '703ed72b861c6f3e096f4f019d09735989a6853b' into voice-re…
akiraveliara Apr 4, 2026
fbc29a4
support bots self-muting and self-deafening
akiraveliara Apr 6, 2026
c48fea5
implement RTCP reporting
akiraveliara Apr 8, 2026
94281a7
expand sending/receiving docs
akiraveliara Apr 8, 2026
988e1df
voice bugfixes, round 4
akiraveliara Apr 9, 2026
67e5e4b
voice bugfixes, round 5
akiraveliara Apr 14, 2026
0bd4021
Merge commit '315e4db1d3b05de63d2d20edf2edfc1151749c1e' into voice-re…
akiraveliara Apr 14, 2026
aadab9c
Merge commit '3679bfa37a04991c89ebd716be35f5e60ceaee9c' into voice-re…
akiraveliara Apr 20, 2026
db6cd98
add metrics and decryption bugfixes
akiraveliara Apr 24, 2026
ff96407
specify correct sample count and pad too-short pcm submissions
akiraveliara Apr 28, 2026
d44f271
fix double arraypool return, missing flushes and incorrect rtp timescale
akiraveliara Apr 30, 2026
17908c7
fix incorrect max encrypted frame size
akiraveliara Apr 30, 2026
df00366
fix the send loop failing when attempting to send audio without local…
akiraveliara May 2, 2026
96a907a
fix dave state handling around sessions being emptied
akiraveliara May 2, 2026
17780be
don't waste bandwidth sending to an empty channel
akiraveliara May 8, 2026
1061cc1
record when a received audio frame fails decryption
akiraveliara May 10, 2026
0b7e709
add an ogg/opus audio writer
akiraveliara May 11, 2026
027e012
update copyright year
akiraveliara May 11, 2026
307b88a
fix disconnecting requiring the MUTE_MEMBERS permission
akiraveliara May 21, 2026
91ce1f7
make the channel id on voice state updates optional
akiraveliara May 21, 2026
1ee84d3
fix opus repacketizer crashing when using AudioType.Music
akiraveliara May 22, 2026
8876fc3
rip out infrastructure for 120ms packets, discord only supports 20ms
akiraveliara May 22, 2026
8a9f569
rip out repacketizer interop too
akiraveliara May 22, 2026
c9cadee
rip the repacketizer out of the encoder as well
akiraveliara May 22, 2026
08eaf67
handle being moved between channels
akiraveliara May 23, 2026
2ea34d4
line-wise staging, my nemesis
akiraveliara May 23, 2026
19254d8
document bitrate limitations and don't kill the main gateway when dis…
akiraveliara May 23, 2026
ba9e585
add a catchup loop to sending audio if we're delayed
akiraveliara May 30, 2026
d45ac8a
remove erroneous debug code
akiraveliara May 30, 2026
84ae4fc
track when we've caught back up to realtime
akiraveliara May 30, 2026
2abfbac
fix silence detection never recovering if audio is streamed in realtime
akiraveliara May 31, 2026
04e656c
make the audio sending loop more resistant to jittering
akiraveliara Jun 4, 2026
69037ea
remove a stray debug instruction
akiraveliara Jun 4, 2026
ef648de
improve codegen for widening mono to stereo
akiraveliara Jun 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
###############################
###############################
# Core EditorConfig Options #
###############################
root = true
Expand Down Expand Up @@ -56,15 +56,18 @@ dotnet_diagnostic.IDE0025.severity = error
dotnet_diagnostic.IDE0026.severity = error
dotnet_diagnostic.IDE0027.severity = error

# don't turn everything into ternary hell
dotnet_diagnostic.IDE0046.severity = none

# Suppress CS1591: Missing XML comment for publicly visible type or member
dotnet_diagnostic.CS1591.severity = suggestion

# Suppress IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

# Organize usings
dotnet_sort_system_directives_first = true:error
dotnet_separate_import_directive_groups = true:error
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = true

# Unfortunately, no java-style usings
dotnet_diagnostic.IDE0064.severity = none
Expand Down Expand Up @@ -176,7 +179,7 @@ csharp_style_throw_expression = true:error
csharp_style_conditional_delegate_call = true:error

# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:error

# Expression-level preferences
csharp_prefer_braces = true:error
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9
dotnet-version: 10
- name: Package Project
run: |
dotnet pack -c Release -o build -p:Alpha=${{ github.run_number }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9
dotnet-version: 10
- name: Build Project
run: dotnet build
- name: Test Changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9
dotnet-version: 10
- name: Build Project
run: dotnet build
- name: Test Changes
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9
dotnet-version: 10
- name: Build Project
run: dotnet build
package-commit:
Expand All @@ -38,7 +38,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
dotnet-version: 10
- name: Package Project
run: |
dotnet pack -c Release -o build
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Ignore Visual Studio temporary files, build results, and
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
Expand Down Expand Up @@ -31,6 +31,8 @@ bld/
[Oo]bj/
[Ll]og/
[Ll]ogs/
[Tt]arget/
[Bb]uild/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
112 changes: 27 additions & 85 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,27 @@
# Building DSharpPlus

These are detailed instructions on how to build the DSharpPlus library under various environmnets.

It is recommended you have prior experience with multi-target .NET Core/Standard projects, as well as the `dotnet` CLI utility, and MSBuild.

## Requirements

In order to build the library, you will first need to install some software.

### Windows

On Windows, we only officially support Visual Studio 2017 15.3 or newer. Visual Studio Code and other IDEs might work, but are generally not supported or even guaranteed to work properly.

* **Windows 10** - while we support running the library on Windows 7 and above, we only support building on Windows 10.
* [**Git for Windows**](https://git-scm.com/download/win) - required to clone the repository.
* [**Visual Studio 2017**](https://www.visualstudio.com/downloads/) - community edition or better. We do not support Visual Studio 2015 and older. Note that to build the library, you need Visual Studio 2017 version 15.3 or newer.
* **Workloads**:
* **.NET Framework Desktop** - required to build .NETFX (4.5, 4.6, and 4.7 targets)
* **.NET Core Cross-Platform Development** - required to build .NET Standard targets (1.1, 1.3, and 2.0) and the project overall.
* **Individual Components**:
* **.NET Framework 4.5 SDK** - required for .NETFX 4.5 target
* **.NET Framework 4.6 SDK** - required for .NETFX 4.6 target
* **.NET Framework 4.7 SDK** - required for .NETFX 4.7 target
* [**.NET Core SDK 2.0**](https://www.microsoft.com/net/download) - required to build the project.
* **Windows PowerShell** - required to run the build scripts. You need to make sure your script execution policy allows execution of unsigned scripts.

### GNU/Linux

On GNU/Linux, we support building via Visual Studio Code and .NET Core SDK. Other IDEs might work, but are not supported or guaranteed to work properly.

While these should apply to any modern distribution, we only test against Debian 10. Your mileage may vary.

When installing the below, make sure you install all the dependencies properly. We might ship a build environmnent as a docker container in the future.

* **Any modern GNU/Linux distribution** - like Debian 9.
* **Git** - to clone the repository.
* [**Visual Studio Code**](https://code.visualstudio.com/Download) - a recent version is required.
* **C# for Visual Studio Code (powered by OmniSharp)** - required for syntax highlighting and basic Intellisense
* [**.NET Core SDK 2.0**](https://www.microsoft.com/net/download) - required to build the project.
* [**Mono 5.x**](http://www.mono-project.com/download/#download-lin) - required to build the .NETFX 4.5, 4.6, and 4.7 targets, as well as to build the docs.
* [**PowerShell Core**](https://docs.microsoft.com/en-us/powershell/scripting/setup/Installing-PowerShell-Core-on-macOS-and-Linux?view=powershell-6) - required to execute the build scripts.
* **p7zip-full** - required to package docs.

## Instructions

Once you install all the necessary prerequisites, you can proceed to building. These instructions assume you have already cloned the repository.

### Windows

Building on Windows is relatively easy. There's 2 ways to build the project:

#### Building through Visual Studio

Building through Visual Studio yields just binaries you can use in your projects.

1. Open the solution in Visual Studio.
2. Set the configuration to Release.
3. Select Build > Build Solution to build the project.
4. Select Build > Publish DSharpPlus to publish the binaries.

#### Building with the build script

Building this way outputs NuGet packages, and a documentation package. Ensure you have an internet connection available, as the script will install programs necessary to build the documentation.

1. Open PowerShell and navigate to the directory which you cloned DSharpPlus to.
2. Execute `.\rebuild-all.ps1 -configuration Release` and wait for the script to finish execution.
3. Once it's done, the artifacts will be available in *dsp-artifacts* directory, next to the directory to which the repository is cloned.

### GNU/Linux

When all necessary prerequisites are installed, you can proceed to building. There are technically 2 ways to build the library, though both of them perform the same steps, they are just invoked slightly differently.

#### Through Visual Studio Code

1. Open Visual Studio Code and open the folder to which you cloned DSharpPlus as your workspace.
2. Select Build > Run Task...
3. Select `buildRelease` task and wait for it to finish.
4. The artifacts will be placed in *dsp-artifacts* directory, next to whoch the repository is cloned.

#### Through PowerShell

1. Open PowerShell (`pwsh`) and navigate to the directory which you cloned DSharpPlus to.
2. Execute `.\rebuild-all.ps1 -configuration Release` and wait for the script to finish execution.
3. Once it's done, the artifacts will be available in *dsp-artifacts* directory, next to the directory to which the repository is cloned.
# Building DSharpPlus

DSharpPlus, for the most part, is just like any other `dotnet` library. You will need the latest .NET SDK installed, either explicitly or bundled by the latest version of your IDE, and you will need to simply run `dotnet build`, `dotnet publish` or `dotnet pack` depending on whether you aim to create a dev-time build, prod builds or local package files.

Optionally, DSharpPlus can use zstd for its gateway compression and sodium for receiving [interactions](https://discord.com/developers/docs/interactions/overview#preparing-for-interactions) or [other events](https://discord.com/developers/docs/events/webhook-events). Both of those libraries are provided for platforms `{win, osx, linux, linux-musl}-{x64, arm64}` via the NuGet packages `DSharpPlus.Natives.Zstd` and `DSharpPlus.Natives.Sodium`. On other operating systems or other CPU architectures, you have to provide the libraries yourself.

DSharpPlus does not support NativeAOT compilation or trimming.

---

## DSharpPlus.Voice

DSharpPlus' voice implementation is a bit more finicky. On platforms `{win, osx, linux, linux-musl}-{x64, arm64}`, the necessary native libraries are provided for you by DSharpPlus. On other operating systems or other CPU architectures, including but not limited to 32-bit platforms, mobile operating systems or RISC-V, you have to build the libraries yourself:

- [Sodium](https://github.com/jedisct1/libsodium) is unmodified and may be provided by whatever mechanism your platform provides. You may receive a warning on startup that AES-256 GCM is not supported on certain platforms or CPUs, but DSharpPlus.Voice will function regardless - albeit with limitations.
- [SpeexDSP](https://github.com/xiph/speexdsp) is unmodified and may be provided by whatever mechanism your platform provides.
- [Opus](https://github.com/xiph/opus) is modified and must be self-built from https://github.com/dsharpplus/opus. Please follow the opus build instructions for your platform and place the shared library file (.dll, .so, .dylib) in the same directory as your bot.
- [Koana](https://github.com/dsharpplus/libkoana) is a heavily stripped-down and slightly modified fork of [DPP's E2EE implementation](https://github.com/brainboxdotcc/dpp) and must be self-built.
- First, you must provide OpenSSL **3.x** on your system, either building it or installing the **development** package. Merely installing OpenSSL libraries is insufficient. Before continuing, make sure you have the header files and **static** OpenSSL libraries on your system.
- Second, build koana itself, using your platform's mechanism to create a release build using cmake. Koana will attempt to detect OpenSSL in common locations, but you may have to provide it using the following arguments to cmake: `-DOPENSSL_ROOT_DIR=path`, `-DOPENSSL_CRYPTO_LIBRARY=path/to/libcrypto`, `-DOPENSSL_SSL_LIBRARY=path/to/libssl`, `-DOPENSSL_INCLUDE_DIR=path/to/headers`. Note that you must provide all four of them.
- Third, place the shared library file (.dll, .so, .dylib) in the same directory as your bot.
- Fourth, if you built OpenSSL yourself, you may have to provide libcrypto to your bot as well, in the same way.

We may not accept bug reports only reproducible on unsupported platforms, and we may not be able to help with building for unsupported platforms. General experience with using cmake is highly recommended.

>[!NOTE]
> Our native builds for x86-64 target `x86-64-v2`, which is any CPU that supports SSE4.2, LAHF-SAHF, POPCNT and CMPXCHG16B at the very least, or any Intel/AMD CPU built after 2008. If you are using an older CPU that does not support these features, you will also need to self-build the natives according to the above instructions. Additionally, you must remove the native libraries provided by DSharpPlus, since they will be incompatible with your CPU.
Loading
Loading