• 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: Modifying afrecord sample file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying afrecord sample file


  • Subject: Re: Modifying afrecord sample file
  • From: Doug Wyatt <email@hidden>
  • Date: Mon, 17 May 2004 14:02:55 -0700

On May 13, 2004, at 14:50, Bruno Blondeau wrote:
I'm trying to modify the afrecord.cpp sample file so as to use AAC encoding instead of the PCM/AIFF one.

Could anyone explain me what to change?


const int kNumberBuffers = 3;
const unsigned kBufferSize = 0x8000;
CAAudioFile file;
CAAudioFileRecorder recorder(kNumberBuffers, kBufferSize);
CAStreamBasicDescription dataFormat;
dataFormat.mSampleRate = 44100.; // later get this from the hardware
dataFormat.mFormatID = kAudioFormatLinearPCM;
dataFormat.mFormatFlags = kAudioFormatFlagIsBigEndian | kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
dataFormat.mFramesPerPacket = 1;
dataFormat.mChannelsPerFrame = 2;
dataFormat.mBitsPerChannel = 16;
dataFormat.mBytesPerPacket = dataFormat.mBytesPerFrame = 4;

dataFormat.mFormatID = kAudioFormatMPEG4AAC;
/* don't need to initialize any other members, the CAStreamBasicDescription constructor
has zeroed them and that's fine for AAC */

file.PrepareNew(dataFormat, 0.);
file.Create(recordFileName, kAudioFileAIFFType);

file.Create(recordFileName, kAudioFileADTSType);

recorder.SetFile(file.GetAudioFileID());
Record(recorder);

Notice you get an ADTS file and not an MP4 -- there isn't currently support for that in the AudioFile API.

Also, I've heard MP3 encoding isn't available. Is this still true?

Yes.

What about QuickTime encoders? (Qualcomm, QDesign...)

Those should work when you use AIFC as the container file format. Use the appropriate kAudioFormat__ constants in CoreAudioTypes.h. You can use the AudioFormat API to determine how to correctly fill out an AudioStreamBasicDescription for one of these encodings...

Would it be possible to modify afrecord to use them and generate a quicktime readable file? (there doesn't seem to be a kAudioFile****** for these formats)

Yes.

Doug
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


References: 
 >Modifying afrecord sample file (From: Bruno Blondeau <email@hidden>)

  • Prev by Date: Re: Can't compile AudioUnits sample code
  • Next by Date: Re: Scheduling Midi data using 'MidiReceived'
  • Previous by thread: Re: Modifying afrecord sample file
  • Next by thread: Newbie question
  • Index(es):
    • Date
    • Thread