| 183 | | $newname = strtr($mohfile,"&", "_"); |
|---|
| 184 | | if(strstr($newname,".mp3")) { |
|---|
| 185 | | $onlywav = false; |
|---|
| 186 | | } |
|---|
| 187 | | if(!$onlywav) { |
|---|
| 188 | | $newmohfile=$path_to_dir."/". ((strpos($newname,'.mp3') === false) ? $newname.".mp3" : $newname); |
|---|
| 189 | | $lamecmd="lame --cbr -m m -t -F \"".$origmohfile."\" \"".$newmohfile."\" 2>&1 "; |
|---|
| 190 | | if (strpos($newmohfile,'.mp3') !== false) |
|---|
| 191 | | exec($lamecmd, $output, $returncode); |
|---|
| 192 | | } else { |
|---|
| 193 | | $newmohfile = $path_to_dir."/wav_".$newname; |
|---|
| 194 | | $soxcmd = "sox \"".$origmohfile."\" -r 8000 -c 1 \"".$newmohfile."\" "; |
|---|
| 195 | | $soxresample = "resample -ql "; |
|---|
| 196 | | exec($soxcmd.$soxresample."2>&1", $output, $returncode); |
|---|
| 197 | | if ($returncode != 0) { |
|---|
| 198 | | // try it again without the resample in case the input sample rate was the same |
|---|
| 199 | | // |
|---|
| 200 | | exec("rm -rf \"".$newmohfile."\""); |
|---|
| 201 | | exec($soxcmd."2>&1", $output, $returncode); |
|---|
| 202 | | } |
|---|
| 203 | | } |
|---|
| | 182 | if($onlywav) { |
|---|
| | 183 | $newname = substr($mohfile,0,strrpos($mohfile,".")); |
|---|
| | 184 | |
|---|
| | 185 | // If we are dealing with an MP3, we need to decode it to a wav file |
|---|
| | 186 | if (strpos($origmohfile,'.mp3') !== false) { |
|---|
| | 187 | //$lamecmd="lame --cbr -m m -t -F --decode \"".$origmohfile."\" \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\" 2>&1 "; |
|---|
| | 188 | // exec($lamecmd, $output, $returncode); |
|---|
| | 189 | $mpg123cmd = "mpg123 -w \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\" \"".$origmohfile."\" 2>&1 "; |
|---|
| | 190 | exec($mpg123cmd, $output, $returncode); |
|---|
| | 191 | } |
|---|
| | 192 | $newmohfile = $path_to_dir."/wav_".$newname.".wav"; |
|---|
| | 193 | //asdf |
|---|
| | 194 | $soxcmd = "sox \"".substr($origmohfile,0,strrpos($origmohfile,".")).".wav\""; |
|---|
| | 195 | if($volume) |
|---|
| | 196 | $soxcmd .= " -v ".$volume; |
|---|
| | 197 | $soxcmd .= " -r 8000 -c 1 \"".$newmohfile."\" "; |
|---|
| | 198 | $soxresample = "resample -ql "; |
|---|
| | 199 | exec($soxcmd.$soxresample."2>&1", $output, $returncode); |
|---|
| | 200 | if ($returncode != 0) { |
|---|
| | 201 | // try it again without the resample in case the input sample rate was the same |
|---|
| | 202 | // |
|---|
| | 203 | exec("rm -rf \"".$newmohfile."\""); |
|---|
| | 204 | exec($soxcmd."2>&1", $output, $returncode); |
|---|
| | 205 | } |
|---|
| | 206 | } |
|---|
| 282 | | <input type="checkbox" name="onlywav" checked="checked"><small><?php echo _("Do not encode wav to mp3"); ?></small> |
|---|
| | 292 | <select name="volume"> |
|---|
| | 293 | <option value="1.50">Volume 150%</option> |
|---|
| | 294 | <option value="1.25">Volume 125%</option> |
|---|
| | 295 | <option value="" selected>Volume 100%</option> |
|---|
| | 296 | <option value=".75">Volume 75%</option> |
|---|
| | 297 | <option value=".5">Volume 50%</option> |
|---|
| | 298 | <option value=".25">Volume 25%</option> |
|---|
| | 299 | <option value=".1">Volume 10%</option> |
|---|
| | 300 | </select> |
|---|
| | 301 | <small><?php echo _("Volume adjustments are done linearly, therefore 50% will not be exactly 'half volume'"); ?></small> |
|---|