Called by the SDK whenever the active input audio stream is updated. Use this method to initiate your audio processing pipeline.
The current input audio stream. This is the MediaStream object from the input device such as a microphone. You can process or analyze this stream and create a new stream that you can send over to Twilio.
The resulting audio stream after processing or analyzing the original input stream.
Called by the SDK after the original input audio stream and the processed stream has been destroyed. The stream is considered destroyed when all of its tracks are stopped and its references in the SDK are removed.
This method is called whenever the current input stream is updated. Use this method to run any necessary teardown routines needed by your audio processing pipeline.
The destroyed processed audio stream.
You can add a local AudioProcessor to the SDK to access and process the audio input stream before sending it to Twilio. Similarly, you can add a remote AudioProcessor to access and process the audio output stream before it is rendered on the speaker. • To add a processor, implement the AudioProcessor interface and use AudioHelper.addProcessor. • To remove a processor, use AudioHelper.removeProcessor. • To specify whether the processor is local or remote, use the optional isRemote parameter.
Use cases include: • Background noise removal using a noise cancellation library of your choice • Music playback when putting the call on hold • Audio filters • AI audio classification • ... and more!
The following example demonstrates how to utilize AudioProcessor APIs to use background music for local audio instead of using a microphone.