Skip to content

fix(AI): Route audio to speaker instead of earpiece #7179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ internal class AudioHelper(
fun build(): AudioHelper {
val playbackTrack =
AudioTrack(
AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION).build(),
AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
Comment on lines +167 to +168
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider making the content type configurable instead of hardcoding it to CONTENT_TYPE_SPEECH. While speech is the primary use case, the LiveSession handles generic audio data, and the generative model could potentially return other types of audio (e.g., sound effects). Using CONTENT_TYPE_UNKNOWN as the default might be a safer, more general-purpose choice.

          AudioAttributes.Builder()
            .setUsage(AudioAttributes.USAGE_MEDIA)
            //.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
            .build(),

.build(),
AudioFormat.Builder()
.setSampleRate(24000)
.setChannelMask(AudioFormat.CHANNEL_OUT_MONO)
Expand Down