Skip to main content

Python SDK for Omi wearable device

Project description

🎧 Omi Python SDK

A pip-installable Python SDK for connecting to Omi wearable devices over Bluetooth, decoding Opus-encoded audio, and transcribing it in real time using Deepgram.

📦 Installation

Prerequisites

The Omi SDK requires the Opus audio codec library to be installed on your system:

macOS:

brew install opus

Ubuntu/Debian:

sudo apt-get install libopus0 libopus-dev

CentOS/RHEL/Fedora:

sudo yum install opus opus-devel  # CentOS/RHEL
sudo dnf install opus opus-devel  # Fedora

Option 1: Install from PyPI (when published)

pip install omi-sdk

Option 2: Install from source

git clone https://github.com/BasedHardware/omi.git
cd omi/sdks/python
pip install -e .

🚀 Quick Start

1. Set up your environment

# Get a free API key from https://deepgram.com
export DEEPGRAM_API_KEY=your_actual_deepgram_key

2. Find your Omi device

# Scan for nearby Bluetooth devices
omi-scan

Look for a device named "Omi" and copy its MAC address:

0. Omi [7F52EC55-50C9-D1B9-E8D7-19B83217C97D]

3. Use in your Python code

import asyncio
import os
from omi import listen_to_omi, OmiOpusDecoder, transcribe
from asyncio import Queue

# Configuration
OMI_MAC = "YOUR_OMI_MAC_ADDRESS_HERE"  # From omi-scan
OMI_CHAR_UUID = "19B10001-E8F2-537E-4F6C-D104768A1214"  # Standard Omi audio UUID
DEEPGRAM_API_KEY = os.getenv("DEEPGRAM_API_KEY")

async def main():
    audio_queue = Queue()
    decoder = OmiOpusDecoder()
    
    def handle_audio(sender, data):
        pcm_data = decoder.decode_packet(data)
        if pcm_data:
            audio_queue.put_nowait(pcm_data)
    
    def handle_transcript(transcript):
        # Custom transcript handling
        print(f"🎤 {transcript}")
        # Save to file, send to API, etc.
    
    # Start transcription and device connection
    await asyncio.gather(
        listen_to_omi(OMI_MAC, OMI_CHAR_UUID, handle_audio),
        transcribe(audio_queue, DEEPGRAM_API_KEY, on_transcript=handle_transcript)
    )

if __name__ == "__main__":
    asyncio.run(main())

4. Run the example

The included example demonstrates connecting to an Omi device and real-time transcription:

# 1. Set your Deepgram API key
export DEEPGRAM_API_KEY=your_actual_deepgram_key

# 2. Find your Omi device MAC address
omi-scan

# 3. Update examples/main.py with your device's MAC address
# Edit line 10: OMI_MAC = "YOUR_DEVICE_MAC_HERE"

# 4. Run the example
python examples/main.py

The example will:

  • Connect to your Omi device via Bluetooth
  • Decode incoming Opus audio packets to PCM
  • Transcribe audio in real-time using Deepgram
  • Print transcriptions to the console

📚 API Reference

Core Functions

  • omi.print_devices() - Scan for Bluetooth devices
  • omi.listen_to_omi(mac, uuid, handler) - Connect to Omi device
  • omi.OmiOpusDecoder() - Decode Opus audio to PCM
  • omi.transcribe(queue, api_key) - Real-time transcription

Command Line Tools

  • omi-scan - Scan for nearby Bluetooth devices

🔧 Development

Local development setup

git clone https://github.com/BasedHardware/omi.git
cd omi/sdks/python

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install in editable mode
pip install -e .

# Install dev dependencies
pip install -e ".[dev]"

🧩 Troubleshooting

  • Opus library error: Make sure Opus audio codec is installed (see Prerequisites section)
  • Bluetooth permission errors on macOS: Go to System Preferences → Privacy & Security → Bluetooth and grant access to Terminal and Python
  • Python version: Requires Python 3.10+
  • Omi device: Make sure device is powered on and nearby
  • WebSocket issues: SDK uses websockets>=11.0

📄 License

MIT License — this is an unofficial SDK built by the community, not affiliated with Omi.

🙌 Credits

Built by the Omi community using Omi hardware and Deepgram's transcription engine.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

omi_sdk-0.2.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

omi_sdk-0.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file omi_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: omi_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for omi_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f80689ff088c27c0c120c04c54ba02a66dfade1b46765cf28111fe71bde68574
MD5 a42c9344100b3e380abf8d1d2662bdcb
BLAKE2b-256 f259159e247b710b0703209b2b31bbf26f27bd6fedcd6d45af136d4eb0e4c024

See more details on using hashes here.

File details

Details for the file omi_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: omi_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for omi_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d70f50980f14419a465d275b06f1dc76e6efb102f8014687e590e9e07b41b7c8
MD5 17bfe4c9abd4a7d5203b83853f0a3f0a
BLAKE2b-256 a21d4c614e972a8fbe414f62c0f18e4aecbff288f28cb28660afff28a6c9333e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page