consolidate over +1500 wav files and slice them again (in PHP)
Because I'd like to save a lot of work, I've tried to make a function to consolidate wav files per folder. The folder(s) contain about 100 till 500 wav files. All wav files are stereo, 44.100 Hz and 24bits.
There are over 1500 lose wav files, which can't be edited by batch processing, because the program I'm using (for other specific reasons) does not have a batch processing option.
Therefor I trie to:
-> Consolidate wav files + 0.5s of silence and make a cue list
-> edit large files (done in music edit software)
-> split large files back to it's original files (exact) by cue list (without the silence)
It seems to me, the best way is to remove the file header (save it in a cue) and just join the bytes?
The only language I know so far is PHP, so all that I tried to achieve is in PHP. I figured out I lack the skills and knowledge to do this and I hope someone can help here.
The basic things I've tried to accomplish are: -Make an array of all wav files -Add 0.5s of silence after each file(in the array) -Create final array to convert file back to original -Remove the file header -Create new wave file.
Some basic function:
function wav_scan_dir($directory){
$filenames = array();
$iterator = new DirectoryIterator($directory);
foreach ($iterator as $fileinfo) {
if ($fileinfo->isFile() && $fileinfo->getExtension() === "wav") {
$filenames[$fileinfo->getFilename()] = filesize($directory.$fileinfo->getFilename());
}
}
return $filenames;
}
$directory = dirname(__FILE__)."/WAVES/";
$files = wav_scan_dir($directory);
Because of comment extra info:
folder contains: 01original.wav, 02original.wav, 03original.wav.
edit to
onebigfile.wav = 01original.wav +0.5silence, 02original.wav, +0.5silence, 03original.wav.
After edit return to (same exact size/length as original wav files):
01original.wav, 02original.wav, 03original.wav.