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 Selection Guidelines:
- 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

