This php function will convert a recording into a ulaw compressed wave file that is playable on any application. Be sure to have magic-quotes off while the function is running.
Improvements and comments to jbrohan (at) tradersmicro.com
(c) Traders Micro. you may freely use this code for any purpose. No guarantees given or implied.
function Store_to_wave ( $infilename, $wavefilename ){
$a = file_get_contents ( $infilename );
$b = "RIFF";
$n = strlen ( $a ) + 44;
$b .= pack ( 'V', $n );
$b .= "WAVEfmt "; // 8
$b .= pack ( 'V', 16 ); // length of format block 4
$b .= pack ( 'v', 7 ); // ulaw encoding 2
$b .= pack ( 'v', 1 ); // channel numbers 2
$b .= pack ( 'V', 8000 ); // sample rate Hz 4
$b .= pack ( 'V', 8000 ); // bytes / sec 4
$b .= pack ( 'v', 1 ); // bytes / sample 2
$b .= pack ( 'v', 8 ); // bits / sample 2
$b .= "data"; // 4
$b .= pack ( 'V', strlen ( $a )); // 4
$b .= $a;
$f = fopen ( $wavefilename, "wb" );
fwrite ( $f, $b, strlen ( $b ));
fclose ( $f );
}
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
php function to convert recording to .wav file
php function to convert recording to .wav file
John Brohan National Instruments LabVIEW expert in Montreal
Traders Micro "We connect all sorts of things to computers"
telemedicine applications
www.woundfollowup.com
Traders Micro "We connect all sorts of things to computers"
telemedicine applications
www.woundfollowup.com