Skip to content

Latest commit

 

History

History
 
 

swift

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Overview

An easy-to-install Swift package for connecting to Omi devices. Get started in seconds with local Whisper-based transcription - no cloud API required.

Native iOS/macOS support Whisper runs on-device Connect in minutes

Quick Start

Get transcription working in 2 minutes:

Replace your `ViewController.swift` with:
```swift
import UIKit
import omi_lib

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.lookForDevice()
    }

    func lookForDevice() {
        OmiManager.startScan { device, error in
            print("starting scan")
            if let device = device {
                print("got device ", device)
                self.connectToOmiDevice(device: device)
                OmiManager.endScan()
            }
        }
    }

    func connectToOmiDevice(device: Device) {
        OmiManager.connectToDevice(device: device)
        self.listenToLiveTranscript(device: device)
        self.reconnectIfDisconnects()
    }

    func reconnectIfDisconnects() {
        OmiManager.connectionUpdated { connected in
            if connected == false {
                self.lookForDevice()
            }
        }
    }

    func listenToLiveTranscript(device: Device) {
        OmiManager.getLiveTranscription(device: device) { transcription in
            print("transcription:", transcription ?? "no transcription")
        }
    }
}
```
1. Select your development team 2. Connect your iPhone via cable (simulators don't support Bluetooth) 3. Run the project 1. Turn on your Omi device 2. The app should connect automatically 3. Speak - you'll see transcription in the Xcode console
<Note>
There's no UI in this example - transcription appears in the Xcode logs.
</Note>

<img
  src="https://github.com/user-attachments/assets/636b33ac-7ea7-4e1c-b490-8ec99b1feef8"
  alt="Xcode Console Output"
  style={{maxWidth: '600px'}}
/>

OmiManager Methods

Method Description
startScan(callback) Start scanning for Omi devices
endScan() Stop scanning
connectToDevice(device) Connect to a discovered device
connectionUpdated(callback) Monitor connection state changes
getLiveTranscription(device, callback) Receive real-time transcription
getLiveAudio(device, callback) Receive audio file URLs

Streaming STT (Deepgram)

Transcribe streaming audio with customizable Deepgram model and language options:

import omi_lib

// Via OmiSttFactory
let transcriber = try OmiSttFactory.makeStreaming(
    engine: .deepgram,
    deepgramAPIKey: "YOUR_DEEPGRAM_API_KEY",
    deepgramModel: "nova-2",
    deepgramLanguage: "es", // e.g. "en-US", "es", "fr", "ja"
    onTranscript: { text in
        print("Transcript: \(text)")
    }
)

// Or directly with OmiDeepgramTranscriber
let deepgram = OmiDeepgramTranscriber(
    apiKey: "YOUR_DEEPGRAM_API_KEY",
    sampleRate: 16000,
    model: "nova-2",
    language: "es",
    onTranscript: { text in
        print("Transcript: \(text)")
    }
)

// Send PCM audio data
deepgram.appendPcm(pcmData)

// Disconnect when done
deepgram.stop()

Related

Compare all available SDKs View source code and contribute