EdgeSpeech
A React Native hook that provides on-device AI speech processing through the Switchboard SDK. This can be up to 99% cheaper than cloud speech-to-speech.
| Platform | Status |
|---|---|
| iOS | Supported |
| Android | Coming soon |
Example Usage
import { EdgeSpeechProvider, useEdgeSpeech } from '@synervoz/edgespeech'
function VoiceChat() {
const { listen, speak, onTranscriptComplete } = useEdgeSpeech()
onTranscriptComplete(async (text) => {
const response = await chat(text)
await speak(response)
})
return <Button onPress={listen} title="Start Listening" />
}
export default function App() {
return (
<EdgeSpeechProvider appId="YOUR_APP_ID" appSecret="YOUR_APP_SECRET">
<VoiceChat />
</EdgeSpeechProvider>
)
}The included example app shows a complete speech-to-speech workflow.
Installation
npm install @synervoz/edgespeechRequirements
| Requirement | Minimum |
|---|---|
| React Native | 0.74+ |
| iOS | 13.4+ |
| Node.js | 22+ |
| expo-modules-core | 2.0.0+ |
iOS Setup with Expo
Add microphone permission to your Info.plist (or via app.json infoPlist for Expo managed workflow):
<key>NSMicrophoneUsageDescription</key>
<string>This app needs microphone access for voice input</string>Build your app:
npx expo run:iosAPI Reference
The useEdgeSpeech hook provides access to the main functions of the Switchboard SDK.
EdgeSpeechProvider provider
Wrap your app in the EdgeSpeechProvider and configure it.
<EdgeSpeechProvider
appId="YOUR_APP_ID" // Optional: Switchboard app ID
appSecret="YOUR_APP_SECRET" // Optional: Switchboard app secret
sttModel="whisper-base-en" // Optional: STT model (default: 'whisper-base-en')
ttsVoice="en_GB" // Optional: TTS voice (default: 'en_GB')
vadSensitivity={0.5} // Optional: VAD sensitivity 0.0–1.0 (default: 0.5)
>
<App />
</EdgeSpeechProvider>This library ships with a built-in demo credentials so you can run it immediately without creating a Switchboard account. Simply omit the
APP_IDandAPP_SECRETfrom the EdgeSpeechProvider.
Your Switchboard
APP_IDandAPP_SECRETare safe to bundle in your application. They function like a publishing key and are intended to be distributed with your app.
useEdgeSpeech hook
Access the state and actions from any component with the useEdgeSpeech hook.
const {
// State
transcript, // string — live interim transcript (clears on final)
voiceState, // 'idle' | 'listening' | 'processing' | 'speaking'
error, // string | null
hasMicrophonePermission, // boolean | null
// Actions
listen, // () => Promise<void>
stopListening, // () => Promise<void>
speak, // (text: string) => Promise<void>
stopSpeaking, // () => Promise<void>
requestMicrophonePermission, // () => Promise<boolean>
// Callbacks
onTranscriptComplete, // (cb: (text: string) => void) => void — fires on final transcript
onInterrupted, // (cb: () => void) => void — fires when VAD interrupts TTS
} = useEdgeSpeech()