title: How to perform a Bitwise Operator on a byte array in C#
body: <p>I am using C# and <code>Microsoft.Xna.Framework.Audio</code>;</p>
  
  <p>I have managed to record some audio into a <code>byte[]</code> array and I am able to play it back.</p>
  
  <p>The audio comes in as <code>8 bit</code> unsigned data, and I would like to convert it into <code>16 bit</code> mono signed audio so I can read the frequency what not.</p>
  
  <p>I have read a few places that for sound sampling you perform a <code>Bitwise Operator Or</code> and <code>shift the bits 8 places</code>.</p>
  
  <p>I have performed the code as follows;</p>
  
  <pre><code>soundArray[i] = (short)(buffer[i] | (buffer[i + 1] &lt;&lt; 8));
  </code></pre>
  
  <p>What I end up with is a lot of negative data.</p>
  
  <p>From my understanding it would mostly need to be in the positive and would represent a wave length of data.</p>
  
  <p>Any suggestions or help greatly appreciated,</p>
  
  <p>Cheers.</p>
  
  <p>MonkeyGuy.</p>