;$w;
38 while(1)
39 {
40 if($s == 0) break;
41 if($s < $n) $n = $s;
42 $samples = fread($fp, 1000 * $n);
43 if($samples === FALSE) break;
44 $packed = unpack("s*", $samples);
45 foreach($packed as $k=>$v)
46 {
47 $cnt = ($k-1) % ($w * $l) ;
48 if( $cnt > $c - 1) continue;
49 $yn[$cnt] = $h * $cnt + $h - $v / $f;
50 imageline($im, $x, $y[$cnt], $x+1, $yn[$cnt], $color);
51 $y[$cnt] = $yn[$cnt];
52 $x++;
53 }
54 $s -= $n;
55 }
56
57 imagepng($im);
58 imagedestroy($im);
59 }
60
61 //wav_graph('audio2.wav');
62 ?>