Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: The 2GB Wav-limit!? (Read 62878 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

The 2GB Wav-limit!?

Hello everybody,

I just wanted to know if there is by any chance a program which can
record wav-files larger than 2GB. The Wavelab-lite version I'm using
right know stops any recording  which is exceeding that limit.

Thanks for your help!

The 2GB Wav-limit!?

Reply #1
There are a number of programs that have problems with files larger than 2 GB. The WAV format itself is officially limited to 2 GB.

You could use a program that records to a lossy format on-the-fly, like Messer, that can record to MP3. Or you cut the recording in between... i mean, 2 GB, that's over 3 hours in one piece...

The 2GB Wav-limit!?

Reply #2
The common wav header can only allocate 4 bytes to state the total wav length in bytes which will be why there's a two Gig limit. That detail could be depreciated (make -1 = read till the end of file) -would be nice, might crash old players hmmm...

Since
Linco.exe can write a raw PCM file (wav file without any headers) it may not have its own restriction on length. That would allow a continuous recording, then have to reencode or chop up and format the raw.
no conscience > no custom

The 2GB Wav-limit!?

Reply #3
Quote
Hello everybody,

I just wanted to know if there is by any chance a program which can
record wav-files larger than 2GB. The Wavelab-lite version I'm using
right know stops any recording  which is exceeding that limit.

Thanks for your help!
[{POST_SNAPBACK}][/a]


[a href="http://audacity.sourceforge.net/]Audacity[/url] can.  And it's free... and very good.

The 2GB Wav-limit!?

Reply #4
Quote
The common wav header can only allocate 4 bytes to state the total wav length in bytes which will be why there's a two Gig limit.
[a href="index.php?act=findpost&pid=282850"][{POST_SNAPBACK}][/a]

This isn't quite correct. It is true that the file length in the WAV header is a 4 byte integer, but it's an *unsigned* number, which means that the maximum size of a WAV file is actually 4GB, not 2GB.

Some audio programs get this wrong, and interpret the file length as a signed number, thus imposing a 2GB limit. I can confirm that Wave Repair supports WAV files up to 4GB, and if used just for recording it's free. And I see someone else has pointed out that Audacity (also free) will also go above 2GB.

The 2GB Wav-limit!?

Reply #5
Quote
Quote
The common wav header can only allocate 4 bytes to state the total wav length in bytes which will be why there's a two Gig limit.
[a href="index.php?act=findpost&pid=282850"][{POST_SNAPBACK}][/a]

This isn't quite correct. It is true that the file length in the WAV header is a 4 byte integer, but it's an *unsigned* number, which means that the maximum size of a WAV file is actually 4GB, not 2GB.


Theres no need to correct to clarify 
Wether the number is read as signed or not only becomes an an issue beyond 2g.
The 'actual' maximum size neednt have a limit if handled ideally.
no conscience > no custom


The 2GB Wav-limit!?

Reply #7
Quote
... which begs the question, how do you overcome the 4GB limit?

Using -1?
[a href="index.php?act=findpost&pid=283014"][{POST_SNAPBACK}][/a]


No, because -1 is signed and the size descriptor in the Wave header is unsigned. -1 would be 0xff 0xff 0xff 0xff which already stands for the unsigned 4294967295.

I guess there is no way, since it is a limitation of the format. You could use raw PCM and wrap it into a Matroska container (if supported). If I am not mistaken, the WAV container was invented by Microsoft and at that time, FAT16 was the only HDD file system supported by Windows - which by design has a file size limitation of 2 or 4 GB (not exactly sure).

The 2GB Wav-limit!?

Reply #8
Quote
Quote
... which begs the question, how do you overcome the 4GB limit?

Using -1?
[a href="index.php?act=findpost&pid=283014"][{POST_SNAPBACK}][/a]


No, because -1 is signed and the size descriptor in the Wave header is unsigned. -1 would be 0xff 0xff 0xff 0xff which already stands for the unsigned 4294967295.


If a program wont read over 2gigs, the size descriptor never gets to have a sign because the msb is never used. Data has no sign or specific meaning - theres what maybe it should mean, what it can, and what it usualy does... 
By -1 i meant 0xffffffff to be used as an escape value.

Quote
I guess there is no way, since it is a limitation of the format.

Its a limit of how the format is usualy read. An ideal wav reading routine can read to the end of file or use filesize-headersize to compute the PCM length.

Quote
You could use raw PCM and wrap it into a Matroska container (if supported). If I am not mistaken, the WAV container was invented by Microsoft and at that time, FAT16 was the only HDD file system supported by Windows - which by design has a file size limitation of 2 or 4 GB (not exactly sure).
[a href="index.php?act=findpost&pid=283017"][{POST_SNAPBACK}][/a]


The wav format was invented - heh like monkey poke stick in log pickup ants 
no conscience > no custom

The 2GB Wav-limit!?

Reply #9
Quote
Quote
I guess there is no way, since it is a limitation of the format.

Its a limit of how the format is usualy read. An ideal wav reading routine can read to the end of file or use filesize-headersize to compute the PCM length.

Actually, this won't work. A WAV file is free to have arbitrary non-PCM data at the end, and some audio processing programs do in fact place proprietory information there. As well as the file length near the front of the RIFF header, there's also a "chunk length" (another unsigned 4 byte number) at the front of the data chunk. Nothing beyond the defined length of the data chunk should be interpreted as PCM data.

Quote
If I am not mistaken, the WAV container was invented by Microsoft and at that time, FAT16 was the only HDD file system supported by Windows - which by design has a file size limitation of 2 or 4 GB (not exactly sure).
[a href="index.php?act=findpost&pid=283017"][{POST_SNAPBACK}][/a]

FAT32 also has a file size limit of 4GB. Even if the WAV standard was changed to support longer files, they would only be possible on NTFS partitions. Lots of people still use FAT32, so it's simplest to just accept that 4GB is the limit.


The 2GB Wav-limit!?

Reply #11
Quote
Quote
Its a limit of how the format is usualy read. An ideal wav reading routine can read to the end of file or use filesize-headersize to compute the PCM length.

Actually, this won't work. A WAV file is free to have arbitrary non-PCM data at the end, and some audio processing programs do in fact place proprietory information there.

Thats a point - but it is also free not too eh? To expand the wav format, make some very unlikely filesize like max-3 equal an escape value which implies a PCM size 'overflow'.
-a proprietory deviation from the not so common compliancy ~?
Quote
As well as the file length near the front of the RIFF header, there's also a "chunk length" (another unsigned 4 byte number) at the front of the data chunk. Nothing beyond the defined length of the data chunk should be interpreted as PCM data.
FAT32 also has a file size limit of 4GB. Even if the WAV standard was changed to support longer files, they would only be possible on NTFS partitions. Lots of people still use FAT32, so it's simplest to just accept that 4GB is the limit.
[a href="index.php?act=findpost&pid=283029"][{POST_SNAPBACK}][/a]

Nice and comfy for programmers to keep the format capped.
no conscience > no custom

 

The 2GB Wav-limit!?

Reply #12
Quote
Nice and comfy for programmers to keep the format capped.
[a href="index.php?act=findpost&pid=283047"][{POST_SNAPBACK}][/a]


Well, that's how it goes by Microsoft standards. They're designed to sell well, not to be future-proof.

Most modern formats use variable-length encoding for integers:
- you actually gain bits when dealing with small files
- you have virtually no limit on file size.

The wav format is so simple, that it would be better to just use something else when dealing with big files, instead of adding ugly special-cases that will work in 10% of players, and will make people believe their files are corrupt.

What will happen when a user creates a long WAV file for a family video, and it won't play in Windows media player ?

Even worse, if you use this kind of hack with a legacy audio editor, it will truncate your audio without warning !

Good standards deserve to last, but IMHO, this ain't one of them.

The 2GB Wav-limit!?

Reply #13
Quote
.....
What will happen when a user creates a long WAV file for a family video, and it won't play in Windows media player ?

Even worse, if you use this kind of hack with a legacy audio editor, it will truncate your audio without warning !

The max-3 escape 'implication' i mention could only possibly misinterprate PCM files of exact size max-3 (highly improbable length and impossible with 16bit or stereo) -which have also postfixed metadata.*
Quote
Good standards deserve to last, but IMHO, this ain't one of them.
[a href="index.php?act=findpost&pid=283063"][{POST_SNAPBACK}][/a]


Its so common, for a container of PCM I think it should evolve rather than be ditched and replaced. Its a choice between k.i.s.s for the programmers or the users 

[span style='font-size:8pt;line-height:100%']edit* -or just fail to read because of the filesize i admit - this happens already...[/span]
no conscience > no custom

The 2GB Wav-limit!?

Reply #14
I completely agree: more things should evolve instead of getting replaced every few years, that would prevent much useless re-development...

But wave ? I mean, if you do anything than switching between sample formats, you need to rewrite  all applications that read or write wave files...

The problem is that, in the first place, there was not much design to evolve from.

This page sums it up pretty well:

http://www.borg.com/~jglatt/tech/wave.htm

The format cannot be improved much, without breaking compatibility with most existing programs. So when new features are needed, why not use the better alternatives ?

The 2GB Wav-limit!?

Reply #15
I think I read somewhere that aiff does not have this restriction. Is this correct?
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

The 2GB Wav-limit!?

Reply #16
Quote
I completely agree: more things should evolve instead of getting replaced every few years, that would prevent much useless re-development...

But wave ? I mean, if you do anything than switching between sample formats, you need to rewrite  all applications that read or write wave files...

Not if the 'simple' form PCM size specifier is escaped for file sizes over 4 gig. Old players wouldnt play files that needed to use the escape, old editors couldnt work with the files or convert them to their own format, but they couldnt anyway cause the file is just too big.
Its backward compatibilty for all the files which dont use the extended feature.

Maybe its too much fuss, but its not a hard limitation of the format that it cant be extended past 4gig. In practice i guess theres enough work to do if many wav openers misinterpret the 4byte addresser as signed.

Quote
This page sums it up pretty well:

http://www.borg.com/~jglatt/tech/wave.htm
Quote
A Bastardized Standard
The WAVE format is sort of a bastardized standard that was concocted by too many "cooks" who didn't properly coordinate the addition of "ingredients" to the "soup". Unlike with the AIFF standard which was mostly designed by a small, coordinated group, the WAVE format has had all manner of much-too-independent, uncoordinated aberrations inflicted upon it.


I could have my stance skewed by my embryonic experiments in wav file handling but the Articles comments:
'much-too-independent'- is irrelevant, probably owing to an unrelated interest of the Authors; p (fine page though thankyou)
- If one wishes to inflict aberrations on a format, that is impossible to do independantly.
If a format can be worked within to include prefered capabilities without breaking its compatibilty (less the capabilities) -thats a programmers perogitive.
Good stuff should eventually get coordinated into the format

The common standard for packing chunks of pcm data could just accomodate simple wav formats with escape values to quirky ones. I dont see a point just now in sticking to origional limitations... hmm..
no conscience > no custom

The 2GB Wav-limit!?

Reply #17
Code: [Select]
typedef struct {
 ID             chunkID;
 long           chunkSize;

 short          wFormatTag;
 unsigned short wChannels;
 unsigned long  dwSamplesPerSec;
 unsigned long  dwAvgBytesPerSec;
 unsigned short wBlockAlign;
 unsigned short wBitsPerSample;

/* Note: there may be additional fields here, depending upon wFormatTag. */

} FormatChunk;


Code: [Select]
typedef struct {
 ID             chunkID;
 long           chunkSize;

 unsigned char  waveformData[];
} DataChunk;


You could always define wFormatTag=1, as if audio data were compressed, set chunkSize to 0xFFFFFFFF, and then store the actual size in the compressed file info.

But then, you could not store the real size in DataChunk, because there's not enough room. Or you could use a spacial value of wFormatTag, that would trigger various changes in the format.

Anyway, none of these changes would be compatible with existing apps 

Then, instead of redefining two data structures in an incompatible way, why not use mka ?

The 2GB Wav-limit!?

Reply #18
Quote
You could always define wFormatTag=1, as if audio data were compressed, set chunkSize to 0xFFFFFFFF, and then store the actual size in the compressed file info.
[a href="index.php?act=findpost&pid=283227"][{POST_SNAPBACK}][/a]

formatTag=1 means *un*compressed. (I take it this is a typo, and that's what you meant). It could work, because it's impossible for a chunk to have a size as large as xFFFFFFFF.

Quote
But then, you could not store the real size in DataChunk, because there's not enough room. Or you could use a spacial value of wFormatTag, that would trigger various changes in the format.

Anyway, none of these changes would be compatible with existing apps 
[a href="index.php?act=findpost&pid=283227"][{POST_SNAPBACK}][/a]

Let me first say that I feel the WAV format shouldn't be messed around with. 4GB gives you over 6 hours of 44.1/16, which seems quite a long time. The only reason for having bigger files strikes me as being able to make very long unattended recordings. The obvious solution is for the recording program to produce multiple WAV files.

However, if what people are trying to arrive at is a way to support single WAV files longer than 4GB while remaining compatible with existing programs, then the most straightforward approach seems to be:

1. Put the first 4GB of samples (minus however many bytes are required for headers) into the data chunk.
2. Put the rest into multiple proprietory chunks (let's call them "more" chunks) after the data chunk. Each chunk has a maximum length of 4GB (because its length field must be an unsigned 32 bit integer, so that these chunks can be ignored by compliant programs).
3. Include an additional proprietory chunk before the data chunk that indicates the presence (and number) of "more" chunks. Each pointer to a "more" chunk could include a file offset as large as we like (eg. using a 64 bit integer).
4. Leave the file_length field in the RIFF header set to *exclude* the "more" chunks. (It couldn't include them anyway, because the file is longer than 4GB). This means that compliant programs which don't know about "more" chunks will still work provided they ignore unknown proprietory chunks (albeit processing only the first set of samples, in the data chunk).

But in summary, here is not the place to be making off-the-cuff design extensions to a mature standard which actually works suprisingly well.

The 2GB Wav-limit!?

Reply #19
Quote
formatTag=1 means *un*compressed. (I take it this is a typo, and that's what you meant).

Oops..  indeed -- and it proves my lack of practice with wav

Quote
3. Include an additional proprietory chunk before the data chunk that indicates the presence (and number) of "more" chunks. Each pointer to a "more" chunk could include a file offset as large as we like (eg. using a 64 bit integer).

Wouldn't this cause problems with some badly written, unmaintained programs ? I've seen some "optimized" programs which don't... umm.. parse everything 

Quote
But in summary, here is not the place to be making off-the-cuff design extensions to a mature standard which actually works suprisingly well.


Agreed (was trying to discourage him a bit, actually) 

The 2GB Wav-limit!?

Reply #20
Quote
I think I read somewhere that aiff does not have this restriction. Is this correct?
[{POST_SNAPBACK}][/a]

No, this is incorrect.  AIFFs have a maximum size of about 2 GB, for the chunk size field in the chunk header is a 32-bit signed integer.  Moreover, each AIFF can only have 1 sound data chunk.

[a href="http://www.tsp.ece.mcgill.ca/MMSP/Documents/AudioFormats/AIFF/AIFF.html]http://www.tsp.ece.mcgill.ca/MMSP/Document.../AIFF/AIFF.html[/url]
When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute--and it’s longer than any hour.  That’s relativity.
-- Albert Einstein

The 2GB Wav-limit!?

Reply #21
Quote
Quote
3. Include an additional proprietory chunk before the data chunk that indicates the presence (and number) of "more" chunks. Each pointer to a "more" chunk could include a file offset as large as we like (eg. using a 64 bit integer).

Wouldn't this cause problems with some badly written, unmaintained programs ? I've seen some "optimized" programs which don't... umm.. parse everything 
[a href="index.php?act=findpost&pid=283243"][{POST_SNAPBACK}][/a]

All bets are off with regard to badly written programs. But all WAV processing programs really should at the very least ignore any chunks they don't recognise. So this extra chunk (which will contain the required 4 byte integer defining its size) should just be skipped. The very large offsets to other chunks that it contains would never be seen.

Actually, come to think of it, this additional chunk before the data chunk isn't necessary: a program using the extra "more" chunks could just notice that they are present and process them. Other programs will ignore them. And even badly written programs that assume the data chunk always comes right after the fmt chunk would still work.

(Question to self: why am I even thinking about this, when my opinion is that it shouldn't happen???!!)

The 2GB Wav-limit!?

Reply #22
Ah, ok. Good idea..

Then the first, legacy chunk could perhaps be dummy (ie: of zero length), so that legacy programs (buggy or not) will see nothing at all, unless they are upgraded ?

But then, when opening one of these new wave files with an old program and saving it, all newer chunks would get destroyed 

The 2GB Wav-limit!?

Reply #23
Quote
But in summary, here is not the place to be making off-the-cuff design extensions to a mature standard which actually works suprisingly well.
[a href="index.php?act=findpost&pid=283236"][{POST_SNAPBACK}][/a]

well, i just find it interesting to *try* and point out possibilities, the replies help my interests.

cheers
no conscience > no custom

The 2GB Wav-limit!?

Reply #24
You could always use Adobe's Audition in the multitrack mode. When the temp file reaches the 4 gig limit, it creates another one. You can keep recording untill your hard drive is filled up. Saving the file will be an issue but you could always save several 4 gig chnks that make up the whole recording session or save as mp3 as someone else mentioned earlier.