Re: Getting raw audio data from an AIFF file
Re: Getting raw audio data from an AIFF file
- Subject: Re: Getting raw audio data from an AIFF file
- From: Brian Willoughby <email@hidden>
- Date: Wed, 12 Feb 2003 16:55:43 -0800
Hello,
I am sorry for the delay in my response (things move fast on this list!), but
I wanted to do a little research before replying.
I remember that the original AppKit/SoundKit "Sound" class allowed access to
audio data, including routines for compacting the data after edits which have
inserted or deleted samples. But a quick check of the Cocoa documentation for
the NSSound class does not seem to reveal any access to sound data, although
there is support for playing AIFF within a limited subset of the possible data
formats. If you want to use Cocoa, you might be able to get at the sound data
via -[NSSound writeToPasteboard:] or by directly accessing the _data0 and
_data1 instance variables (the former is a bit of a hack, and the latter is a
highly contraindicated hack!). It would really be nice if Apple implemented
all the functionality that was in the former AppKit/SoundKit Sound class for
the newer Cocoa AppKit NSSound class. I think of the SoundKit as part of the
AppKit, because it predates even the Foundation Kit, but technically the
SoundKit was not part of the AppKit proper.
Fortunately, ever since NeXT let the SoundKit go to the Stanford Music
Department (I believe that was the path it took), expert programmers have been
maintaining the original SoundKit code in the renamed SndKit, which is
distributed as part of the MusicKit. Check out MusicKit.org - a good starting
place might be
http://www.musickit.org/MusicKitConcepts/thesndkit.html for your
particular interests.
The two options above are the most Objective-C-friendly choices I am aware of
at this time. I would recommend the SndKit "Snd" object over hacking too
deeply into NSSound. You should find that the SndKit is as easy to use as
Cocoa, due to its object oriented design, as opposed to QuickTime or other
old-school standard C libraries.
Brian Willoughby
Sound Consulting
Begin forwarded message:
From: "Andrew GFunk" <email@hidden>
To: email@hidden
Subject: Getting raw audio data from an AIFF file
Date: Sat, 08 Feb 2003 16:42:56 -0800
Hi! I'm a newbie to audio app development. Under OS X, is there an easy way
to get at the raw audio data (PCM) of an AIFF (or similar type) file? All I
need besides the raw audio data is the sample-rate, resolution, and number
of channels of the sound... all the other headers that might be included in
the file can be ditched. Is there some kind of simple service I can use to
store the PCM portion of the file as an NSData object?
I plan on doing some DSP stuff on the raw audio data, then saving the result
as a new file with the same sample rate, resolution and # of channels as the
original (44.1KHz, 16-bit, stereo in most cases).
I'm writing the app in Objective-C.
Also, how would you go about spliting up the stereo data of an AIFF file
into 2 seperate NSData objects (left and right)? Then how would you
recombine the 2 (after doing some DSP on each) to form a stereo AIFF file
again?
Any help at all would be awesome :)
_______________________________________________
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.