Re: recording to aac
Re: recording to aac
- Subject: Re: recording to aac
- From: Nadas Peter <email@hidden>
- Date: Thu, 23 Mar 2006 17:40:29 +0100
just for the archives:
the ExtAudioFileSetProperty() avaits the data format of the _input_
source, not the file's format.
so now everything runs fine, my IOProc writes the compressed data, so
after a hard week I'm happy now:)
Big thanks for David:)
Peter
On 2006.03.23., at 14:08, Nadas Peter wrote:
Hi,
I'm trying to record audio from the default input device. I've got
it working using the uncompressed format 'lpcm' in format types
'caff' and 'AIFF'.
I use the ExtAudioFile api, and MTCoreAudio. (I'm working mainly in
objective-c)
But my aim is to record directly to a compressed audio format, like
AAC, and this is where ExtAudioFileSetProperty
returns with an error code of -66563, which means
kExtAudioFileError_NonPCMClientFormat.
I'm a bit lost with this, and can't figure out, why I can't set the
file format to aac (or any other compressed format).
Here is the code i use for file creation:
OSStatus err;
FSRef directory;
AudioStreamBasicDescription outdesc;
UInt32 size;
outdesc.mSampleRate = 44100;
outdesc.mFormatID = kAudioFormatMPEG4AAC;
outdesc.mChannelsPerFrame = 2;
size = sizeof(outdesc);
err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0,
NULL, &size, &outdesc);
[[NSFileManager defaultManager] removeFileAtPath:[NSString
stringWithFormat:@"%@/Desktop/dummy.m4a",NSHomeDirectory()]
handler:nil];
err = FSPathMakeRef((const UInt8 *)[[NSString stringWithFormat:@"%
@/Desktop/",NSHomeDirectory()] fileSystemRepresentation],
&directory, NULL);
if (err) NSLog(@"FSPathMakeRef: %d",err);
err = ExtAudioFileCreateNew(&directory,(CFStringRef)
@"dummy.m4a",kAudioFileM4AType,&outdesc,NULL,&recordingFileRef);
if (err) NSLog(@"CreateNew %d",err);
err = ExtAudioFileSetProperty
(recordingFileRef,kExtAudioFileProperty_ClientDataFormat,sizeof
(AudioStreamBasicDescription),&outdesc);
if (err) NSLog(@"ExtAudioFileSetProperty %d",err);
At the end, i get an error:
2006-03-23 13:24:01.401 DummyRecorder[7526] ExtAudioFileSetProperty
-66563
Can someone tell me, why does this code work for some formats, and
not for the others?
I'm surely missing something, but all I found in Apple's developer
examples (afrecord, and ConvertFile), was this so far.
(I didn't get the PublicUtility to work in my project.. is there a
way to include that api into objective-c code?)
thanks,
Peter
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
407miles.hu
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