Voice Processor 
 React Native API
API Reference for the Voice Processor React Native SDK(npmjs).
VoiceProcessor
The main class for the VoiceProcessor library. This class provides methods to manage audio recording and handle audio frame events.
VoiceProcessor.instance
Singleton instance of the VoiceProcessor class.
Returns
- VoiceProcessor : The singleton instance of VoiceProcessor.
VoiceProcessor.numFrameListeners
Gets the number of currently subscribed frame listeners.
Returns
- number : The number of currently subscribed frame listeners.
VoiceProcessor.numErrorListeners
Gets the number of currently subscribed error listeners.
Returns
- number : The number of currently subscribed error listeners.
VoiceProcessor.addFrameListener()
Adds a new listener that receives audio frames.
Parameters
- listenerVoiceProcessorFrameListener : The listener function to be called when audio frames are received.
VoiceProcessor.addFrameListeners()
Adds multiple listeners that receive audio frames.
Parameters
- listenersVoiceProcessorFrameListener[] : An array of listeners to be added.
VoiceProcessor.removeFrameListener()
Removes a previously added frame listener.
Parameters
- listenerVoiceProcessorFrameListener : The listener function to be removed.
VoiceProcessor.removeFrameListeners()
Removes previously added frame listeners.
Parameters
- listenersVoiceProcessorFrameListener[] : An array of listeners to be removed.
VoiceProcessor.clearFrameListeners()
Removes all frame listeners.
VoiceProcessor.addErrorListener()
Adds a new error listener.
Parameters
- errorListenerVoiceProcessorErrorListener : The listener to be called when errors occur.
VoiceProcessor.removeErrorListener()
Removes a previously added error listener.
Parameters
- errorListenerVoiceProcessorErrorListener : The error listener to be removed.
VoiceProcessor.clearErrorListeners()
Removes all error listeners.
VoiceProcessor.start()
Starts audio recording with specified audio parameters.
Parameters
- frameLengthnumber : The desired length of audio frames, in number of samples.
- sampleRatenumber : The desired sample rate for audio recording, in Hz.
Throws
- VoiceProcessorError : If an error occurs while attempting to start audio recording.
Returns
- Promise<void> : A promise that resolves when recording starts.
VoiceProcessor.stop()
Stops audio recording.
Throws
- VoiceProcessorError : If an error occurs while attempting to stop audio recording.
Returns
- Promise<void> : A promise that resolves when recording stops.
VoiceProcessor.isRecording()
Checks if audio recording is currently in progress.
Returns
- Promise<boolean> : A promise that resolves with a boolean indicating recording status.
VoiceProcessor.hasRecordAudioPermission()
Checks if the app has permission to record audio and prompts user if not.
Returns
- Promise<boolean> : A promise that resolves with a boolean indicating permission status.
VoiceProcessorFrameListener
Type for callback functions that receive audio frames from the VoiceProcessor.
VoiceProcessorErrorListener
Type for callback functions that receive errors from the VoiceProcessor.
VoiceProcessorError
Exception class for errors related to the VoiceProcessor.