jimmychou

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • Author
    Posts
  • in reply to: Flite in background #1015917
    jimmychou
    Participant

    I made a mistake in my previous post.
    There should only be one instance of (no voice).
    The first instance of (no voice) should read (voice speaking).
    The Flite went silent after that.

    Sorry about that.

    in reply to: Flite in background #1015916
    jimmychou
    Participant

    Thanks for the quick response.

    Not sure if I am doing it right, I was able to make Flite speak in the background after making two changes in AudioSessionManager.m.

    1. self.soundMixing = TRUE;
    2. audioCategoryClassification = kAudioSessionCategory_MediaPlayback;

    The weird part is that the Flite can only speak one phrase after entering the background mode. It was working fine if the app is running in the foreground.

    Below are my findings after many hours of debugging:

    1. the AVAudioPlayer delegates did not get called after the [self.audioPlayer play] in the background mode.

    2. since the audioPlay did not get destroyed and neither speaking, the lazy accessory of AVAudioPlayer bypassed the initWithData when another phrase was sent to FliteController.

    3. When the app is running in the foreground, the AVAudioPlayer delegates were triggered on the main thread.

    4. However, since my app was running in another background queue (NSOperationQueue), the Application Delegate was the only application thread running on the main thread. I don’t see any log message coming out of main thread any more.

    5. I found a work around by checking to see audioPlay is playing in the lazy accessor code to destroy the audioPlayer and execute the play command again. I kind of suspect this may cause problem some where else.

    I am not clear what happen to Flite Controller, as a delegate, running in the back ground mode.

    Let me know what you think.

    Will do more investigation later.

    Thanks,

    ==============================
    logs – (907 is the main thread):
    ===============================
    4784:1803 I’m running flite
    4784:1803 Checking and resetting all audio session settings.
    4784:1803 audioCategory is correct, we will leave it as it is.
    4784:1803 bluetoothInput is correct, we will leave it as it is.
    4784:1803 categoryDefaultToSpeaker is correct, we will leave it as it is.
    4784:1803 OverrideCategoryMixWithOthers is correct, we will leave it as it is.
    4784:1803 preferredBufferSize is correct, we will leave it as it is.
    4784:1803 preferredSampleRateCheck is correct, we will leave it as it is.
    4784:1803 I’m done running flite and it took 0.306104 seconds
    4784:1803 Flite posting suspend notification
    4784:907 Flite sending suspend recognition notification.
    4784:1803 Flite audio player was nil when referenced so attempting to allocate a new audio player.
    4784:1803 Loading speech data for Flite concluded successfully.
    4784:907 AVAudioPlayer did finish playing with success flag of 1
    4784:907 Flite sending resume recognition notification.
    4784:907

    Running in the background!

    4784:390b I’m running flite
    4784:390b Checking and resetting all audio session settings.
    4784:390b audioCategory is correct, we will leave it as it is.
    4784:390b bluetoothInput is correct, we will leave it as it is.
    4784:390b categoryDefaultToSpeaker is correct, we will leave it as it is.
    4784:390b OverrideCategoryMixWithOthers is correct, we will leave it as it is.
    4784:390b preferredBufferSize is correct, we will leave it as it is.
    4784:390b preferredSampleRateCheck is correct, we will leave it as it is.
    4784:390b I’m done running flite and it took 0.216623 seconds
    4784:390b Flite posting suspend notification
    4784:390b Flite audio player was nil when referenced so attempting to allocate a new audio player.
    4784:390b Loading speech data for Flite concluded successfully.
    (no voice)
    4784:390f I’m running flite
    4784:390f Checking and resetting all audio session settings.
    4784:390f audioCategory is correct, we will leave it as it is.
    4784:390f bluetoothInput is correct, we will leave it as it is.
    4784:390f categoryDefaultToSpeaker is correct, we will leave it as it is.
    4784:390f OverrideCategoryMixWithOthers is correct, we will leave it as it is.
    4784:390f preferredBufferSize is correct, we will leave it as it is.
    4784:390f preferredSampleRateCheck is correct, we will leave it as it is.
    4784:390f I’m done running flite and it took 0.208594 seconds
    4784:390f Flite posting suspend notification
    4784:390f Loading speech data for Flite concluded successfully.
    (no voice)

    in reply to: Flite in background #1015899
    jimmychou
    Participant

    I am having a problem with flite running on an app in the background.
    As suggested by others, I tried setting AV Category to ‘AVAudioSessionCategoryPlayback’ with categoryOption to ‘AVAudioSessionCategoryOptionMixWithOthers’
    However, the Flite controller always reset the audio session to PlayAndRecord.

    As a result, it won’t do TTS when entering background thread.
    This is running on an iPhone 5 with IOS6.
    I also added the background modes ‘app play audio’ in plist.

    [log output below]

    Please help.
    Thanks,

    the log output

    // checking av session category
    myAV session category in BG: AVAudioSessionCategoryPlayback
    myAV session categoryOption in BG: 1

    // flite logging
    I’m running flite
    Checking and resetting all audio session settings.
    audioCategory is incorrect, we will change it.
    audioCategory is now on the correct setting of kAudioSessionCategory_PlayAndRecord.
    bluetoothInput is incorrect, we will change it.
    bluetooth input is now on the correct setting of 1.
    categoryDefaultToSpeaker is incorrect, we will change it.
    CategoryDefaultToSpeaker is now on the correct setting of 1.
    preferredBufferSize is correct, we will leave it as it is.
    preferredSampleRateCheck is correct, we will leave it as it is.
    I’m done running flite and it took 0.275146 seconds
    Flite audio player was nil when referenced so attempting to allocate a new audio player.
    Loading speech data for Flite concluded successfully.

    // checking av session category after flite
    myAV session category in BG after flite: AVAudioSessionCategoryPlayAndRecord
    myAV session categoryOption in BG after flite: 12

Viewing 3 posts - 1 through 3 (of 3 total)