• 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
Re: ExtAudioFile for audio recording
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExtAudioFile for audio recording


  • Subject: Re: ExtAudioFile for audio recording
  • From: infrequent <email@hidden>
  • Date: Sun, 1 Aug 2010 16:56:41 +0100

Fernando,

You don't say what exactly what your problem is.  There are a few
potential problems that I can see (and apologies if you're aware of
any/all of these).  Firstly, you need to create the ExtAudio file ref
with the same ASBD (mine is called audioFormat) you use for the
property setting:

OSStatus err;
err = ExtAudioFileCreateWithURL((CFURLRef) recordFileURL,
									kAudioFileCAFType,
									&audioFormat,
									NULL,
									kAudioFileFlags_EraseFile,
									&recordFileRef);
Then, setting the audio file's kExtAudioFileProperty_ClientDataFormat
property is the same:
err = ExtAudioFileSetProperty(recordFileRef,
						  kExtAudioFileProperty_ClientDataFormat,
						  sizeof(AudioStreamBasicDescription),
						  &audioFormat);
My ASBD is only different to yours in that I am not setting
kLinearPCMFormatFlagIsBigEndian (only the other two).  In my
experience the majority of ASBD issues come from mFormatFlags not
being set properly so that's definitely something to look into.

Finally, note that it's necessary to 'prime the pump' (but you're
obviously running into problems before this):
err = ExtAudioFileWriteAsync(recordFileRef,
						 0,
						 NULL);
rgds

Pierre

On Sun, Aug 1, 2010 at 3:39 AM, Fernando Valente
<email@hidden> wrote:
> I'm developing an update for my radio app and I would like to let the user
> record audio. I'm trying to use ExtAudioFile with no luck. The problem is
> happening when setting the kExtAudioFileProperty_ClientDataFormat. Here's my
> code:
> AudioStreamBasicDescription mDesc;
> mDesc.mChannelsPerFrame = 1;
> mDesc.mSampleRate = 44100.0;
> mDesc.mFormatID = kAudioFormatLinearPCM;
> mDesc.mFormatFlags = kLinearPCMFormatFlagIsBigEndian |
> kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
> mDesc.mBitsPerChannel = 16;
> mDesc.mBytesPerFrame = mDesc.mChannelsPerFrame * mDesc.mBitsPerChannel / 8;
> mDesc.mFramesPerPacket = 1;
> mDesc.mBytesPerPacket = mDesc.mBytesPerFrame * mDesc.mFramesPerPacket;
> UInt32 propSize = sizeof(mDesc);
> createFile = ExtAudioFileSetProperty(ref,
> kExtAudioFileProperty_ClientDataFormat, propSize, &mDesc);
>
> Fernando Valente
> Chiaro Software
> email@hidden
> http://www.chiarosoft.com
> http://www.twitter.com/chiarosoftware
>
>  _______________________________________________
> 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
>
 _______________________________________________
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

  • Next by Date: audioqueue audiotimestamp
  • Next by thread: Re: ExtAudioFile for audio recording
  • Index(es):
    • Date
    • Thread