Re: [PHP] Combining sound files

2007-03-06 Thread Richard Lynch
I may be replying to an outdated URL or even all out of order as I
play catchup on the list...

Your JS play function checks for precisely two possible browser
appName values:
Microsoft Internet Explorer
Netscape

Maybe Mozilla Firefox has Netscape in its appName, but I wouldn't
expect that...

I'm told I need a plugin still, so I guess maybe that part IS working...

On Fri, March 2, 2007 12:37 pm, tedd wrote:
 At 5:28 PM -0600 2/27/07, Richard Lynch wrote:
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.

 Richard:

 Nah, it's easier to bit twiddle the sound files and I found an easy
 way to combine them. It's funny what a few bytes of data can do.  :-)

 What's ya think of this -- does it work for you?

 http://sperling.com/examples/captcha/

 Cheers,

 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com



-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-03-02 Thread tedd

At 5:28 PM -0600 2/27/07, Richard Lynch wrote:

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.


Richard:

Nah, it's easier to bit twiddle the sound files and I found an easy 
way to combine them. It's funny what a few bytes of data can do.  :-)


What's ya think of this -- does it work for you?

http://sperling.com/examples/captcha/

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-03-02 Thread tedd

At 1:37 PM -0500 3/2/07, tedd wrote:

At 5:28 PM -0600 2/27/07, Richard Lynch wrote:

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.


Richard:

Nah, it's easier to bit twiddle the sound files and I found an easy 
way to combine them. It's funny what a few bytes of data can do.  :-)


What's ya think of this -- does it work for you?

http://sperling.com/examples/captcha/

Cheers,

tedd



Oops, it was just supposed to go to Richard.

Sorry.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-28 Thread tedd

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-28 Thread Richard Lynch
On Wed, February 28, 2007 8:28 am, tedd wrote:
 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)?

Probably not exactly like that.

One of the goodies is file length (actually, I think it's sample
count, but same smell).

So you are going to have to open both headers and plus up the numbers
to get the right new header.

I suspect most .wav readers are far less forgiving than .mp3 readers
due to their relative format age.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-27 Thread Richard Lynch
On Sun, February 25, 2007 9:22 am, tedd wrote:
 Hi gang:

 I can combine two mp3 sound files together by simply:

 // load  first

 $file = a.mp3;
 $handle = fopen($file, rb);
 $size = filesize($file);
 $load = fread($handle, $size);
 fclose($handle);

 // load second

 $file = b.mp3;
 $handle = fopen($file, rb);
 $size = filesize($file);
 $load .= fread($handle, $size);
 fclose($handle);

 // save both as one audio file

 $filename = tmp/a.mp3;
 $file = fopen( $filename, wb );
 fwrite( $file, $load);
 fclose( $file );

I am not certain that that creates a truly valid MP3 file, but it does
seem to work in all the players I've ever tried.

I do it all the time with ID3 tags on the fly from the DB and the
actual MP3 data from a static file.

Anybody know a good MP3 validator in command line Linux, off the top
of their heads?  My last attempt to Google didn't yeild anything, but
that was a couple years ago...

 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.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-26 Thread clive
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?


Can you not convert the wav files to mp3's then combine them?


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-26 Thread tedd

At 11:39 AM +0200 2/26/07, clive 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?


Can you not convert the wav files to mp3's then combine them?


--
Regards,

Clive.


Clive:

That's a good point, then all I would have to do is to change the 
resultant mp3 file to a wav file. However, I'm not aware of how to do 
that using php. I would hope it's as easy as changing a jpg to a gif 
file, but I have never done a mp3 to a wav conversion before. I'll 
investigate that.


Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-02-26 Thread clive
That's a good point, then all I would have to do is to change the 
resultant mp3 file to a wav file. However, I'm not aware of how to do 
that using php. I would hope it's as easy as changing a jpg to a gif 
file, but I have never done a mp3 to a wav conversion before. I'll 
investigate that.


you could look at lame? and you will have to call it from php using 
exec() or shell_exec()


--
Regards,

Clive.

Real Time Travel Connections


{No electrons were harmed in the creation, transmission or reading of 
this email. However, many were excited and some may well have enjoyed 
the experience.}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php