Windows WAV File Bug & Compiled File Routines
- To: mathgroup at smc.vnet.net
- Subject: [mg5088] Windows WAV File Bug & Compiled File Routines
- From: Mark Evans <evans at gte.net>
- Date: Wed, 30 Oct 1996 22:03:36 -0500
- Organization: None
- Sender: owner-wri-mathgroup at wolfram.com
I'm very impressed by 3.0, but Mathematica is still a real bear when it comes to working with data files. I think WRI should implement some compiled C code to read and write the most common file formats that exist on PCs and Macs, instead of forcing everyone to rely on Read[] and its family of functions. Will anyone second the motion? Here is the latest file reading bug: The package Miscellaneous`Audio` does not read all Windows .WAV files correctly. It reads 8-bit files, albeit at a snail's pace, but has problems reading 16-bit files. It will interpret the header correctly, but then fail to read the actual data. I had to truncate my 12.5 second, 44100 Hz, 16-bit mono file to 8 bits, and then wait a long time, to get it into Mathematica. It took at least 60 seconds on a P166 machine. By contrast, some of the freeware sound utilities that I downloaded from the Internet take about a tenth of a second to read in this same file. Of course, the package does not offer a way to write .WAV files back to disk. This omission is in itself a great deficiency. If you look at the file-reading code in Audio.m you begin to understand why (1) reading files into Mathematica is slow, and (2) error-prone. There are all kinds of flips and flops relating to byte ordering, scaling and the like that cry out for compiled routines instead of interpreted execution. I love Mathematica, and yes it can do everything, but in cases like these I request compiled code. I respect the work that has gone into many of these file-reading utilities, and I am thankful for what I have; but it seems to me that if the freebies I pull down from ftp sites can read and write .WAV files, then a mammoth like Mathematica should be able to pull it off with ease. Mark Evans evans at gte.net