Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coreaudio-api Digest, Vol 2, Issue 63



Hi,
I get what you are saying, but in practice do you know of any C code, or C++ code that pushes the MIDIDataChunk into a AIFF file. I guess I am looking for an example. And, It would be really great if the example involved CoreAudio.
Anybody?
Craig Bakalian
www.eThinkingCap.com

On Feb 26, 2005, at 3:04 PM, email@hidden wrote:


Hi,
After some gleaning and careful reading I have come to the conclusion that it
is possible to get MIDI data into a AIFF file. Yet, I do not know how to do
it, especially with CoreAudio. I understand that this is the structure that
must be made

#define MIDIDataID 'MIDI'
type struct{
ID chunkID;
long chunkSize;
unsigned char MIDIdata[ ];
} MIDIDataChunk;

ID is 4 ASCII bytes "described by Interchange File Format". But, now what?
Does anyone have any other information about pushing MIDI data into an AIFF
file?

Hi Craig

Apologies for a 'non-answer answer', but MIDI files are also chunked data. You
would just write to an AIFF file the MIDI chunkID, the size of the MIDI file,
and then stream the MIDI file into the AIFF.

If you don't have code to generate a MIDI file in memory, you could write a
simple program to open an AIFF file for writing, open a MIDI file for reading,
then append the MIDI data into the AIFF.

MIDI files will typically start with a short 'MThd' chunk, followed by other
chunks, especially 'MT
rk' chunks. A MIDI player needs to know how to parse the chunks, but for merging
into an AIFF, I think you would just splice the entire thing in without worrying
about the MIDI file's internal structure.

The AIFF MIDI header chunkSize will instruct any AIFF reading program how many
bytes to 'jump over' if the program is not interested in that MIDI file data. In
that way, an Audio-only AIFF program can safely ignore (or preserve without
supporting) any file chunk it doesn't care about, without needing to know
anything about the data format in that 'uninteresting' chunk.

JCJR

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/coreaudio-api/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.