Re: .WAV file headers
- To: mathgroup at smc.vnet.net
- Subject: [mg52601] Re: .WAV file headers
- From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
- Date: Fri, 3 Dec 2004 03:54:37 -0500 (EST)
- References: <comgia$6ql$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
You can extract that information from the Sound object that is created when
you import a WAV file.
Here is an example of how you can do this (assuming you are using Windows):
1. Import the "chimes" sound from the Windows media folder:
chimes=Import["C:\WINDOWS\media\chimes.wav","WAV"];
Show[chimes];
2. This gets the size of the (stereo) data:
Dimensions[chimes[[1,1]]]
{2,13921}
3. This gets the samples per second and the bits per sample
chimes[[1,2]]
{22050,16}
Steve Luttrell
"John Reed" <nospamjreed at alum.mit.edu> wrote in message
news:comgia$6ql$1 at smc.vnet.net...
> Is there a way to extract the information from wave file headers in
> Mathematica? The header is the first 11 words of the wave file and
> consists
> of 4 byte ASCII words and 4 byte integers encoded as ASCII strings. I
> need
> the integers from header words 7 (samples/second), 9 (two 2 byte words,
> bytes/sample and bits/sample) , and 11 (number of bytes in the file).
>
> John Reed
>