Skip to content

feat: add text-first voice implementation - #767

Open
PanicIsReal wants to merge 2 commits into
ayn2op:mainfrom
PanicIsReal:pr/voice-implementation
Open

PanicIsReal wants to merge 2 commits into
ayn2op:mainfrom
PanicIsReal:pr/voice-implementation

Conversation

@PanicIsReal

@PanicIsReal PanicIsReal commented Mar 7, 2026

Copy link
Copy Markdown

Summary

  • add a text-first voice panel that shows the current voice channel, participant state, connection state, and inline errors
  • add the voice manager, audio capture/playback, Opus codec, and mixer plumbing needed for Discord voice support
  • add voice-related hotkeys in both the guild tree and active voice state
  • document source-build dependencies for voice on macOS, Windows, and Linux
  • remove the tracked voice_debug.log artifact and ignore future local voice/firebase debug logs

New hotkeys

  • Guild tree:
    • v show users for the selected voice channel
    • V hide users for the selected voice channel
    • a show users for all visible voice channels
    • A hide users for all visible voice channels
  • Active voice session:
    • m toggle mute
    • M toggle deafen
    • q leave voice

Testing

  • macOS: go test ./... and go build ./... pass locally on Apple Silicon macOS with CGO_ENABLED=1
  • macOS dependencies present during validation:
    • portaudio 19.7.0
    • opus 1.6.1
  • Windows and Linux still require runtime testing for the voice path

Source build dependencies

  • macOS: brew install portaudio opus
  • Windows (MSYS2): pacman -S --needed mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf mingw-w64-ucrt-x86_64-portaudio mingw-w64-ucrt-x86_64-opus
  • Linux:
    • Debian/Ubuntu: sudo apt install build-essential pkg-config portaudio19-dev libopus-dev
    • Fedora: sudo dnf install gcc pkgconf-pkg-config portaudio-devel opus-devel
    • Arch: sudo pacman -S --needed base-devel pkgconf portaudio opus

DAVE is required for the encryption.

git clone https://github.com/discord/libdave.git
cd libdave
git submodule update --init --recursive
cd cpp
./vcpkg/bootstrap-vcpkg.sh
make install

export PKG_CONFIG_PATH="$PWD/build/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CGO_CFLAGS="-I$PWD/build/install/include"
export CGO_LDFLAGS="-L$PWD/build/install/lib"

@PanicIsReal
PanicIsReal force-pushed the pr/voice-implementation branch 2 times, most recently from d818cd1 to 95a7766 Compare March 7, 2026 18:23

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af0896a404

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/ui/chat/view.go Outdated
Comment thread internal/ui/chat/guilds_tree.go
@PanicIsReal
PanicIsReal force-pushed the pr/voice-implementation branch from 95a7766 to bbf95ad Compare March 7, 2026 18:24
@ossenthusiast

Copy link
Copy Markdown
Collaborator

How do I get dave?

# github.com/disgoorg/godave/libdave
# [pkg-config --cflags  -- dave]
Package dave was not found in the pkg-config search path.
Perhaps you should add the directory containing `dave.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dave' not found

@PanicIsReal

PanicIsReal commented Mar 7, 2026

Copy link
Copy Markdown
Author

github.com/disgoorg/godave/libdave
[pkg-config --cflags -- dave]
Package dave was not found in the pkg-config search path.
Perhaps you should add the directory containing `dave.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dave' not found

git clone https://github.com/discord/libdave.git
cd libdave
git submodule update --init --recursive
cd cpp
./vcpkg/bootstrap-vcpkg.sh
make install

export PKG_CONFIG_PATH="$PWD/build/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CGO_CFLAGS="-I$PWD/build/install/include"
export CGO_LDFLAGS="-L$PWD/build/install/lib"

DAVE is required for the encryption.

@ossenthusiast

Copy link
Copy Markdown
Collaborator

