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

Writing file from raw audio in memory?


  • Subject: Writing file from raw audio in memory?
  • From: Jeff LaMarche <email@hidden>
  • Date: Thu, 05 Jun 2008 15:15:14 -0400

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.

Thanks in advance,
Jeff
 
 _______________________________________________
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: Writing file from raw audio in memory?
      • From: Jeff Moore <email@hidden>
  • Prev by Date: Re: Native Device Formats
  • Next by Date: Re: Writing file from raw audio in memory?
  • Previous by thread: Re: Native Device Formats
  • Next by thread: Re: Writing file from raw audio in memory?
  • Index(es):
    • Date
    • Thread