Recording OpenEars Audio Input to File

Home Forums OpenEars Recording OpenEars Audio Input to File

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

  • Author
  • #13054

    Hello, I have OpenEars working in my application but desperately need to record the audio to file. Any example of how to do this would be helpful. Here is the approach I have tried so far which does not work: (Line 1322) :

    NSUInteger dataLength = [wavData length];
    SInt16 *wavSamples = (SInt16*)malloc(dataLength);
    memcpy(wavSamples, [wavData bytes], dataLength);

    /***** WRITE The WAV DATA TO FILE ******/
    NSLog(@”Writing to file”);

    NSFileHandle *file;
    NSMutableData *data;

    data = [NSMutableData dataWithBytes:wavSamples length:dataLength];

    file = [NSFileHandle fileHandleForWritingAtPath: @”/tmp/quickfox.wav”];

    if (file == nil)
    NSLog(@”Failed to open file”);

    [file writeData: data];
    [file closeFile];
    [file release];

    I have started a question for this as well:

    Halle Winkler


    Maybe SaveThatWave does what you’d like: It wraps up starting/stopping non-blocking WAV saving from incoming speech, and notifications that the file was recorded with the path to the recording as part of the notification, handles logic for suspending/resuming and other corner cases, and wraps up deleting a single recording and deleting all recordings. You can use the tutorial tool to integrate it very easily:


    Halle, it does, and you are a sexy man! This is exactly what i was looking for. I am getting an error during installation that pocketsphinxController.outputAudio is undefined. I’m not sure how to tell which version of OpenEars i’m running. This may be a huge problem for me because I have somewhat heavily modified OpenEars for my project and it may have been based on a version that does not have this method.

    Halle Winkler

    Right, you’ll need at least version 1.2 for plugin compatibility. Can you download current version 1.2.4, diff your customizations and reintegrate them into it? There are a few nice additions and fixes since the version you must be working with, so it’s probably worthwhile.

    Generally the version can be found in the OpenEars.xcodeproj source files in the comments at the top, and in a file called Version.txt in the root of the OpenEars directory. Since 1.2 it is also shown in the manual and in OpenEarsLogging.


    When attempting to link the SaveThatWaveDemo I get the following linker error:

    “_input_sample_rate”, referenced from:
    -[SaveThatWaveController bufferIsAvailable:] in SaveThatWaveDemo(SaveThatWaveController.o)
    -[SaveThatWaveController pocketsphinxDidDetectFinishedSpeech] in SaveThatWaveDemo(SaveThatWaveController.o)

    This seems to be a valid error since the variable in OpenEars 1.2.4 is actually called “input_sample_rate”.

    Could you please provide a new binary for SaveThatWaveController.o?

    Halle Winkler

    The underscore is part of the linker reporting, it isn’t related to the binary which definitely works with the current version of OpenEars.

    This is an normal issue with installing the plugin — can you make sure that you’ve followed all of the steps in the tutorial at including adding the -ObjC linker flag in the right place and making sure that your project isn’t still linked to an old version of OpenEars?

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