Skip to content

Add audio session management and playback functionality to Deepgram module - #21

Merged
itsRares merged 9 commits into
mainfrom
feature/2.2.0
Jun 29, 2026
Merged

itsRares merged 9 commits into
mainfrom
feature/2.2.0

Conversation

@itsRares

Copy link
Copy Markdown
Owner

Implement audio session lifecycle management, enhance playback and recording capabilities, and improve error handling. Introduce new features for audio device management and update configuration options for better resilience and flexibility. Version updated to 2.2.0.

itsRares added 9 commits June 25, 2026 16:07
…odule

- Implemented audio session lifecycle management in Deepgram+AudioSession, including activation, deactivation, and configuration for recording and playback.
- Added handling for audio route changes, media services resets, and audio interruptions to ensure seamless audio experience.
- Introduced Deepgram+Playback for TTS and voice agent audio output using AVAudioPlayerNode, with support for echo cancellation when voice processing is enabled.
- Created Deepgram+Recording to manage microphone capture, supporting both AudioQueue and AVAudioEngine paths for different use cases.
- Enhanced private interface in Deepgram+Private.h to manage shared state across audio session, recording, and playback functionalities.
- Added error handling and logging throughout the audio management process to aid in debugging and ensure reliability.
- Bump version in package.json to 2.2.0.
- Add new constants for agent URL and improve base URL handling.
- Enhance `configure` function to accept base URL, WebSocket URL, and agent URL overrides.
- Introduce reconnect options for live streaming sockets in shared types.
- Update speech-to-text hook to support reconnect options and manage socket state.
- Implement pause and resume functionality for streaming in speech-to-text hook.
- Refactor text intelligence and text-to-speech hooks to use dynamic base URLs.
- Add reconnect logic to voice agent hook for improved resilience.
- Introduce mute/unmute functionality in voice agent hook with keep-alive support.
…to-speech functionality

- Implemented audio-level metering in the iOS native module, allowing for real-time RMS amplitude feedback during microphone capture.
- Added `setMeteringEnabled` method to enable/disable audio-level events with configurable intervals.
- Enhanced the `useDeepgramSpeechToText` hook to support audio-level tracking, including state management for audio levels.
- Introduced `synthesizeToBytes` method in the text-to-speech hook to fetch synthesized audio as raw bytes, with caching for repeated requests.
- Updated UI components to display audio byte information and integrate new functionalities.
- Refactored authentication handling to support token-based authentication, allowing for more secure API key management.
- Implemented recording to WAV file while streaming audio to Deepgram.
- Added methods for starting, stopping, and discarding recordings.
- Introduced audio route management with methods to set and get the preferred audio output route.
- Enhanced error handling with a structured DeepgramError class for better error management across the application.
- Updated TypeScript types to support new recording and audio route features.
- Added event listener for audio route changes to notify JavaScript side of changes.
- Implemented `getAudioDevices` method to enumerate available audio output devices, including Bluetooth headsets and built-in options.
- Added `selectAudioDevice` method to allow users to select a specific audio device by its ID.
- Enhanced the Android and iOS native modules to support audio device management.
- Updated React Native interface to expose new methods for audio device handling.
- Introduced event listeners for audio device changes, allowing real-time updates in the UI.
- Updated permissions for Bluetooth access on Android 12+.
- Removed audio route management methods and properties from iOS implementation, including `setAudioRoute`, `getAudioRoute`, and `selectAudioDevice`.
- Eliminated related properties in `Deepgram+Private.h` and `Deepgram+AudioSession` files.
- Updated `Deepgram.mm` to remove audio route methods and their exports.
- Cleaned up Android permissions related to Bluetooth routing in the plugin configuration.
- Deleted `audioRoute.ts` as it contained methods for managing audio routes that are no longer supported.
- Adjusted TypeScript interfaces and exports to reflect the removal of audio route functionalities.
@itsRares
itsRares merged commit 0ae26b6 into main Jun 29, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant