Introduction
We are proud to announce the availability of our native Node.js SDK for ODIN, expanding the possibilities for server-side voice communication in your projects. This powerful new SDK allows developers to access advanced features like recording and transcribing voice per user, building bots that interact with other users through text chat or voice, and more. By leveraging the native Node.js bindings for the ODIN SDK, you can unlock the full potential of voice communication in your games and applications.
ODIN Node.js SDK Overview
The ODIN Node.js SDK is based on the ODIN Native SDK and wraps the C++ code into a Node.js module. While we offer a JavaScript/TypeScript SDK with fallback code for WebRTC that can be used in browsers and Node.js, it is not as performant and has some limitations. The native Node.js SDK addresses these issues and provides additional functionality, making it the perfect choice for bots and other advanced use cases.
Key Differences between ODIN Node.js SDK and Web SDK
While the API for the Node.js SDK is designed to be as similar as possible to the Web SDK, there are some differences:
- The Node.js SDK allows you to access raw audio data from the ODIN server, enabling you to record audio or send audio into a room.
- The Node.js SDK is optimized for server-side use cases, while the Web SDK is tailored for browser-based applications.
Prerequisites and Dependencies
To use the ODIN Node.js SDK, you will need a C++ compiler installed. For macOS, install XCode and the command line tools; for Linux, install GCC. More information on this can be found in the node-gyp documentation.
The ODIN Node.js SDK depends on the native ODIN SDK. Some precompiled libraries for typical platforms (macOS, Windows, and Linux) are provided in the libs folder.
Usage Examples
We have created two simple usage examples that you can find in the tests
folder of the NPM package.
Audio Recording and Transcription
We provide an example that demonstrates how to use the ODIN Node.js SDK to record audio from other users and send it to OpenAI for transcription using OpenAIs whisper model. It also showcases basic bot functionality, such as sending a message to the chat.
Sending Music
This example demonstrates how to use the ODIN Node.js SDK to send music to other users in a room. It loads a sample MP3 file, decodes it, and sends it to the ODIN server.
Detailed instructions on how to run the music sending example can be found in the tests/sending-audio
folder of
the NPM package.
Conclusion
The ODIN Node.js SDK opens up a world of possibilities for server-side voice communication, providing advanced functionality for developers to create immersive and interactive experiences. With the native Node.js bindings, you can harness the power of the ODIN SDK and bring your projects to new heights.
Get started with the ODIN Node.js SDK today and explore the incredible potential of server-side voice communication in your applications!