• 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: Writing file from raw audio in memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing file from raw audio in memory?


  • Subject: Re: Writing file from raw audio in memory?
  • From: Jeff Moore <email@hidden>
  • Date: Thu, 5 Jun 2008 12:25:05 -0700

The API you are looking for is the Extendend Audio File API in <AudioToolbox/ExtendedAudioFile.h>. In particular, you'll want to use ExtAudioFileWriteAsync as that offloads the actual writing of the data to a worker thread.

On Jun 5, 2008, at 12:15 PM, Jeff LaMarche wrote:

I'm doing a playthrough from selected input to selected output, running it through a variable speed conversion AU. In my record call back procedure, I'm buffering the raw data before I process it  because the output will generally be the line out and the conversion will cause a downsampling that I don't want in the final file. The buffering is done like so:

const AudioBuffer *buffer;
buffer = &inInputData->mBuffers[0];
if (lastIndex + buffer->mDataByteSize> bufferSize)
// cancels recording
else
{
memcpy(soundBuffer + lastIndex, buffer->mData, buffer->mDataByteSize);
lastIndex += buffer->mDataByteSize;
}

soundBuffer is just defined as:

unsigned char *soundBuffer;

Is there an easy way to write this raw data to an AIFF file without messing with callbacks and devices? The documentation and sample code all show how to write a file from AudioBufferList *s in the device callback, but I don't want to put it out to disk unless the user presses a button to approve it, at which time I've got the data in memory (these are short sound recordings) already.

Any help or suggestions would be greatly appreciated.



-- 

Jeff Moore
Core Audio
Apple


 _______________________________________________
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: 
 >Writing file from raw audio in memory? (From: Jeff LaMarche <email@hidden>)

  • Prev by Date: Writing file from raw audio in memory?
  • Next by Date: Writing to File
  • Previous by thread: Writing file from raw audio in memory?
  • Next by thread: Writing to File
  • Index(es):
    • Date
    • Thread