Solved

AIFF file header fields

Posted on 2001-06-12
2
266 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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