Solved

AIFF file header fields

Posted on 2001-06-12
2
265 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error 1.1 400 Bad request idhttp delphi 18 199
Intraweb download file link ? 1 167
Delphi XE10 Round Image 2 183
delphi parse string to params 3 151
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

680 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