1
我正在通過此功能合併多個音頻文件(.wav),但現在我要指定輸出文件的比特率。我該怎麼辦?如何在此PHP函數中設置合併音頻文件的比特率
function joinwavs($wavs) {
$fields = join('/', array('H8ChunkID', 'VChunkSize', 'H8Format',
'H8Subchunk1ID', 'VSubchunk1Size',
'vAudioFormat', 'vNumChannels', 'VSampleRate',
'VByteRate', 'vBlockAlign', 'vBitsPerSample'));
$data = '';
foreach ($wavs as $wav) {
$wav = str_replace('http://example.com/', '', $wav);
$fp = fopen($wav, 'rb');
$header = fread($fp, 36);
$info = unpack($fields, $header);
// read optional extra stuff
if ($info['Subchunk1Size'] > 16) {
$header .= fread($fp, ($info['Subchunk1Size'] - 16));
}
// read SubChunk2ID
$header .= fread($fp, 4);
// read Subchunk2Size
$size = unpack('vsize', fread($fp, 4));
$size = $size['size'];
// read data
$data .= fread($fp, $size);
}
return ($header . pack('V', strlen($data)) . $data);
}
只是想知道:你選擇PHP來處理音頻文件的任何原因? – 2012-04-06 11:28:42