Streaming Real-Time Audio From Device to Anywhere
Omi allows you to stream audio bytes from your DevKit1 or DevKit2 directly to your backend or any other service, enabling you to perform various analyses and store the data. You can also define how frequently you want to receive the audio bytes.Step 1: Create an Endpoint
Create an endpoint (webhook) that can receive and process the data sent by our backend. Our backend will make a POST request to your webhook with sample_rate and uid as query parameters. The request from our backend will look like this:POST /your-endpoint?sample_rate=16000&uid=user123
The data sent is of type octet-stream, which is essentially a stream of bytes. You can either create your own endpoint or use the example provided below. Once itโs ready and deployed, proceed to the next step.
Note: The sample rate refers to the audio samples captured per second. DevKit1 (v1.0.4 and above) and DevKit2 record audio at a sample rate of 16,000 Hz, while DevKit1 with v1.0.2 records at a sample rate of 8,000 Hz. The uid represents the unique ID assigned to the user in our system.
Step 2: Add the Endpoint to Developer Settings
- Open the Omi App on your device.
- Go to Settings and click on Developer Mode.
- Scroll down until you see Realtime audio bytes, and set your endpoint there.
- In the Every x seconds field, define how frequently you want to receive the bytes. For example, if you set it to 10 seconds, you will receive the audio bytes every 10 seconds.
Example: Saving Audio Bytes as Audio Files in Google Cloud Storage
Step 1: Create a Google Cloud Storage bucket and set the appropriate permissions. You can follow the steps mentioned here up to step 5. Step 2: Fork the example repository from github.com/mdmohsin7/omi-audio-streaming. Step 3: Clone the repository to your local machine. Step 4: Deploy it to any of your preferred cloud providers like GCP, AWS, DigitalOcean, or run it locally (you can use Ngrok for local testing). The repository includes a Dockerfile for easy deployment. Step 5: While deploying, ensure the following environment variables are set:GOOGLE_APPLICATION_CREDENTIALS_JSON
: Your GCP credentials, encoded in base64.GCS_BUCKET_NAME
: The name of your GCP storage bucket.
/audio
.
Step 7: You should now see audio files being saved in your GCP bucket every x seconds, where x is the value you set in the Every x seconds
field.
Contributing ๐ค
We welcome contributions from the open source community! Whether itโs improving documentation, adding new features, or reporting bugs, your input is valuable. Check out our Contribution Guide for more information.Support ๐
If youโre stuck, have questions, or just want to chat about Omi:- GitHub Issues: ๐ For bug reports and feature requests
- Community Forum: ๐ฌ Join our community forum for discussions and questions
- Documentation: ๐ Check out our full documentation for in-depth guides