This project has moved and is read-only. For the latest updates, please go here.

Problem with large wav files

May 17, 2011 at 7:47 AM


I have a problem with large wav files (3.46G). It has only a fmt chunk and one large data chunk, that exeeds the int.maxvalue size.

I have seen in your code that a filesize this large is supported (filesize is read in a UInt32), however the chunklength is defined as an int and will result in a negative value, which in turn will throw errors if trying to read this number of bytes.

To be complete, my tests started from the fileinspector, and i was able to modify part of the code (starting from changeset 73450), so that fileinspector could read the file. However i have no idea wat the implications are to the rest of the library, because i just started to use it (wanted to use NAudio for opening these files and utting them in smaller pieces .... because i could not find any (small command line) program to do this reliable) 

If you want i can upload them, however iwould really apreciate you could have a look for the best solution (i do not know if mine is ok)



May 17, 2011 at 7:53 AM

hi Johan,

I had originally kept away from using uint in NAudio as it was considered bad to do since it would mean the code was not "CLS Compliant". However, I think this limitation matters less now (and VB.NET users can easily work with uints if needed). Whether WAV files larger than 2GB are truly valid is a matter for some debate, but I will examine the code and see if this can be changed easily.

I hope to add RF64 support to NAudio in the future which would be the preferred way to store files this large, and gets around the 4GB limitation.


May 17, 2011 at 8:11 AM

Thanks for this quick reply, lookig forward for your solution.

btw, this file is generated by another program, and there is nothing much i can do about it's length ...