iOS SDK
Live voice with a VoiceMint agent from a Swift app on iOS 15+.
Swift, iOS 15+. Microphone in, agent voice out, with AVAudioEngine voice processing (echo cancellation), barge-in and transcripts. Source: github.com/alphaaiservice/voicemint-ios (MIT).
Install#
Swift Package Manager (works today, straight from GitHub):
.package(url: "https://github.com/alphaaiservice/voicemint-ios", from: "0.1.0")
// target dependency: .product(name: "VoiceMint", package: "voicemint-ios")CocoaPods is not on trunk yet; until it is:
pod 'VoiceMintCore', :git => 'https://github.com/alphaaiservice/voicemint-ios.git', :tag => '0.1.0'
pod 'VoiceMint', :git => 'https://github.com/alphaaiservice/voicemint-ios.git', :tag => '0.1.0'Add NSMicrophoneUsageDescription to Info.plist.
Talk#
import VoiceMint
guard await VoiceMintPermissions.requestMicrophone() else { return }
let minted = try await myAPI.voicemintToken(agentId: agentId) // {ws_url, token} from YOUR backend
let session = try VoiceMintSession.fromLiveSession(token: minted.token, wsURL: minted.wsURL)
session.onTranscript = { role, text, isFinal in if isFinal { print(role, text) } }
session.start()Also: mute(_:), sendText(_:), stop(), and onState, onAgentAudioLevel, onError, onEnd.