ConvertInput error in pocketsphinxDidReceiveHypothesis

Home Forums OpenEars ConvertInput error in pocketsphinxDidReceiveHypothesis

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

  • Author
    Posts
  • #11604
    cgunn
    Participant

    Inside pocketsphinxDidReceiveHypothesis I am seeing the error message
    aq@0x90ee000: ConvertInput using invalid anchor time

    And if OpenEarsLogging is turned on, it is then followed by
    Error -66681: Unable to start the Audio Queue.

    This error appears when I make the first method call out from within the pocketsphinxDidReceiveHypothesis method.

    For example, I create a simple method, dummy(), which gets called from within pocketsphinxDidReceiveHypothesis. The error appears when this method is called:
    – (void) pocketsphinxDidReceiveHypothesis:(NSString *)hypothesis recognitionScore:(NSString *)recognitionScore utteranceID:(NSString *)utteranceID {
    [self dummy]; /// DEBUG
    …..
    …..

    And from that point on, no fliteController output occurs and no more speech recognition occurs.
    My code has previously worked fine, so It seems to be something I have changed, but I have been unable to track down what it is. Any suggestions?

    #11605
    cgunn
    Participant

    OK, I’ve discovered something more about this. This error seems to occur because the class that this code is in is both an OpenEarsEventsObserverDelegate and an AVAudioPlayerDelegate.

    @interface Speech : NSObject

    This is because it plays some pre-recorded sound clips as well as fliteController output, and I want to know when the clips are started and finished so i can turn off speech recognition during those sounds.
    If I remove the ‘AVAudioPlayerDelegate’, I seem to be able run consistently without the error occurring.

    Is it valid to have the class as a delegate of both? Could there be some conflict that is causing this error and lock-up?

    #11607
    Halle Winkler
    Politepix

    Interesting. We know that there isn’t an inherent conflict between a class inheriting the delegate protocols of OpenEarsEventsObserver and AVAudioPlayer because FliteController inherits the delegate protocols of both. But I don’t think your interpretation is offbase because there is a lot going on there — the recognition audio unit, FliteController’s audio and its callbacks, and your audio and its callbacks.

    Do you want to show me some logs featuring OpenEarsLogging and verbosePocketSphinx for the timeframe in which this is occurring? Maybe there are some hints.

    Something to just double-check is that a lot of AVAudioPlayer sample code contains unneeded calls to AVAudioSession and a lot of developers who asked me about similar issues found calls to the audio session in their code that were responsible. It might be worth a quick project-wide search for “audiosession” without case matching to make sure that some audio session overrides didn’t sneak in there.

    #11610
    cgunn
    Participant

    OK, I’ve done what you suggested, but first, something didn’t paste correctly in my earlier message, because it got the angle brackets confused with html brackets. The line
    @interface Speech : NSObject
    should have shown as

    @interface Speech : NSObject {OpenEarsEventsObserverDelegate, AVAudioPlayerDelegate}

    (except replace the braces with angle brackets).

    A search for AudioSession revealed the two methods: audioSessionInterruptionDidBegin and audioSessionInterruptionDidEnd, but commenting them out didn’t fix the problem. Here is the output:

    2012-10-14 15:36:19.525 RR[66801:c07] VC Pocketsphinx calibration is complete.
    2012-10-14 15:36:19.526 RR[66801:c07] Speech: Pocketsphinx calibration is complete.
    2012-10-14 15:36:28.107 RR[66801:1f07] Speech detected…
    2012-10-14 15:36:29.864 RR[66801:1f07] Processing speech, please wait…
    2012-10-14 15:36:29.869 RR[66801:1f07] Pocketsphinx heard “START” with a score of (-1557) and an utterance ID of 000000000.
    2012-10-14 15:36:29.870 RR[66801:c07] The received hypothesis is START with a score of -1557 and an ID of 000000000

    — here i make a call to my dummy() function – (void) dummy { NSLog(@”dummy”);} —

    2012-10-14 15:36:40.707 RR[66801:1f07] aq@0x9671000: ConvertInput using invalid anchor time
    Error -66681: Unable to start the Audio Queue.
    2012-10-14 15:36:40.708 RR[66801:1f07] Listening.
    2012-10-14 15:36:40.708 RR[66801:c07] dummy

    #11613
    cgunn
    Participant

    Also, the above output is followed by the line

    2012-10-14 16:15:29.380 RR[68064:c07] Flite sending interrupt speech request.

    before returning to the main loop.

    And to complicate it a bit more, i have now removed the inheritance from AVAudioPlayerDelegate, which fixed the problem yesterday, but now i am still getting the error – so it may not have been the cause.

    #11614
    cgunn
    Participant

    I’ve now discovered that it seems to be to do with having 2 OpenEarsEventsObserverDelegates in the system. I had my main ViewController as an OpenEarsEventsObserverDelegate so that it can change the user interface when fliteController output starts and stops. i also had another class, Speech, as a second OpenEarsEventsObserverDelegate so that it can process the speech. In my view controller, if i set the delegate to ‘this’, the error occurs, but if i omit that line (leaving only one delegate in the system – the Speech class), the error does not occur. So i think i can reorganise my code to have only one delegate and have it inform the other class of the OpenEars events when they occur.

    #11615
    Halle Winkler
    Politepix

    That is a little bit unlikely as the underlying cause since OpenEars itself has at least two OpenEarsEventsObservers instantiated internally, then add your first one and you’re up to a minimum of three out of the gate.

    Not debating that it is helping the issue you are seeing, just that it is probably ultimately due to something else. I haven’t seen the full logs and I imagine there are nuances to the code that can’t be put across via small snippets but it would be great if you could email me a stripped-down test case. Looking at this report of the same issue, it really looks like the audio session category is being overridden somewhere:

    http://stackoverflow.com/questions/5215919/convertinput-using-invalid-anchor-time-error-received-when-recording-on-device

    #13605
    cgunn
    Participant

    Thanks for this answer – I’m sure you are right – there must have been some memory corruption somewhere that was causing this side effect. I have now completely rewritten my app and have not (yet!) seen the problem.

    #13608
    Halle Winkler
    Politepix

    Cool, I’m glad to hear you’ve seen an improvement and I appreciate your updating the thread.

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