Tools.php
From SoundDB
<syntaxhighlight lang="php"> <?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); } }
?>
</synthxhigtlight>