Changing voice level of flitecontroller

Home Forums OpenEars Changing voice level of flitecontroller

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

  • Author
    Posts
  • #11445
    kelvin
    Participant

    Hi Halle,

    I would like to change the volume. So i have created a UISlider call volumeSlider and i have add a line of code to

    – (void) updateLevelsUI { // And here is how we obtain the levels. This method includes the actual OpenEars methods and uses their results to update the UI of this view controller.
    [fliteController.audioPlayer setVolume:volumeSlider.value];
    self.pocketsphinxDbLabel.text = [NSString stringWithFormat:@”Pocketsphinx Input level:%f”,[self.pocketsphinxController pocketsphinxInputLevel]]; //pocketsphinxInputLevel is an OpenEars method of the class PocketsphinxController.

    if(self.fliteController.speechInProgress == TRUE) {
    self.fliteDbLabel.text = [NSString stringWithFormat:@”Flite Output level: %f”,[self.fliteController fliteOutputLevel]]; // fliteOutputLevel is an OpenEars method of the class FliteController.
    }
    }

    The volume did change accordiongly to the slider but instead of pronouncing the 1st hypothesis, it repeats the “Welcome to OpenEars” statement. After that it did pronounce the 2nd hypothesis. What could be wrong?

    #11450
    Halle Winkler
    Politepix

    There are a lot of things here that are an issue. updateLevelsUI in the sample app is just intended to be a way to show how you can read the read-only levels property on a separate thread so it doesn’t block. It is called many times a second. That means that your slider/volume code is being continuously hit whether it is being interacted with or not as the method just tries to read the read-only flite level property and display it in the UI, and it also means that your volume is being changed from the thread that the AVAudioPlayer it addresses is definitely not on. I would first totally uncouple your volume changing/volume slider code from the UI updating example that is in the sample app. You should be able to change the volume and update your UI whose purpose is changing the volume on mainThread in a normal method which returns IBAction and which only is concerned with letting the user change the volume. The updateUI method can continue to just handle reading the level and displaying it in the UI.

    If the “Welcome to OpenEars” statement continues to be played at unexpected times after that, that probably means that something in the code is causing an interruption that causes the entire listening loop to be reset, resulting in pocketsphinxDidCompleteCalibration being called, which in the sample app results in “Welcome to OpenEars” being spoken.

    #11456
    kelvin
    Participant

    Thanks for the advice. Got it to work in the IBAction with [self.fliteController.audioPlayer setVolume:volumeSlider.value];

    #11457
    Halle Winkler
    Politepix

    Super, glad it’s working for you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.