title: How do you load a WAV file with Sound.loadPCMFromByteArray()?
body: <p>Based on the resource <a href="https://ccrma.stanford.edu/courses/422/projects/WaveFormat/" rel="nofollow">here</a> (defining the <strong>structure of a WAV file</strong>), I was able to get the audio data between the 44th byte and near the end of the file (some extra meta-data exists at the end which is not necessary).</p>
  
  <p>But I'm having trouble loading it with the new <code>Sound.loadPCMFromByteArray()</code> method available in Flash Player 11.</p>
  
  <p>I get this error if I pass the number of samples:</p>
  
  <pre><code>_sound.loadPCMFromByteArray(pcm, pcm.length, "float", wav.isStereo, wav.sampleRate);
  </code></pre>
  
  <ul>
  <li><strong>[Fault] exception, information=ArgumentError: Error #2084: The AMF encoding of the arguments cannot exceed 40K</strong></li>
  </ul>
  
  <p>However, if I divide the <code>pcm.length</code> by four (4), it seems to play "something" but isn't at all the sample that I passed it originally. Plus, it sounds like it's <strong>looping</strong> forever, is this the intended behavior? (<em>I sure hope not!</em>)</p>
  
  <pre><code> //Dividing by 4 (# &gt;&gt; 2 is the same) is playable, but incorrect!
   _sound.loadPCMFromByteArray(pcm, pcm.length &gt;&gt; 2, "float", wav.isStereo, wav.sampleRate);
  </code></pre>
  
  <p>Does the ByteArray of WAV data need to be processed a certain way to conform to a readable PCM format? Do I need to insert an <strong>EOF</strong> character at the end so it knows when to stop the Sound file?</p>
  
  <p>Should I use another format than <em>"float"</em>? Which ones are supported?</p>