Solved

AIFF file header fields

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

19 Experts available now in Live!

Get 1:1 Help Now