Voice chat/VoIP framework for Unity.
npm install com.adrenak.univoiceIAudioClient and IAudioServer interfaces using the networking plugin of your choice to have it send audio data over any networking solution.
IAudioInput interface.
IAudioOutput interface.
IAudioFilter interface.
manifest.json file of your Unity project with the following scopes:
"scopedRegistries": [
{
"name": "npmjs",
"url": "https://registry.npmjs.org",
"scopes": [
"com.npmjs",
"com.adrenak.univoice",
"com.adrenak.brw",
"com.adrenak.unimic",
"com.adrenak.concentus-unity"
]
}
]
`
Then add com.adrenak.univoice:x.y.z to the dependencies in your manifest.json file (where x.y.z is the version you wish to install). The list of versions is available on the UniVoice NPM page.
Useful links
* API reference is available here: http://adrenak.github.io/univoice
* UniVoice blog: https://vatsalambastha.com/?tag=univoice
* Discord server: https://discord.gg/NGvkEVbdjQ
Integration
UniVoice isn't currently very drag-and-drop/low-code. The best way to integrate is to have some code perform a one time setup when your app starts and provides access to relevant objects that you can use throughout the rest of the apps runtime.
Samples
This repository contains two samples:
* UniVoiceMirrorSetupSample.cs is a drag and drop component, a simple integration sample script. You can add it to your Mirror NetworkManager to get voice chat to work. No code required, it's as simple as that! It'll work as long as you have setup your project properly. For more instructions see the top of the UniVoiceMirrorSetupSample.cs file.
* UniVoiceFishNetSetypSample.cs is also very similar. Just drag and drop and it should work!
* A sample scene that shows the other clients in a UI as well as allows you to mute yourself/them. This sample is Mirror based.
> UniVoice currently only supports Mirror and FishNetworking out of the box. Follow the instructions in the "Activating non-packaged dependencies" section below before trying it out the samples.
Dependencies
com.adrenak.brw for reading and writing messages for communication. See MirrorServer.cs and MirrorClient.cs where they're used.
com.adrenak.unimic for easily capturing audio from any connected mic devices. See UniMicInput.cs for usage. Also used for streaming audio playback. See StreamedAudioSourceOutput.cs for usage.
com.adrenak.concentus-unity for Opus encoding and decoding. See ConcentusEncodeFilter.cs and ConcentusDecodeFilter.cs for usage
Activating non-packaged dependencies
UniVoice includes and installs the dependencies mentioned above along with itself. The following implementations are available out of the box when you install it:
* Opus encoding/decoding filter (via Contentus-Unity)
* GaussianAudioBlur filter (plain C#, no dependencies used)
* Mic audio capture input (via UniMic)
* AudioSource based playback output (via UniMic)
UniVoice has code that uses dependencies that you have to install and sometimes enable via compilation symbols as they are _not_ UniVoice dependencies and _don't_ get installed along with UniVoice. This is because they are either third party modules or based on native libraries (not plain C#) that can pose build issues.
* RNNoise Noise removal filter:
* To enable, ensure the RNNoise4Unity package is in your project and add UNIVOICE_FILTER_RNNOISE4UNITY to activate it
* Mirror network:
* Just add the Mirror package to your project. UniVoice will detect it.
* Fish Networking:
* Just install FishNet package in your project. UniVoice will detect it.
License and Support
This project is under the MIT license.
Community contributions are welcome.
Commercial engagements with the author can be arranged, subject to schedule and availability.
Acknowledgements and contributors
* @metater for helping make improvements to audio streaming quality. A related blog post
* @FrantisekHolubec for FishNet support code. Here's a related blog post
* Masaryk University for using UniVoice in their projects and providing helpful feedback
Contact
The author can be reached at the following links:
Website
LinkedIn
GitHub
Twitter
Discord: adrenak#1934`