Re: Loading Audio File into Array
Re: Loading Audio File into Array
- Subject: Re: Loading Audio File into Array
- From: john <email@hidden>
- Date: Tue, 24 Jan 2006 19:27:23 -0500
Hi Jannik,
You can use the AudioFileReadBytes() or the ExtAudioFileRead()
functions based on the info you get from the ExtAudioFileGetProperty
(), as you specified. Notice it's just the read length that uses an
UInt32 - so I suppose there is a limit to the size you can read in
one call, but obviously that's not an issue for you. Notice the
inStartingByte parameter to AudioFileReadBytes() is an SInt64, and
likewise the inFrameOffset parameter in the call to ExtAudioFileSeek
() is an SInt64.
You can also use the kAudioFilePropertyAudioDataByteCount in a call
to AudioFileGetProperty() if you opted to use the "regular" AudioFile
API.
-- John
Hello list. I have a couple of questions regarding audio files.
What I want to do is load an entire audio file into an array, which
will be pointed to by an AudioBufferList.mBuffers[0].mData pointer.
I already know the format more or less (stereo, 48 KHz, 24 bit, and
the length will never be longer than 10 seconds). My questions are:
1. How do I determine what size the array containing the audio file
should be initialized as? I am thinking I have to call
ExtAudioFileGetProperty() with the constant of
kExtAudioFileProperty_FileLengthFrames, which returns the number of
frames of the input file as an SInt64. Then I will declare the
array to be the size of the value which ExtAudioFileGetProperty
returned.
2. What is the appropriate way to load the entire file into the
array? I have seen AudioFileReadBytes() used in previous, old (OS X
10.2) emails to the mailing list, and ExtAudioFileRead used in the
ConvertFile sample project. However, both of these take a UInt32,
and I have an SInt64 from the ExtAudioFileGetProperty(). This makes
me wonder if my assumptions are correct.
Thank you for any help.
Jannik
_______________________________________________
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