title: How to manually convert 8.24-bit deinterleaved lpcm to 16-bit lpcm?
body: <p>I have a chunk of data (void*) which is 2 ch,  44100 Hz, 'lpcm' 8.24-bit little-endian signed integer, deinterleaved.
  I need to record that chunk to a file as 2 ch,  44100 Hz, 'lpcm' 16-bit little-endian signed integer.</p>
  
  <p>How do I convert data? I can imagine I need to do something like this:</p>
  
  <pre><code>uint dataByteSize = sizeof(UInt32) * samplesCount;
  UInt32* source = ...;
  UInt32* dest = (UInt32*)malloc(dataByteSize);
  for (int i = 0; i &lt; samplesCount; ++i) {
      UInt32 sourceSample = source[i];
      UInt32 destSample = sourceSample&gt;&gt;24;
      dest[i] = destSample;
  }
  </code></pre>
  
  <p>But how do I convert deinterleaved to interleaved?</p>