-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsplit.php
More file actions
39 lines (31 loc) · 915 Bytes
/
split.php
File metadata and controls
39 lines (31 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
$filename = "32GB.IMG";
//Change to filename
$offsetsize = 1140224;
//Find with hex editor
$recordsize = 196608;
// 6 clusters left and 6 cluster right
// Byste per cluster: 32768
//So 6x32768=196608
//So split every 196608 bytes
$handle = fopen ($filename, "r");
$leftfile = fopen("channel1.wav", "w");
$rightfile = fopen("channel2.wav", "w");
//here i read wav headers
$headers = fread ($handle, $offsetsize);
$leftsound = true;
while (!feof($handle)) {
$bps = fread($handle, $recordsize);
if($leftsound){
fwrite($leftfile, $bps);
}else{
fwrite($rightfile, $bps);
}
$leftsound = !$leftsound;
}
fclose ($handle);
var_dump($leftfile,$rightfile);
//write left file
fclose($leftfile);
fclose($rightfile);
?>