Tools.php

From SoundDB
Revision as of 21:11, 17 August 2012 by Admin (talk | contribs)
Jump to: navigation, search
<?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);
	}
}

?>