<?php $wavfile=$_REQUEST['wav']; $wav=file_get_contents($wavfile); $descriptorspec = array( 0 => array( "pipe", "r" ), 1 => array( "pipe", "w" ), 2 => array( "file", "/dev/null", "w" ) ); $process = proc_open( "/usr/bin/lame - -", $descriptorspec, $pipes ); fwrite( $pipes[0], $wav ); fclose( $pipes[0] ); $mp3 = stream_get_contents( $pipes[1] ); fclose( $pipes[1] ); proc_close( $process ); header('Content-Type: audio/mpeg'); echo $mp3;