title: splititng 24 bit depth wav sound in interval in pure python
body: <p>Currently I'm making some small research on wave files using only Python.
  One problem I can't solve right now, is splitting wav data. format file with 24 bit sound depth correctly.</p>
  
  <p>So the basic idea is: given <code>t1</code> - start and <code>t2</code> -end, and I need to get the <code>slice</code>, which is quite clear.</p>
  
  <pre><code>def split_in_interval(self, start, end):
      start *= ONE_SEC_MS
      end *= ONE_SEC_MS
      header = self.wav_header.header_description
      infile = open(self.file_name, 'rb')
  
      rate = header['sample_rate']
      frames_per_m_sec = rate // 1000
      length = (end - start) * frames_per_m_sec
      start_ms = start * frames_per_m_sec
  
      name_str = self._naming_fragment(start, end)
      out_file = open(name_str, 'wb')
  
      # as the size changes - need to recalculate only last part of header,
      # it takes 4 last bytes of header
      out_file.write(infile.read(WAV_HEADER - 4))
  
      size = length * header['block_align']
      # header['num_channels'] * width
      packed_size = struct.pack('&lt;L', size)
      out_file.write(packed_size)
  
      anchor = infile.tell()
      infile.seek(anchor + start_ms)
  
      out_file.write(infile.read(size))
      out_file.close()
      infile.close()
  </code></pre>
  
  <p>I think my code is quite straight forward and it works fine with 16 and 8 bits depth sounds, but after I tried 24 - it fails.</p>
  
  <p>I take rate and convert it into milliseconds, my Start and End parameters also convert to ms.
  And after, basis on this calculations, assuming they're right I'm finding start_point in my source audio and then write from this point to the end.
  What may I do wrong?
  How to solve this problem, using <strong>only</strong> Python without any external libraries.</p>
  
  <p>Thanks, in advance.</p>