• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Empty file created with ExtAudioFileWrite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Empty file created with ExtAudioFileWrite


  • Subject: Empty file created with ExtAudioFileWrite
  • From: Lee Falin <email@hidden>
  • Date: Sat, 15 Jul 2006 16:54:10 -0400

I'm trying to write out some data that I have recorded from the internal microphone to a file. I want the format to be Apple IMA4.

I'm using a combination of MTCoreAudio and ExtAudioFile APIs and I have gotten things to work pretty well.

I can record audio, and use MTCoreAudio to play it back, however when I write the file with ExtAudioFileWrite, the file is created, there are no errors from any of the ExtAudioFile function calls, and Quicktime can open and play the file. However the file contains no data. (ie it has an audio track of duration 00:00)

I know there is audio in the buffer, because I can play it back via MTCoreAudio.

Here is the code that I am using to try and write the file:

//Get file path
NSString *savePath = [[NSString alloc] initWithString:@"~/"];
NSString *fileNameString = [[NSString alloc] initWithString:@"test2.aiff"];
const char *recordFileName = [[savePath stringByExpandingTildeInPath] cString];
FSRef parentDir;
CFStringRef filename = (CFStringRef)fileNameString;
Boolean isDir = YES;
FSPathMakeRef((const UInt8 *)recordFileName,&parentDir,&isDir);


//Set output format
AudioStreamBasicDescription outdesc;
UInt32 size;
outdesc.mSampleRate = 44100;
outdesc.mFormatID = kAudioFormatAppleIMA4;
outdesc.mChannelsPerFrame = 2;
size = sizeof(outdesc);
AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &outdesc);


//Write the file
ExtAudioFileRef outRef;
OSErr test1 = ExtAudioFileCreateNew (&parentDir,filename,kAudioFileAIFCType,&outdesc,nil,&outRef);
OSErr test2 = ExtAudioFileWrite(outRef,sizeof(outputData),outputData);
OSErr test3 = ExtAudioFileDispose(outRef);


Can someone tell me what I am missing? I realize that I'm probably doing this wrong:

OSErr test2 = ExtAudioFileWrite(outRef,sizeof(outputData),outputData);

But I wasn't sure whre to get the number of frames from.


Thanks, lee

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Empty file created with ExtAudioFileWrite
      • From: Doug Wyatt <email@hidden>
  • Prev by Date: Using aggregate devices with iSight
  • Next by Date: Re: Using aggregate devices with iSight
  • Previous by thread: Re: Using aggregate devices with iSight
  • Next by thread: Re: Empty file created with ExtAudioFileWrite
  • Index(es):
    • Date
    • Thread