[Date Index] [Thread Index] [Author Index]
Re: Won't Read Entire Soundfile; Why?
Hi, Mark On 31 May 1997 20:17:29 GMT, you wrote: >The code for ReadSoundfile in Miscellaneous`Audio` is buggy. Although >it parses the header for all WAV formats, it only works for 8-bit >formats. > >My suggestion is to take a look at the module definition, and make your >own version that reads 16-bit, taking into account little-endian vs. >big-endian issues, or to settle for using 8-bit WAV files only. > >It was very surprising to me that WRI let this package out the door...it >seems as though it was only partially finished. They really ought to >post a bug-fix version on MathSource. Sorry it took a while to get back to you on this. I haven't had all the time in the world and I originally wanted to use the package Miscellaneous`Audio` to avoid spending a lot of time on learning file formats and some of the arcana of MMA programming. Hah! Now, one file format and much programming arcana later, I find that if I replace sf = OpenRead[name] ; (* quit if file not found *) with sf = OpenRead[name,DOSTextFormat->False] ; (* quit if file not found *) near the end of the package it works. I'm not certain this is the final word on the subject - the documentation in that package is atrocious - but I did discover that OpenRead is defaulting with DOSTextFormat->True. It was probably seeing a 01Ah and interpreting it as an end-of-file. I'm not certain why it would work OK on 8-bit sound formats, but I didn't even try that. Still haven't. NOTE that I haven't yet attempted to retain generality with other operating systems. Probably won't since I have no way to test under them. I really appreciate your reply. It helped spur me into greater effort which resulted in advancing my MMA skills. Neal E. Tornberg tornberg at primenet.com