473,433 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,433 software developers and data experts.

.wav file header info

Hi,

Does anyone know how to extract the header information like duration, bit
rate, audio channel configuration etc from a wave file? An example (if
possible) would really help ...

Thanks.
- Rajesh
Jul 17 '05 #1
1 23166
On Wed, 14 Jan 2004 13:59:20 -0600, "Rajesh Kapur" <rk****@mpr.org> wrote:
Does anyone know how to extract the header information like duration, bit
rate, audio channel configuration etc from a wave file? An example (if
possible) would really help ...


http://www.google.com/search?hl=en&i...+header+format

Or search for WAV on http://www.wotsit.org/

Use unpack <http://php.net/unpack> to decode the header. The format looks
quite simple, so here's an example.

<pre>
<?php
$fp = fopen('chord.wav', 'r');
fseek($fp, 20);
$rawheader = fread($fp, 16);
$header = unpack('vtype/vchannels/Vsamplerate/Vbytespersec/valignment/vbits',
$rawheader);
print_r($header);
?>
</pre>

Outputs:

Array
(
[type] => 1
[channels] => 2
[samplerate] => 22050
[bytespersec] => 88200
[alignment] => 4
[bits] => 16
)

--
Andy Hassall <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mich Romney & De Shriners | last post by:
I have created an MP3 download app from mysql. It plays the song fine. :) Only problem is that when it downloads, all the header information, like song lyrics, credits and album cover have all...
1
by: Roy | last post by:
When I do the copyRecordset method via vba to transfer data from access to excel template,i am unable to read the header info.It's only transferring data.Any suggestions?? Roy
2
by: opswat | last post by:
Hello, I am currently working on a C++ project for a PocketPC with Windows Mobile 5.0 in Visual Studio 2005. I am currently looking for a way to get file version information, i.e. file...
4
by: Frank Kociemba | last post by:
Hi NG, how can i compare, if a file ends with jpg,jpeg,gif,tif is really such a file and not an unnamed one. Is ther a solution or an example who to do it in c#? Frank
0
by: wednesdayuser | last post by:
How do I take part of the header info (an attribute) and add it to a url? I have the code to grab all of the header info/ session info, but I only need two or three attributes from the string it's...
0
khalidbaloch
by: khalidbaloch | last post by:
i want a simple function to retrive header info like bitrate playtime of a mp3 files , any help would be highly appreciated ... thanx in advance
2
by: empiresolutions | last post by:
I am using a standard mail function within an AMFPHP Class that i have used many times. Now, when i use it it does not work right. When a mail is sent, the $header info and html shows in the email. ...
1
by: turnerca902 | last post by:
Hi Folks, I am working on a little project and hoping someone out there might offer me some info/insight. I have a folder containing about 50 html files where the contents look like this: ...
2
by: sudhivns | last post by:
Hi, I would like to test the consistant state of PST file using MAPI API. how to read the PST header info (specifically AIMAP status flag). Does this flag denote, whether PST is corrupted or not ?...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.