Re: Reading the contents of an AudioFile
Re: Reading the contents of an AudioFile
- Subject: Re: Reading the contents of an AudioFile
- From: Craig Hopson <email@hidden>
- Date: Wed, 25 Oct 2006 09:50:43 -0600
Hi Sheen,
This is probably better as a core audio list question, but this may
help...
Look at CAAudioFile & AUOutputBL
- Use CAAudioFile to manage the file stuff: open, read, close.
Also, you can use CAAudioFile to covert the format if you need to do
that.
- Use AUOutputBL to hold the data. Once the data is read in you can
access the buffer for the values.
Here is some (very incomplete) code...
CAAudioFile srcFile;
srcFile.Open( inFileRef );
// Get the file's audio format
CAStreamBasicDescription srcDesc( srcFile.GetFileDataFormat() );
#if !CAAF_USE_EXTAUDIOFILE
mNumFrames = srcFile.GetNumberPackets(); // pre-Tiger
#else
mNumFrames = srcFile.GetNumberFrames(); // Tiger and beyond
#endif
// Create a buffer for the data
mOutputBufferList = new AUOutputBL( & srcDesc );
mOutputBufferList->Allocate( mNumFrames );
mOutputBufferList->Prepare();
// Read the file into the Audio Buffer
UInt32 numFrames = mNumFrames;
srcFile.Seek( 0 ); // start at the start
srcFile.Read( numFrames, mOutputBufferList->ABL() );
Hope this helps.
On Oct 25, 2006, at 8:04 AM, sheen mac wrote:
Hi All
I want to read an audio file to get its sound value
(frequancy value) using core audio or QT. I can take the values
using QT but it takes the time as long as the duration of the file.
That means a 5 min file requires 5 min to read sound values from
the file. I am doing it using a callback.
i want to read the sound values or frequency value as
faster as possible.
like i want to read the values in less than 30 seconds. is any one
knows an alternate method to read the file to get sound value very
fastly
thanks in Advance
Craig Hopson
Red Rock Software
***************************************************
"If every household in the U.S. replaced one light bulb with an
ENERGY STAR qualified compact fluorescent light bulb (CFL), it would
prevent enough pollution to equal removing one million cars from the
road." http://www.energystar.gov/index.cfm?c=cfls.pr_cfls
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden