
function fromUint8s(buf) {
  var samples = new Float32Array(buf.length);
  for (var i = 0; i < buf.length; i++) {
    samples[i] = (buf[i] - 128) / 128;
  }
  return samples;
}

function fromInt8s(buf) {
  var samples = new Float32Array(buf.length);
  for (var i = 0; i < buf.length; i++) {
    samples[i] = buf[i] / 128;
  }
  return samples;
}

@@ -7,62 +7,432 @@
 ion 
-fromUint8s(buf
+PCMUint8Mono() %7B%0A%7D%0APCMUint8Mono.prototype = %7B%0A  process: function(input, output
 ) %7B%0A  
+ 
+ 
 var 
-samples = new Float32Array(buf
+output_pos;%0A    if ('leftover' in this) %7B%0A      var leftover = this.leftover;%0A      delete this.leftover;%0A      output_pos = this.process(leftover, output);%0A    %7D%0A    else %7B%0A      output_pos = 0;%0A    %7D%0A    if (input.length %3E output.length) %7B%0A      this.leftover = input.subarray(output.length);%0A      input = input.subarray(0, output
 .len
@@ -429,32 +429,40 @@
 output.length);%0A
+    %7D%0A  
   for (var i = 0
@@ -460,61 +460,95 @@
 var 
-i
+pos
  = 0
-; i %3C buf.length; i++) %7B%0A    samples%5Bi%5D = (buf%5Bi
+, pos_max = input.length; pos %3C pos_max; pos++) %7B%0A      output%5Bpos%5D = (input%5Bpos
 %5D - 
@@ -553,34 +553,38 @@
 - 128) / 128;%0A  
-%7D%0A
+  %7D%0A  
   return samples
@@ -580,82 +580,453 @@
 urn 
-samples;%0A%7D%0A%0Afunction fromInt8s(buf) %7B%0A  var samples = new Float32Array(buf
+pos;%0A  %7D,%0A%7D;%0A%0Afunction PCMInt8Mono() %7B%0A%7D%0APCMInt8Mono.prototype = %7B%0A  process: function(input, output) %7B%0A    var output_pos;%0A    if ('leftover' in this) %7B%0A      var leftover = this.leftover;%0A      delete this.leftover;%0A      output_pos = this.process(leftover, output);%0A    %7D%0A    else %7B%0A      output_pos = 0;%0A    %7D%0A    if (input.length %3E output.length) %7B%0A      this.leftover = input.subarray(output.length);%0A      input = input.subarray(0, output
 .len
@@ -1031,16 +1031,24 @@
 ength);%0A
+    %7D%0A  
   for (v
@@ -1054,69 +1054,117 @@
 var 
-i
+pos
  = 0
-; i %3C buf.length; i++) %7B%0A    samples%5Bi%5D = buf%5Bi%5D
+, pos_max = input.length; pos %3C pos_max; pos++) %7B%0A      output%5Bpos%5D = (input%5Bpos%5D %3C%3C 24 %3E%3E 24)
  / 128;%0A
   %7D%0A
@@ -1159,20 +1159,24 @@
  / 128;%0A
+  
   %7D%0A
+  
   return
@@ -1180,15 +1180,159 @@
 urn 
-samples
+pos;%0A  %7D,%0A%7D;%0A%0Aself.init_pcm_uint8mono = function() %7B%0A  return new PCMUint8Mono();%0A%7D;%0A%0Aself.init_pcm_int8mono = function() %7B%0A  return new PCMInt8Mono()
 ;%0A%7D
+;
 %0A

Support pcm/uint8mono and pcm/int8mono