NeatSpeech not playing audio after stopping

Home Forums OpenEars plugins NeatSpeech not playing audio after stopping

Tagged: 

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

  • Author
    Posts
  • #1024269
    lfoster0
    Participant

    Hey there, heres a description of the issue I’m having:

    I call sayWithNeatSpeech and it begins reading the text I gave it, then at some point the user hits a button to stop it via the OEFliteController stopSpeaking, and that works correctly. The issue comes up when the user hits the button again and I call sayWithNeatSpeech with the same text and nothing happens, no audio is read.

    I initialize the voice controller and voice as follows:

    self.voiceController = [[OEFliteController alloc] init];
        self.voice = [[EmmaAlternate alloc] initWithPitch:0.0 speed:0.0 transform:0.0];

    and then here is the toggleAudio method which is the button press.

    - (void) toggleAudio {
        NSLog(@"pressed");
        if (self.audioEnabled) {
            [self.voiceController sayWithNeatSpeech:self.currentTrip.trip_description withVoice:self.voice];
        }
        else {
            [self.voiceController stopSpeaking];
        }
        self.audioEnabled  = !self.audioEnabled;
    }
    

    Any help would be appreciated and I can provide any other code or logging you need, thanks!

    #1024271
    Halle Winkler
    Politepix

    Welcome,

    Sorry for the issue. A couple of questions – is this a change in behavior from 1.x or have you only used OpenEars 2.x? In what method do you initialize the objects? Have you checked that the text has content at the second call and that self.audioEnabled is true at the second call?

    #1024338
    lfoster0
    Participant

    Thanks for the quick response, I really appreciate it :)

    I have only used OpenEars 2.x and I’m initializing the objects in – viewDidLoad.

    Here is the code with some more logging:

    - (void) toggleAudio {
        NSLog(@"pressed");
        NSLog(@"Audio Enabled: %i",self.audioEnabled);
        if (self.audioEnabled) {
            NSLog(@"saying text: %@", self.currentTrip.trip_description);
            [self.voiceController sayWithNeatSpeech:self.currentTrip.trip_description withVoice:self.voice];
        }
        else {
            [self.voiceController stopSpeaking];
        }
        self.audioEnabled  = !self.audioEnabled;
    }
    
    - (void) neatSpeechWillSay:(NSString *)statement {
        NSLog(@"neatSpeechWillSay %@",statement);
    }
    
    - (void) fliteDidStartSpeaking {
        NSLog(@"SPEEEEAAKKKINNNGGGGG");
    }
    
    - (void) fliteDidFinishSpeaking {
        NSLog(@"DONE SPEAKING");
    }
    

    Here is the log from pressing the button 3 times:

    So the first time I press it everything is fine:

    2015-01-15 14:19:06.773 gyyde[11166:60b] pressed
    2015-01-15 14:19:06.789 gyyde[11166:60b] Audio Enabled: 1
    2015-01-15 14:19:06.792 gyyde[11166:60b] saying text: The route of the tour can be seen on the above map; we begin by walking out of the civic plaza, along 7th until we reach City Hall and the Cenotaph and the beginning of George Street.  We then walk down George Street until 3rd Avenue.  We follow 3rd avenue for 3 blocks until we reach Brunswick Street.  We walk up Brunswick street until 5th Avenue, back towards the library for one block along 5th, we turn left down Quebec and then right onto 4th Avenue to see a few more historic sites before turning right onto Dominion and heading back to the Civic Plaza and the Library for the end of our tour.
    2015-01-15 14:19:06.867 gyyde[11166:60b] SPEEEEAAKKKINNNGGGGG

    And then I give it a few seconds to read through things and we have:

    2015-01-15 14:19:10.936 gyyde[11166:60b] neatSpeechWillSay The route of the tour can be seen on the above map;
    2015-01-15 14:19:13.994 gyyde[11166:60b] neatSpeechWillSay we begin by walking out of the civic plaza,

    I press it again and it stops fine, and self.audioEnabled is 0:

    2015-01-15 14:19:20.589 gyyde[11166:60b] pressed
    2015-01-15 14:19:20.596 gyyde[11166:60b] Audio Enabled: 0

    And then pressing it again I get:

    2015-01-15 14:19:39.745 gyyde[11166:60b] pressed
    2015-01-15 14:19:39.748 gyyde[11166:60b] Audio Enabled: 1
    2015-01-15 14:19:39.751 gyyde[11166:60b] saying text: The route of the tour can be seen on the above map; we begin by walking out of the civic plaza, along 7th until we reach City Hall and the Cenotaph and the beginning of George Street.  We then walk down George Street until 3rd Avenue.  We follow 3rd avenue for 3 blocks until we reach Brunswick Street.  We walk up Brunswick street until 5th Avenue, back towards the library for one block along 5th, we turn left down Quebec and then right onto 4th Avenue to see a few more historic sites before turning right onto Dominion and heading back to the Civic Plaza and the Library for the end of our tour.

    So self.audioEnabled is true the next time and it still has the correct text to say again. I left it sitting there for a few minutes and nothing happened :(

    Thanks!

    #1024342
    Halle Winkler
    Politepix

    OK, thanks for the follow-up info – I will see if this replicates for me and get back to you on it.

    #1024366
    Halle Winkler
    Politepix

    OK, this doesn’t replicate for me in my test – I can speak, stop the speech at an arbitrary point, and say speech again afterwards using the same voice. That doesn’t mean I don’t think you’re seeing a real issue, just that it didn’t immediately replicate for me so there is maybe some other factor involved that I’ll need your assistance to see.

    For further troubleshooting, the next step would be for you to create a minimal replication case to share with me, so I can see the exact thing you are seeing in your local setup:

    https://www.politepix.com/forums/topic/how-to-create-a-minimal-case-for-replication/

    #1024381
    lfoster0
    Participant

    Sorry, just having a little trouble setting up the demo application with neat speech. Here is the error I’m getting:

    Undefined symbols for architecture armv7:
      "_OBJC_CLASS_$_EmmaAlternate", referenced from:
          objc-class-ref in ViewController.o
    ld: symbol(s) not found for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    I set up the project like it said here https://www.politepix.com/neatspeech/ with the -ObjC linker flag, .mm and the libstdc++ set. I have the voices inside of the Framework folder as well for the demo version. Thanks!

    #1024383
    Halle Winkler
    Politepix

    OK, that just looks like the EmmaAlternate voice isn’t really available to the project. This can happen if the voice framework isn’t added to the app target, or if the build setting Framework Search Paths has somehow gotten an invalid value.

    #1024401
    lfoster0
    Participant

    Alright so here is ViewController.mm

    //  ViewController.m
    //  OpenEarsSampleApp
    //
    //  ViewController.m demonstrates the use of the OpenEars framework. 
    //
    //  Copyright Politepix UG (haftungsbeschränkt) 2014. All rights reserved.
    //  https://www.politepix.com
    //  Contact at https://www.politepix.com/contact
    //
    //  This file is licensed under the Politepix Shared Source license found in the root of the source distribution.
    
    #import "ViewController.h"
    
    @implementation ViewController
    
    #pragma mark View Lifecycle
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        [self.audioToggleButton addTarget:self action:@selector(toggleAudio) forControlEvents:UIControlEventTouchUpInside];
        
        
        self.openEarsEventsObserver = [[OEEventsObserver alloc] init];
        [self.openEarsEventsObserver setDelegate:self];
        self.audioEnabled = YES;
        
        self.voiceController = [[OEFliteController alloc] init];
        self.voice = [[EmmaAlternate alloc] initWithPitch:0.0 speed:0.0 transform:0.0];
        
        self.tripDescription = @"The route of the tour can be seen on the above map; we begin by walking out of the civic plaza, along 7th until we reach City Hall and the Cenotaph and the beginning of George Street.  We then walk down George Street until 3rd Avenue.  We follow 3rd avenue for 3 blocks until we reach Brunswick Street.  We walk up Brunswick street until 5th Avenue, back towards the library for one block along 5th, we turn left down Quebec and then right onto 4th Avenue to see a few more historic sites before turning right onto Dominion and heading back to the Civic Plaza and the Library for the end of our tour.";
        
    }
    
    - (void) toggleAudio {
        NSLog(@"pressed");
        NSLog(@"Audio Enabled: %i",self.audioEnabled);
        if (self.audioEnabled) {
            NSLog(@"saying text: %@", self.tripDescription);
            [self.voiceController sayWithNeatSpeech:self.tripDescription withVoice:self.voice];
        }
        else {
            [self.voiceController stopSpeaking];
        }
        self.audioEnabled  = !self.audioEnabled;
    }
    
    - (void) neatSpeechWillSay:(NSString *)statement {
        NSLog(@"neatSpeechWillSay %@",statement);
    }
    
    - (void) fliteDidStartSpeaking {
        NSLog(@"SPEEEEAAKKKINNNGGGGG");
    }
    
    - (void) fliteDidFinishSpeaking {
        NSLog(@"DONE SPEAKING");
    }
    
    @end
    

    Here is ViewController.h

    //  ViewController.h
    //  OpenEarsSampleApp
    //
    //  ViewController.h demonstrates the use of the OpenEars framework. 
    //
    //  Copyright Politepix UG (haftungsbeschränkt) 2014. All rights reserved.
    //  https://www.politepix.com
    //  Contact at https://www.politepix.com/contact
    //
    //  This file is licensed under the Politepix Shared Source license found in the root of the source distribution.
    
    #import <UIKit/UIKit.h>
    #import <OpenEars/OEEventsObserver.h>
    #import <EmmaAlternate/EmmaAlternate.h>
    #import <OpenEars/OEFliteController.h>
    #import <NeatSpeechDemo/OEFliteController+NeatSpeech.h>
    
    @interface ViewController : UIViewController <OEEventsObserverDelegate> // This is how we implement the delegate protocol of OEEventsObserver.
    
    @property (weak, nonatomic) IBOutlet UIButton *audioToggleButton;
    
    /* Audio Related */
    @property (nonatomic) BOOL audioEnabled;
    @property (strong, nonatomic) OEEventsObserver *openEarsEventsObserver;
    @property (strong, nonatomic) OEFliteController *voiceController;
    @property (strong, nonatomic) NeatSpeechVoice *voice;
    @property (strong,nonatomic) NSString *tripDescription;
    
    @end
    

    And in the ViewController_iPhone.xib I deleted everything and just added a single button hooked up to
    @property (weak, nonatomic) IBOutlet UIButton *audioToggleButton;

    Same issue as before running on my iPhone 4 running iOS 7.0

    Hope this helps, let me know if theres any other information I can provide!

    #1024413
    Halle Winkler
    Politepix

    OK, thanks for the replication case, I was able to see the issue and I’ll investigate it.

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