Re: Easy AudioFile Question
Re: Easy AudioFile Question
- Subject: Re: Easy AudioFile Question
- From: Philippe Wicker <email@hidden>
- Date: Mon, 28 Jul 2003 19:39:17 +0200
On Monday, July 28, 2003, at 05:21 PM, Benedict Singer wrote:
>
Lo again all,
>
>
So now I've moved on from worrying about AudioConverters to worrying
>
about
>
AudioFiles. Specifically, AIFF files. Now, my issue is that
>
AudioFileReadBytes takes a void* for the parameter it uses to return
>
data.
>
So I don't know if I need to do any type conversion before feeding it
>
to
>
my other routines or not. So, my questions are 1) what type (float,
>
short,
>
whatever) would this be giving me for an AIFF file, and 2) is there
>
somewhere (in the format description, say) that would tell me this
>
easily?
>
From some quick reading online it appears that AIFF files use chars as
>
the
>
datatype, but I don't know if AudioFileReadBytes is going to change
>
this
>
or not.
With the C language (and probably also with Obj C), void* is a
placeholder for any other typed pointer. However, it is forbidden to do
arithmetic on such a pointer. For instance, you cannot write an
instruction such as "my_void_ptr += 1;". That's why pointers on
"something we don't know much a priori" are often Byte* (unsigned char)
because then you can do pointer arithmetic. And you will soon realize,
if you haven't already, that working with audio needs a lot of pointer
arithmetic.
An AIF file contains a stream of bytes. This stream of byte is
structured (it is a collection of different types of chunks one of
these types being dedicated to chunks containing audio samples). The
AudioFile API allows you to "play" with this without knowing anything
about the internal structure of this byte stream.
Audio files from the same family (say AIFF, WAV, SD2, ...) may contain
audio with different sample size (16 bits, 24 bits, 32 bits), it may
contain sample encoded as integers or float, and the encoding may be
little endian (used on INTEL machines) or big endian (used on PowerPC
machines). To know how is the audio encoded, use the
AudioFileGetProperty API with kAudioFilePropertyDataFormat as the 2nd
parameter. It will return an AudioStreamBasicDescription structure
which contains all you need to know about the format of the audio
(especially the mFormatFlags).
>
>
As a quick follow-up question: the reason I'm working with AIFF files
>
is
>
that I'm working with CD's. Is there a nicer way with CoreAudio to deal
>
with Audio CD's than by just treating them as a bunch of AIFF files?
>
>
As a second follow-up, from my questions on this list, you can probably
>
tell I don't really have any background in audio work. Can anybody
>
point
>
me towards a good basic reference, preferably online? Things like
>
packet,
>
frame, samples are all things that I keep needing to know, and don't.
>
So
>
far I've been doing ok thanks to some nice docs in the header files
>
and a
>
couple questions to this list, but it'd be good to know this stuff
>
myself!
Try this link, I find it interesting:
http://www-ccrma.stanford.edu/~jos/filters/filters.html
>
>
TIA,
>
>
Ben
>
_______________________________________________
>
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.
>
>
Philippe Wicker
email@hidden
_______________________________________________
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.