Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:51:39+00:00 2026-06-01T22:51:39+00:00

An Android book I have states that using TextToSpeech.playEarcon() is preferable to playing audio

  • 0

An Android book I have states that using TextToSpeech.playEarcon() is preferable to playing audio files (using MediaPlayer) because:

Instead of having to determine the opportune moment to play an audible
cue and relying on callbacks to get the timing right, we can instead
queue up our earcons among the text we send to the TTS engine. We then
know that our earcons will be played at the appropriate time, and we
can use the same pathway to get our sounds to the user, including the
onUtteranceCompleted() callbacks to let us know where we are.

But my short and simple experiment with this shows this isn’t the case:

String utteranceId = String.valueOf(utteranceNum++);
params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, utteranceId);
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_MUSIC));
tts.speak("FIRST part of sentence", TextToSpeech.QUEUE_ADD, params);

utteranceId = String.valueOf(utteranceNum++);
params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, utteranceId);
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_MUSIC));
tts.playEarcon("[fancyring]", TextToSpeech.QUEUE_ADD, params);

utteranceId = String.valueOf(utteranceNum++);
params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, utteranceId);
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, String.valueOf(AudioManager.STREAM_MUSIC));
tts.speak("SECOND part of sentence", TextToSpeech.QUEUE_ADD, params);

When I examine the logs from onUtteranceCompleted() I only see the utteranceIds of the ones played by tts.speak(), not the one played by tts.playEarcon().

Why is this discrepancy? Is there a workaround for this?

P.S. At the risk of stating the obvious: All three utterances are played out fine and at the right order. It is only the onUtteranceCompleted() that isn’t called for some reason for the tts.playEarcon().

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:51:41+00:00Added an answer on June 1, 2026 at 10:51 pm

    Answering myself. The incredibly long and very detailed documentation about TextToSpeech.OnUtteranceCompletedListener reads (the emphasis is mine):

    Called when an utterance has been synthesized.

    An earcon is never a result of synthesization, so of course onUtteranceCompleted() will never be called for it. This is by design.

    Which gets us back to a new question: If there is no advantage to earcons over playing .mp3 files (using MediaPlayer), why use earcons at all?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an book that's supposed to teach everything about Android programming. Unfortunately that
So I'm writing an android app that needs to grab book price data from
Android 4.0 phones only have virtual buttons, which actually go invisible when playing youtube/video
I am using Android emulator with AVD of Android 2.1 and I have the
I have created a book that each page is a JPG picture (believe me,
I have a simple mobile app in Titanium that I'm using to debug the
I have bought a book (Beginning Android Games) by Mario Zechner. On page 149,
I am totally new to Android . I am using the book Hello, Android.
I have been following a book on Android Beginning Android Application. I have been
My second book for Android programming Hello, Android by Ed Burnette. I'm using eclipse.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.