Csound Csound-dev Csound-tekno Search About

Re: AIFF files in sndinfo etc

Date1999-02-05 19:58
FromRichard Dobson
SubjectRe: AIFF files in sndinfo etc
It's an 'Annotation' chunk. There are four of these defined in the AIFF
spec (all optional, of course):

#define NameID		'NAME'  /* ckID for Name Chunk */
#define AuthorID	'AUTH'	/* ckID for Author Chunk */
#define CopyrightID	'(c) '	/* ckID for Copyright Chunk */
#define AnnotationID	'ANNO'	/* ckID for Annotation Chunk */

typedef struct {
	ID	ckID;
	long	ckSize;
	char	text[];
}

text[] is a pure ascii string, not a pascal string or a C string (ie not
necessarily null-terminated).


To which should be added, the text array will need to be an even number
of bytes. The official spec is remiss in not stating that for these
chunks, even though it is always mandated elsewhere; all AIFF chunks
must start on an even boundary.

The file as you show it is indeed wrong therefore, as it is claiming a
char length of 13. It is in any case correct practice for both WAVE and
AIFF to expect unknown chunks, and pass over them. I added this myself
for the WAVE parsing, but did not think to look at the AIFF code at the
same time.

So somewhere along the line, this file was made badly - perhasps there
is a bug is SOX?

BTW, the hex-stream as printed with the pairs byte-swapped, as for
little-endian machines, which did make just a little more difficult to
read; presumably this is just an artefact of the hex reader used?

If Csound accepts the file, given the chunk is skipped, it is now
benignly and silently accepting the odd-length chunk, which, strictly
speaking, it should reject. I think, at the least, it should print a
warning that the format is incorrect. Maybe on non-Intel platforms, it
would in any case have to be rejected.

Richard Dobson 

jpff@maths.bath.ac.uk wrote:
> 
> Message written at 5 Feb 1999 12:30:31 +0000
> 
> Following the earlier message I have changed the code to comment in
> and skip chunks about which it has no knowledge.  This means that
> Peter Traub's exampel now says
> 
> montague:~/csound> ./csound -U sndinfo ../bust.aiff
> Csound Version 3.511 (Jan 31 1999)
> util SNDINFO:
> Unknown chunk ANNO of size 13
> ../bust.aiff: AIFF, 40960 stereo samples, no looping
>         AIFF soundfile, no looping
>         srate 44100, stereo, 16 bit shorts, 0.93 seconds
>         headersiz 75, datasiz 163840 (40960 sample frames)
> montague:~/csound>
> 

-- 
Test your DAW with my Soundcard Attrition Page!
http://wkweb5.cableinet.co.uk/rwd

Date1999-02-08 10:36
Fromjpff@maths.bath.ac.uk
SubjectRe: AIFF files in sndinfo etc
What must teh text be even length? I cannot see any reason for it.
Anyway I have extended teh AIFF header reader to deal with those
chunks.