Beispiel #1
0
 def __setitem__(self, num, sample):
     sample_size = self.chunks["fmt "].block_align // self.chunks["fmt "].num_channels
     sample = byte_tools.int_to_bytes(sample, sample_size)
     if len(sample) != sample_size:
         raise ValueError("Sample setter size error.")
     for i in range(sample_size):
         self.chunks["data"].data[num * sample_size + i] = sample[i]
Beispiel #2
0
 def test_byte_to_int_and_back(self):
     b = b'abcd'
     n = byte_tools.bytes_to_int(b)
     self.assertEqual(b, byte_tools.int_to_bytes(n))