Pulsed AVSpeechSynthesizer

Discussion in 'iOS Programming' started by keehun, Jan 11, 2015.

  1. keehun macrumors regular

    Joined:
    Mar 17, 2008
    #1
    Hi everyone,

    Is there any way to have AVSpeechSynthesizer say an utterance at regular intervals regardless of the content of what's being said?

    Things I have already tried:
    1. Scheduling my own timer (NSTimer, gcd, etc) to queue an utterance into an empty queue so it would be spoken immediately at that time
    2. Toying with pre/post utterance delay to time it

    The problem with #1 is that if I break up the chunks of the sentence into different utterances, then the Speech Synth automatically puts in pauses and it does not flow smoothly:

    I'd like to say "Up a two up a two down a two up two" in a very smooth flowing manner. I could break up each "Up/Down a #" into its own utterance and submit them at my own timed intervals, but then there are noticeable breaks in between because it's a new utterance.

    What I need is some punctuation that I could inject mid-utterance that would make AVSpeechSynth take some time. I mean hair-fraction of a second because "Up" takes shorter time to say than "Down."

    So when I try to speech-synth "down a two down a two down a two up a two down a two" then the one "up a two" takes about 2/3rds the time "down a two" takes and creates a very jarring rhythm to the line.

    Any tips? It's frustrating because I know AVSpeechSynthesizer was never meant to be used in this manner.

    Thanks
    keehun
     
  2. xArtx macrumors 6502a

    Joined:
    Mar 30, 2012
    #2
    Does it say it in a smooth flowing manner if you have the whole sentence ready to go? If so, why are you breaking it up?
    If the data you are producing, can you not build the complete sentence first before you send it to the speech synth?
     
  3. keehun thread starter macrumors regular

    Joined:
    Mar 17, 2008
    #3
    I reread my post and realized I was unbelievably unclear.

    Since the smooth flowing manner is the most important thing, I couldn't break it up.

    I was stating the option of breaking it up because it is not an option even though I had already tried it. I knew that I could control the rate in which they were queued and spoken, thus achieving my goal. Unfortunately, I cannot sacrifice the smoothness.

    I do already build it into one utterance. The problem now is "down" takes longer than "up" and thus creates this really erratic rhythm in its speech. If it was open source, I could submit a pull request... :apple:

    It seems that putting a dash after the word sort of creates a hesitation which brings the rhythm closer. Not yet good enough, but closer!
     
  4. TheWatchfulOne, Jan 12, 2015
    Last edited: Jan 12, 2015

    TheWatchfulOne macrumors 6502

    Joined:
    Jun 19, 2009
    #4
    It sounds like you are building a music app that instructs the user how to play guitar and up and down are referring to which direction to strum. And you are using the speech as a sort of metronome? Sounds cool, I hope you can get it working.

    Have you considered using "Up two three ... down two three?" that is using "two" instead of "a"? That might be easier to hear than "a"

    Or I could be way off in which case please disregard everything I said. :cool:

    And here's and idea...

    Since you need a steady beat, how about playing a MIDI file? You can assign specific notes to play different sounds including prerecorded samples. It wouldn't be using the speech synthesis but it would keep a steady beat.
     

Share This Page