Voice Processor
Flutter API
API Reference for the Voice Processor Flutter SDK(pub.dev).
VoiceProcessor
Class for capturing audio and delivering frames to registered frame listeners.
VoiceProcessor.instance
Singleton instance of the VoiceProcessor
class.
Returns
- VoiceProcessor? : The singleton instance of
VoiceProcessor
.
VoiceProcessor.numFrameListeners
Gets the number of registered frame listeners.
Returns
- int : The number of registered frame listeners.
VoiceProcessor.numErrorListeners
Gets the number of registered error listeners.
Returns
- int : The number of registered error listeners.
VoiceProcessor.addFrameListener()
Adds a new listener that receives audio frames.
Parameters
listener
VoiceProcessorFrameListener : Listener function that executes user code on a frame of audio.
VoiceProcessor.addFrameListeners()
Adds a list of listeners that receive audio frames.
Parameters
listeners
List<VoiceProcessorFrameListener> : List of listener functions that execute user code on frames of audio.
VoiceProcessor.removeFrameListener()
Removes a previously added frame listener.
Parameters
listener
VoiceProcessorFrameListener : The listener function to be removed.
VoiceProcessor.removeFrameListeners()
Removes previously added frame listeners.
Parameters
listeners
List<VoiceProcessorFrameListener> : List of listener functions to be removed.
VoiceProcessor.clearFrameListeners()
Removes all frame listeners.
VoiceProcessor.addErrorListener()
Adds a new error listener.
Parameters
errorListener
VoiceProcessorErrorListener : Listener function that handles errors.
VoiceProcessor.removeErrorListener()
Removes a previously added error listener.
Parameters
errorListener
VoiceProcessorErrorListener : The error listener function to be removed.
VoiceProcessor.clearErrorListeners()
Removes all error listeners.
VoiceProcessor.start()
Starts audio recording with the given sampleRate
and delivering audio frames of size frameLength
to registered frame listeners.
Parameters
frameLength
int : Number of audio samples per frame to be delivered via the listeners.sampleRate
int : Audio sample rate of the recorded audio.
Throws
- VoiceProcessorException : If an error occurs while attempting to start audio capture.
Returns
- Future<void> : A future that resolves when audio recording starts.
VoiceProcessor.stop()
Stops audio recording.
Throws
- VoiceProcessorException : If an error occurs while attempting to stop audio capture.
Returns
- Future<void> : A future that resolves when audio recording stops.
VoiceProcessor.isRecording()
Checks if audio recording is currently in progress.
Returns
- Future<bool?> : A future that resolves with a boolean indicating whether recording is active or not.
VoiceProcessor.hasRecordAudioPermission()
Checks if the app has permission to record audio and prompts the user if not.
Returns
- Future<bool?> : A future that resolves with a boolean indicating whether the application has permission to record audio or not.
VoiceProcessorFrameListener
Listener type for receiving audio frames from the VoiceProcessor
.
VoiceProcessorErrorListener
Listener type for receiving errors from the VoiceProcessor
.
VoiceProcessorException
Exception class for errors related to the VoiceProcessor
.