?
Solved

AIFF file header fields

Posted on 2001-06-12
2
Medium Priority
?
270 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month11 days, 18 hours left to enroll

752 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