Adding audio in tensorflow lite object detection android

Hello, Does anyone know how to add an audio when it detects an object or how to display a label and convert it to audio in the example app of object detection?

1 Like

@Xion Welcome to Tensorflow Forum!

Sure @Xion , Do you want to try some of the below tips :

Choose a suitable audio playback framework for your platform (e.g., AVFoundation on iOS, MediaPlayer on Android). Load the desired audio clip into memory. Initiate playback when an object is detected, typically within the model’s inference callback.

Incorporate a text-to-speech (TTS) library or service into your app. Retrieve the detected object’s label string from the model’s output. Pass the label text to the TTS engine to generate an audio output.
Play the synthesized speech using audio playback mechanisms.

Identify the code section responsible for drawing bounding boxes and displaying labels. Within this code, add logic to trigger audio playback upon object detection. Include the necessary TTS library or service in your project. Instead of (or in addition to) displaying the label text visually, pass it to the TTS engine for audio synthesis.

Let us know if this helps!