Solved

AIFF file header fields

Posted on 2001-06-12
2
262 Views
Last Modified: 2010-04-06
I'm trying to add support for AIFF files (Apple's native PCM audio file format) to a windows program. It works fine in different ways, but other programs which have this support seem to work with a slightly different structure. (Eg: Cool Edit, AWave, Gold Wave). There appear to be 2 less bytes in the COMM chunk before the sampling rate field, and two extra in the SSND field before the sound data.
 The structure I'm using adheres strictly to Apple's AIFF v1.3 documentation, but these other programs concurr on their own structure. I'm using Delphi 3, and here's what I'm doing...
 To write a file, I assign all the field values for the FORM, COMM and SSND chunks to fields in records, byte-reverse each numeric field, and then write the 2 records to disk. To read a file, I read X bytes to a buffer, assign its address to typed pointers, byte-reverse the fields, and get all the info from the records.
 If v1.3 of the format is ancient, or if I'm just stupid and wrong, then can someone please either tell me where to find the docs on the latest version, or fill me in on the proper structure. Following are the record types that I use...

 TrecAIFF_TOF = record
   HeaderCkID : Tarr4CC; { array of 4 char's }
   FileSize   : longint;
   FormatID   : Tarr4CC;
   FmtCkID    : Tarr4CC;
   FmtSize    : longint;
   NmbrChnls  : smallint;
   NmbrFrms   : cardinal;
   NmbrBits   : smallint;
   SmplRate   : extended;
 end;
 PrecAIFF_TOF = ^TrecAIFF_TOF;

 TrecAIFFSgnlHDR = record
   SgnlCkID   : Tarr4CC;    
   SgnlCkSize : longint;
   Offset     : longint;
   BlockSize  : longint;    
 end;                        
 PrecAIFFSgnlHDR = ^TrecAIFFSgnlHDR;


 A thousand thanks (and 50 points) to whoever is able to help!
0
Comment
Question by:HorridMan
2 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 50 total points
ID: 6181167
I would guess that the records are all packed record.

Is "SmplRate: extended;" really correct? Extended is a 10 Byte type whereas Double is a 8 Byte type.
0
 

Author Comment

by:HorridMan
ID: 6189457
 Packed records work perfectly! I would never have thought of that myself. Incidentally, I tried at first using a longint for the SmplRate field, but strangely extended type does work. Goodness knows why they designed it that way.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now