- This topic has 5 replies, 2 voices, and was last updated 10 years, 3 months ago by Halle Winkler.
November 17, 2012 at 5:18 am #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:
ContinuousModel.mm (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”);
data = [NSMutableData dataWithBytes:wavSamples length:dataLength];
file = [NSFileHandle fileHandleForWritingAtPath: @”/tmp/quickfox.wav”];
if (file == nil)
NSLog(@”Failed to open file”);
[file writeData: data];
I have started a stackoverflow.com question for this as well: http://stackoverflow.com/questions/13427619/openears-how-to-record-audio-data-to-fileNovember 18, 2012 at 11:34 am #13066
Maybe SaveThatWave does what you’d like: https://www.politepix.com/shop/savethatwavedemo. 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: https://www.politepix.com/openears/tutorialNovember 19, 2012 at 10:41 pm #13111
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.November 19, 2012 at 10:52 pm #13112
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.December 8, 2012 at 6:22 am #14831
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?December 8, 2012 at 10:13 am #14833
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 https://www.politepix.com/openears/tutorial 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?
- You must be logged in to reply to this topic.