Giter Club home page Giter Club logo

voice-bridge's Introduction

Teamspeak3 <-> Discord Voice Bridge

Requires your own discord bot token.

This software is in an MVP status, use at your own risk, like always.

Building

get rust compiler with cargo

debian/ubuntu

Install pkg-config, libssl and libopus: sudo apt install pkg-config libssl-dev libopus-dev.

Then run cargo build --release .exe/elf is inside target/release/ You can also run cargo run --release instead to directly build & execute the resulting binary.

Build optimization

The default release build is heavily optimized, using native target-cpu instructions and LTO. You can disable LTO in the Cargo.toml under [profile.release], which can reduce the build time by a lot. And you can disable the target-cpu flags in .cargo/config.toml.

Starting

Setup your credentials inside .credentials.toml by copying credentials.example.toml

Then join a voice channel in discord, type ~join in a text channel the bot can access. The teamspeak side should already be connected based on your config.

Debugging

To enable backtrace you can set the RUST_BACKTRACE environment variable like so: On linux run with RUST_BACKTRACE=1 (so RUST_BACKTRACE=1 cargo run --release) On windows execute $Env:RUST_BACKTRACE='1' in your powershell (I recommend windows terminal). Then run the binary from there, see above.

Logging can be controlled via RUST_LOG=<value> environment variable with <value> being one of error, warn, info, debug, trace. See above for setting it.

License

voice_bridge is primarily distributed under the terms of the AGPL license (Version 3.0). Libraries specified by the cargo.toml and code annotated otherwise is copyright by their respective authors.

See LICENSE-AGPL details.

voice-bridge's People

Contributors

0xpr03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

karatekhd

voice-bridge's Issues

Buffer not keeping up after some time

I forgot to put this, after some 30 minutes to one hour of continues usage sound heard on teamspeak starts to crackling. Also discord music bots are crackling on teamspeak but I think is the volume issue.

~play command is not working, does not find ffmpeg

When using a command like

~play <source to mp3>

The bot replies with "Error sourcing ffmpeg", and the following line is logged:

May 19 19:06:06 theia voice_bridge[898]: Err starting source: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })

However, ffmpeg is avaliable:

$ ffmpeg -version
ffmpeg version 4.4.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (SUSE Linux)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --optflags='-O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -ffat-lto-objects -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --enable-version3 --disable-openssl --enable-avresample --enable-gnutls --enable-ladspa --enable-vulkan --enable-libglslang --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcelt --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librubberband --enable-libsvtav1 --enable-libsoxr --enable-libspeex --enable-libssh --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libwebp --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lto --enable-lv2 --enable-libmfx --enable-vaapi --enable-vdpau --enable-version3 --enable-libfdk-aac-dlopen --enable-nonfree --enable-libvo-amrwbenc --enable-libx264 --enable-libx265 --enable-librtmp --enable-libxvid

Any idea what's wrong here?

ring v0.16.20

When I try to compile the project I get the following error:

Compiling rand_chacha v0.2.2
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `C:\Users\teris\Downloads\voice-bridge-main\target\release\build\ring-cd96deb56d6a939a\build-script-build` (exit code: 101)
  --- stdout
  OPT_LEVEL = Some("3")
  TARGET = Some("x86_64-pc-windows-gnu")
  HOST = Some("x86_64-pc-windows-gnu")
  CC_x86_64-pc-windows-gnu = None
  CC_x86_64_pc_windows_gnu = None
  HOST_CC = None
  CC = None
  CFLAGS_x86_64-pc-windows-gnu = None
  CFLAGS_x86_64_pc_windows_gnu = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("aes,avx,avx2,bmi1,bmi2,fma,fxsr,lzcnt,pclmulqdq,popcnt,rdrand,rdseed,sha,sse,sse2,sse3,sse4.1,sse4.2,ssse3,xsave,xsavec,xsaveopt,xsaves")

  --- stderr
  running "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-g3" "-DNDEBUG" "-c" "-oC:\\Users\\teris\\Downloads\\voice-bridge-main\\target\\release\\build\\ring-5811b48839aa6c1a\\out\\aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c"
  thread 'main' panicked at 'failed to execute ["gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-g3" "-DNDEBUG" "-c" "-oC:\\Users\\teris\\Downloads\\voice-bridge-main\\target\\release\\build\\ring-5811b48839aa6c1a\\out\\aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c"]: program not found', C:\Users\teris\.cargo\registry\src\github.com-1ecc6299db9ec823\ring-0.16.20\build.rs:653:9
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src/panicking.rs:584:5
     1: core::panicking::panic_fmt
               at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\core\src/panicking.rs:143:14
     2: build_script_build::run_command::{{closure}}
     3: core::result::Result<T,E>::unwrap_or_else
     4: build_script_build::run_command
     5: build_script_build::compile
     6: build_script_build::build_library::{{closure}}
     7: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
     8: core::option::Option<T>::map
     9: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
    10: alloc::vec::Vec<T,A>::extend_desugared
    11: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
    12: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter
    13: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
    14: <alloc::vec::Vec<T> as core::iter::traits::collect::FromIterator<T>>::from_iter
    15: core::iter::traits::iterator::Iterator::collect
    16: build_script_build::build_library
    17: build_script_build::build_c_code::{{closure}}
    18: <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::for_each
    19: build_script_build::build_c_code
    20: build_script_build::ring_build_rs_main
    21: build_script_build::main
    22: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed

System requirements

Hi,
I am planning to deploy this project and ran into some issues that I think could be caused by the program running out of memory. Could you please provide some information about how much memory is needed to run this?
Thanks in advance

~ Jens

Crackling sound on the TS3 side

Hi,

At first I want to write you made a really good job with that project! I never saw anything like this.
I also have a problem. I already compile it and it runs just fine, when I speak from TS3 channel to the Discord one, on Discord everything is working. But in opposite direction (speak from Discord channel to TS3) there is terrible distortion like the sound is on and off constantly many times per second. Also out traffic on TS3 shows really huge packet loss and already checked that, that's not the hosting machine or its equipment. I found the music bot which is sending voice from Discord to TS3 works perfectly fine, packet loss starts when anybody starts talking from Discord to TS3. Both DS and TS3 servers are on seperate hostings, voice-bridge is running on my local machine which acts as server, running 24/7 (Mint 20.1).

Now I can't catch it for the screenshot but packet loss jumps
up and down quickly; from 3 to 5%, one time had over 70% packet loss. And its only single way, that's the weirdest thing.
screenshot-298
I hope you will be able to track what was happened because the sound issue sounds like audio buffer problem.

Thanks in advance.

Bot not join to discord voice channel

Jun 02 11:39:49.832 WARN Failed to handle message, error: Client should be removed but does not exist
Jun 02 11:39:49.833 WARN Failed to handle message, error: Client should be removed but does not exist
Jun 02 11:40:49.690 WARN Out of order command packet, expected: 58, got: 59

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.