Difference between revisions of "Tools.php"

From SoundDB
Jump to: navigation, search
(Created page with "<syntaxhighlight lang="php"> <?php function wavToCaf($input) { $output = str_replace(".wav", ".caf", $input); $cmd = "afconvert -f caff -d ima4@22050 -c 1 " . $input . " " . $...")
 
Line 19: Line 19:
 
?>
 
?>
  
</synthxhigtlight>
+
</syntaxhighlight>

Revision as of 21:11, 17 August 2012

<?php

function wavToCaf($input) {
	$output = str_replace(".wav", ".caf", $input);
	$cmd = "afconvert -f caff -d ima4@22050 -c 1 " . $input . " " . $output;
	echo "Processing: ". $cmd . "\n";
	exec($cmd);
}

$filelist = scandir(getcwd());

foreach ($filelist as $key => $filename) {
	if (strpos($filename, ".wav") !== false) {
	    wavToCaf($filename);
	}
}

?>