Using AVFoundation and OpenEars

Home Forums OpenEars Using AVFoundation and OpenEars

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

  • Author
    Posts
  • #10924
    NebulaFox
    Participant

    I am using AVFoundation to record audio and video into a mp4 file and displaying the preview using AVCapturePreviewLayer.

    If I start PocketsphinxController listening before I tell AVCaptureSession to start running, the OpenEarsLogging shows it is not detecting any sound.

    =STARTLOG
    The audio session has never been initialized so we will do that now.
    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 incorrect, we will change it.
    PreferredBufferSize is now on the correct setting of 0.128000.
    preferredSampleRateCheck is incorrect, we will change it.
    preferred hardware sample rate is now on the correct setting of 16000.000000.
    AudioSessionManager startAudioSession has reached the end of the initialization.
    Exiting startAudioSession.

    Recognition loop has started

    Starting openAudioDevice on the device.
    Audio unit wrapper successfully created.
    Set audio route to SpeakerAndMicrophone
    Checking and resetting all audio session settings.
    audioCategory is correct, we will leave it as it is.
    bluetoothInput is correct, we will leave it as it is.
    categoryDefaultToSpeaker is correct, we will leave it as it is.
    preferredBufferSize is correct, we will leave it as it is.
    preferredSampleRateCheck is correct, we will leave it as it is.
    Setting the variables for the device and starting it.
    Looping through ringbuffer sections and pre-allocating them.

    Started audio output unit.
    Calibration has started

    The Audio Session was interrupted.
    Calibration has completed
    Project has these words in its dictionary:
    RECORD
    RECORD(2)
    RECORD(3)
    SNAP
    STOP

    Listening.

    Audio route has changed for the following reason:
    There has been a change of category
    The previous audio route was SpeakerAndMicrophone
    This is not a case in which OpenEars performs a route change voluntarily. At the close of this function, the audio route is SpeakerAndMicrophone
    Audio route has changed for the following reason:
    There has been a change of category
    The previous audio route was Speaker
    This is not a case in which OpenEars performs a route change voluntarily. At the close of this function, the audio route is SpeakerAndMicrophone
    =ENDLOG

    If I start PocketsphinxController listening after I tell AVCaptureSession to start running then OpenEarsLogging shows it is detecting audio but the AVCaptureLayer displaying the feed from AVCaptureSession is frozen.

    How can I get it so that I can get PocketsphinxController listening and still have AVCaptureSession showing input via AVCaptureSession.

    #10926
    Halle Winkler
    Politepix

    Are you capturing audio at the same time as you are trying to do speech recognition?

    #10936
    NebulaFox
    Participant

    I connect the audio input to the AVCaptureSession initially and this is the point I get to while I have been testing. I do hope that it is possible to somehow use speech recognition while capturing audio.

    #10937
    Halle Winkler
    Politepix

    There’s only one audio stream, it can’t be streamed into two objects simultaneously.

    #10938
    NebulaFox
    Participant

    Is there away to copy the one audio stream and that can be sent to multiple objects?

    #10939
    Halle Winkler
    Politepix

    I don’t think that is going to be trivial. I’m sure it is in some way possible but I doubt it can be done while enjoying any of the convenience functions of AVCaptureSession or AudioSessionManager/ContinuousAudioUnit. It’s unfortunately outside of the scope of the support I can give here.

    #10940
    NebulaFox
    Participant

    That is true. Although, through AVCaptureSession I have a CMSampleBuffer that should contain an audio sample. It is a shame that can not some how be used.

    #10941
    Halle Winkler
    Politepix

    You could try keeping your sample buffers and writing them out to a WAV file and submitting the WAV file to the runRecognitionOnWavFileAtPath: method. You won’t get voice audio detection/continuous recognition but you can submit the speech at the end of the capture.

    #10942
    NebulaFox
    Participant

    Oww… I will try that

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