Re: Combining sound files

From: Date: Wed, 28 Feb 2007 14:28:31 +0000
Subject: Re: Combining sound files
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-249592@lists.php.net to get a copy of this message
At 5:28 PM -0600 2/27/07, Richard Lynch wrote:
On Sun, February 25, 2007 9:22 am, tedd wrote: However, I can't do the same with .WAV files. Does anyone know a way
to combine .WAV files similar to the way shown above?
The first 256 bytes of a .WAV file contains magic numbers indicating the bit-size (16-bit, 8-bit, whatever) and sampling rate (44.1 kHz, 22.05 kHz, 96kHz, etc) and imaging (stereo, mono, and I think maybe others) as well as the total number of samples (I.e., file length). There are also some slots for things like copyright, comments etc, as I recall. You're going to have to find specs on that header info, read the first 256 bytes of each file, compute new numbers to put into the .wav header, and write out the new 256 bytes and then the remainders of the two files. If the two files are NOT both the same bit/sample rate, then you'd have some REAL fun trying to scale/re-sample the actual audio... :-) You may find it easier/faster to just locate a .wav splicer command line tool and run exec with it. Though perhaps not nearly as fun, depending on your definition of fun.
I'm not sure I can or need to run exec, nor do I actually know how. I'll deal with that later in my life. For the moment, I can use a HEX Editor and inspect the first 256 bytes of a wav file and find out all the goodies therein, but do you know if I strip out the first 256 bytes can I then combine the files so they will work (providing the sample rates, frequencies, and such as the same)? Thanks for your help. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#249592) next »