Re: ExtAudioFile 4GB file size limitation on WAV files
Re: ExtAudioFile 4GB file size limitation on WAV files
- Subject: Re: ExtAudioFile 4GB file size limitation on WAV files
- From: Brian Willoughby <email@hidden>
- Date: Tue, 03 May 2011 14:42:30 -0700
On May 3, 2011, at 04:19, Richard Dobson wrote:
On 03/05/2011 12:00, tahome izwah wrote:
Thank you for all your feedback. I supposed I wouldn't be better off
when switching to AIFF then as I guess the same restrictions apply?
Thanks
--th
The best you will get is the same 4GB limit. But AIFF is in fact a
little more uncertain than WAVE as the formal spec itself is
remarkably confused, specifying signed integers for chunk sizes but
unsigned integers elsewhere. Probably the spec is just lazily
written. The only sane thing to do is to use unsigned, but sanity
cannot always be relied upon! So depending on your software it may
or may not allow 4GB files anyway. AIFF (and even AIFF-C) really
is on the way out - it is occasionally used for some sample files
in Logic Pro, but CAF is used a lot more now. With the move by
Apple to Intel CPUs a big-endian file format is in any case rather
less attractive.
Very true. The AIFF specification is annoyingly unclear on this, and
basically one bit (the sign bit) of the chunk size is totally wasted
as a result of being vaguely defined.
In fact, Apple has decided that Logic will read 4 GB AIFF for maximum
compatibility with existing files, but at the same time Logic refuses
to bounce or otherwise create an AIFF any larger than 2 GB - again
for maximum compatibility, this time with other programs that might
not be able to read more than 2 GB.
While RIFF / WAV does not seem to suffer from similar vague
specifications, the 2 GB limit still appears for different reasons.
The typical 32-bit API call for file access in any operating system
has a signed value for the seek position because this allows a
programmer to seek backward (negative) and forwards (positive) in a
file from the current position. As a result, many naive audio
programmers simply blindly use the 32-bit unsigned chunk sizes as
offsets in the Win32 API calls, without realizing that this limits
them to 2 GB file sizes at a maximum. There are, or were at one
time, many Windows programs which could only read and write 2 GB WAV
files. Modern operating systems eventually expanded their file
system API to include 32-bit unsigned offsets. As audio programmers
became aware of these new unsigned file access options, support for 4
GB audio files began appearing. 64-bit operation system calls
obviously go beyond the 32-bit signed limits, but not every
programmer uses 64-bit API for file access.
Basically, there's still no guarantee that you can create a 4 GB WAV
or AIFF and expect that every piece of software out there will be
able to read the entire file. 2 GB is the maximum safe size, even
though 4 GB is the maximum that can be interpreted correctly by the
right decoding software.
Brian Willoughby
Sound Consulting
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden