Coder Social home page Coder Social logo

one-voip-godot-4's Introduction

VoIP extension for Godot 4

Add voice chat to your game in minutes!

Features:

  • Uses native godot bus effects and audio streams โœ…
  • Opus compression โœ…
  • Jitter buffer ๐Ÿšง
  • Echo cancelling ๐Ÿšง

Builds for:

  • Windows โœ…
  • Linux โœ…
  • Android ๐Ÿšง
  • Mac ๐Ÿšง
  • Web ๐Ÿšง

How to Use

Install webrtc-native by downloading the latest release and dragging the webrtc-native folder into your godot project's root folder

Install one-voip by downloading the latest release and dragging the one-voip folder into your godot project's root folder

Spawn in a new bus in your project's audio mixer for your microphone, mute the bus (unless you want to listen to yourself), and add an VOIPInputCapture.

Add an AudioStreamPlayer somewhere in the scene, add a new AudioStreamMicrophone as the stream, set the Bus to the one you made (e.g. in the demo it's called "Mic") and turn on autoplay.

To send audio, connect a function to the packet_ready signal on the effect:

var idx = AudioServer.get_bus_index("Mic")
var effect = AudioServer.get_bus_effect(idx, 0)
effect.packet_ready.connect(_on_packet_ready)

And send the packet using any method you like in the _on_packet_ready function.

To receive audio, instantiate an AudioStreamVOIP every time a peer connects, add it to some kind of audio stream player, and MAKE SURE you play it. When you receive a packet, figure out what user sent it, and then push it to their AudioStreamVOIP:

stream.push_packet(packet)

Check out the demos for a full example.

Compiling

Windows

Install CMake and Visual Studio build tools (MinGW will also work by modifying the opus path in SConstruct, instructions are for MSBuild)

In thirdparty/opus: cmake -Bbuild

In thirdparty/opus/build: msbuild Opus.sln /p:Configuration=Release

In the project root: scons

This will build to demo_rtc/bin

Linux

Possible Dependencies

In thirdparty/opus: cmake -Bbuild -DCMAKE_POSITION_INDEPENDENT_CODE=ON

In thirdparty/opus/build: make

In the project root: scons

Web (STILL BROKEN ON GODOT 4)

Install emscripten (chocolatey can help with dependencies: choco install emscripten)

In thirdparty/opus: emcmake cmake -Bbuild

In thirdparty/opus/build: make

In the project root: scons platform=javascript

one-voip-godot-4's People

Contributors

marc-weber1 avatar revolupowered avatar fire avatar

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.