AudioManager API Reference
TheAudioManager class provides comprehensive audio functionality for MentraOS Apps, including URL-based audio playback, text-to-speech synthesis, and audio control. It automatically handles request tracking, timeouts, and provides real-time status monitoring.
Import
Class: AudioManager
The AudioManager is automatically instantiated by the AppSession. You should not create instances directly.Audio Playback Methods
playAudio
Play audio from a URL on the connected glasses (or the phone).options: Audio playback configuration
speak
Convert text to speech and play it on the connected glasses.text: Text to convert to speech (required)options: Text-to-speech configuration (optional)
stopAudio
Stop all audio playback on the connected glasses.Request Management Methods
hasPendingRequest
Check if there are pending audio requests.requestId: Optional specific request ID to check
Interfaces
AudioPlayOptions
Options for audio playback from URLs.SpeakOptions
Options for text-to-speech synthesis.AudioPlayResult
Result of an audio playback attempt.Available ElevenLabs TTS Models
| Model | Description | Languages | Latency |
|---|---|---|---|
eleven_v3 | Human-like and expressive speech generation | 70+ languages | Standard |
eleven_flash_v2_5 | Ultra-fast model optimized for real-time use | All multilingual_v2 languages + hu, no, vi | ~75ms |
eleven_flash_v2 | Ultra-fast model (English only) | en | ~75ms |
eleven_turbo_v2_5 | High quality, low-latency with good balance | Same as flash_v2_5 | ~250-300ms |
eleven_turbo_v2 | High quality, low-latency (English only) | en | ~250-300ms |
eleven_multilingual_v2 | Most lifelike with rich emotional expression | en, ja, zh, de, hi, fr, ko, pt, it, es, id, nl, tr, fil, pl, sv, bg, ro, ar, cs, el, fi, hr, ms, sk, da, ta, uk, ru | Standard |
- Use
eleven_flash_v2_5for real-time applications requiring ultra-low latency - Use
eleven_turbo_v2_5for a good balance of quality and speed - Use
eleven_multilingual_v2for the highest quality emotional expression - Use
eleven_v3for maximum language support
Best Practices
1. Check Device Capabilities
2. Handle Errors Gracefully
3. Chain Multiple Audio Requests
4. Allow the User to Interrupt the Audio
Related Documentation
- Audio Tutorial - Step-by-step guide to audio functionality
- Device Capabilities - Check audio hardware support
- App Session - AppSession class reference
- Events - Voice activation and audio events

