Advertisement
Guest User

Untitled

a guest
Apr 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. def create_samples(self):
  2. print "creating samples"
  3. def convert_to_zero(a):
  4. return a/32768.0
  5. sample_list = list()
  6. while len(self.sound_data) >= self.chunk * 2:
  7. chunk_data = self.sound_data[:self.chunk * 2]
  8. self.sound_data = self.sound_data[self.chunk * 2:]
  9. sample = np.fromstring(chunk_data, dtype=np.int16)
  10. fixed = np.apply_along_axis(convert_to_zero, 0, sample)
  11. sample_list.append(fixed)
  12. print "samples created"
  13. return np.hstack(sample_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement