Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def create_samples(self):
- print "creating samples"
- def convert_to_zero(a):
- return a/32768.0
- sample_list = list()
- while len(self.sound_data) >= self.chunk * 2:
- chunk_data = self.sound_data[:self.chunk * 2]
- self.sound_data = self.sound_data[self.chunk * 2:]
- sample = np.fromstring(chunk_data, dtype=np.int16)
- fixed = np.apply_along_axis(convert_to_zero, 0, sample)
- sample_list.append(fixed)
- print "samples created"
- return np.hstack(sample_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement