• 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: ExtAudioFileWrite Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExtAudioFileWrite Problems


  • Subject: Re: ExtAudioFileWrite Problems
  • From: Sean Kelly <email@hidden>
  • Date: Fri, 5 Aug 2005 08:09:42 -0700

It'd be easiest to diagnose this by looking at the code that creates the file and sets the client format ... I suspect there may be something wrong with one of the AudioStreamBasicDescriptions, probably the file's.

I'm an Objective-C guy, so I've been using MTCoreAudio.framework, which provides a wrapper for some parts of CoreAudio, but not ExtendedAudioFile. Anyway, here's my code:



// writing AudioBufferList to file test code - (IBAction)writeToFile:(id)sender { OSStatus result; FSRef directory; ExtAudioFileRef ref;

// get -48 if file already exists, so remove the file
[[NSFileManager defaultManager] removeFileAtPath:@"/tmp/ test.m4a" handler:nil];


    // directory to save to
    result = FSPathMakeRef ("/tmp", &directory, NULL);

    if(result != noErr) {
        NSLog(@"FSPathMakeRef");
        return;
    }

// get an AudioStreamBasicDescription for the recorded data
MTCoreAudioStreamDescription *streamDesc = [inDevice streamDescriptionForChannel:0 forDirection:kMTCoreAudioDeviceRecordDirection];
AudioStreamBasicDescription desc = [streamDesc audioStreamBasicDescription];


// this is used to get an AudioChannelLayout
SKMTCoreAudioDeviceWrapper *wrapper = [[SKMTCoreAudioDeviceWrapper alloc] initWithContainedDevice:inDevice];


    result = ExtAudioFileCreateNew(&directory,
                                   (CFStringRef)@"test.m4a",
                                   kAudioFileM4AType,
                                   &desc,
                                   [wrapper audioChannelLayout],
                                   &ref);

    if(result != noErr) {
        NSLog(@"CreateNew %d", result);
        return;
    }

// count provides the number of frames in the buffer list
result = ExtAudioFileWrite(ref, [_tempAudioBuffer count], [_tempAudioBuffer bufferList]);


    if(result != noErr) {
        NSLog(@"Write %d", result);
        return;
    }

    [wrapper release];
    ExtAudioFileDispose(ref);
}


Much thanks for your help,

Sean Kelly


What are the file and client data formats you've set on the ExtAudioFile?

For the file, I've tried m4a and mpeg4. The client data is Linear PCM.



I'm new to audio programming and am writing a test program for ExtendedAudioFile. It can currently record audio into an AudioBufferList and play this audio back. I'm trying to write the AudioBufferList out to a file. Everything goes well until I call ExtAudioFileWrite, which always returns -66567.

I've looked through the documentation and can't find anything about error -66567. Any ideas, or is there any sample code out there for ExtendedAudioFile? I've been unable to find any.







_______________________________________________ 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
References: 
 >ExtAudioFileWrite Problems (From: Sean Kelly <email@hidden>)
 >Re: ExtAudioFileWrite Problems (From: Doug Wyatt <email@hidden>)
 >Re: ExtAudioFileWrite Problems (From: Sean Kelly <email@hidden>)
 >Re: ExtAudioFileWrite Problems (From: Doug Wyatt <email@hidden>)

  • Prev by Date: RE: synchronization issue with Logic 7.1- help please
  • Next by Date: Re: synchronization issue with Logic 7.1- help please
  • Previous by thread: Re: ExtAudioFileWrite Problems
  • Next by thread: RE: AudioUnitSetRenderNotification() returns badComponentSelector
  • Index(es):
    • Date
    • Thread