github.com/disgoorg/godave/libdave
[pkg-config --cflags -- dave]
Package dave was not found in the pkg-config search path.
Perhaps you should add the directory containing `dave.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dave' not found

git clone https://github.com/discord/libdave.git
cd libdave
git submodule update --init --recursive
cd cpp
./vcpkg/bootstrap-vcpkg.sh
make install

export PKG_CONFIG_PATH="$PWD/build/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CGO_CFLAGS="-I$PWD/build/install/include"
export CGO_LDFLAGS="-L$PWD/build/install/lib"

DAVE is required for the encryption.

Thank you <3! It works now. One feedback though, what do you think about using guilds tree footer (SetFooter) for voice state instead of a new UI component/primitive on top of message input which takes a space and feels out of place.

Furthermore, currently, q does not work properly, I am not able to leave the voice channel with q, it does remove seem to remove myself from the UI though.

@PanicIsReal

Copy link
Copy Markdown
Author

github.com/disgoorg/godave/libdave
[pkg-config --cflags -- dave]
Package dave was not found in the pkg-config search path.
Perhaps you should add the directory containing `dave.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dave' not found

git clone https://github.com/discord/libdave.git
cd libdave
git submodule update --init --recursive
cd cpp
./vcpkg/bootstrap-vcpkg.sh
make install

export PKG_CONFIG_PATH="$PWD/build/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CGO_CFLAGS="-I$PWD/build/install/include"
export CGO_LDFLAGS="-L$PWD/build/install/lib"

DAVE is required for the encryption.

Thank you <3! It works now. One feedback though, what do you think about using guilds tree footer (SetFooter) for voice state instead of a new UI component/primitive on top of message input which takes a space and feels out of place.

Furthermore, currently, q does not work properly, I am not able to leave the voice channel with q, it does remove seem to remove myself from the UI though.

Once I get some time I can experiment with some other UI layouts for sure.
Noted on the 'q' bind, will look at that issue in the near future and post a commit.

@ossenthusiast

Copy link
Copy Markdown
Collaborator

github.com/disgoorg/godave/libdave
[pkg-config --cflags -- dave]
Package dave was not found in the pkg-config search path.
Perhaps you should add the directory containing `dave.pc'
to the PKG_CONFIG_PATH environment variable
Package 'dave' not found

git clone https://github.com/discord/libdave.git
cd libdave
git submodule update --init --recursive
cd cpp
./vcpkg/bootstrap-vcpkg.sh
make install

export PKG_CONFIG_PATH="$PWD/build/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export CGO_CFLAGS="-I$PWD/build/install/include"
export CGO_LDFLAGS="-L$PWD/build/install/lib"

DAVE is required for the encryption.

Thank you <3! It works now. One feedback though, what do you think about using guilds tree footer (SetFooter) for voice state instead of a new UI component/primitive on top of message input which takes a space and feels out of place.
Furthermore, currently, q does not work properly, I am not able to leave the voice channel with q, it does remove seem to remove myself from the UI though.

Once I get some time I can experiment with some other UI layouts for sure. Noted on the 'q' bind, will look at that issue in the near future and post a commit.

👍 Also, I think you should move encryption and related things to arikawa instead. Arikawa already has a voice package, but it hardcodes the encryption protocol (mode) and does not support libdave yet, moving related stuff to arikawa might be a better choice.

@ossenthusiast

Copy link
Copy Markdown
Collaborator

One more thing, I am able to hear others, but they cannot hear me, I guess so audio output is working fine, but not input. Have you considered switching to miniaudio (malgo) instead of portaudio?

@PanicIsReal

PanicIsReal commented Mar 8, 2026

Copy link
Copy Markdown
Author

One more thing, I am able to hear others, but they cannot hear me, I guess so audio output is working fine, but not input. Have you considered switching to miniaudio (malgo) instead of portaudio?

It worked in both directions for me using Ghostty on my M3 Mac, is it possible your default audio input device is not set correctly? I did not test with multiple available audio inputs. - What are you testing on?

Also to answer your question about Arikawa,

We used disgo + DAVE for voice because DAVE/E2EE will soon be required for Discord voice, and Arikawa’s current voice stack hardcodes the older xsalsa20_poly1305 mode and does not expose libdave/DAVE integration. disgo explicitly supports modern voice encryption mode negotiation and pluggable DAVE sessions, so it could handle the upcoming requirement correctly. We kept Arikawa for the main Discord gateway, but used disgo for voice transport because the deciding factor was the encryption path and future DAVE support, not Opus encoding.

Also Portaudio was just available and confirmed to work across Mac, Linux & Windows so I went with that.

@ayn2op

ayn2op commented Apr 5, 2026

Copy link
Copy Markdown
Owner

could you include a preview/screenshot in the description of the PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants