def render(self, chunk_size=None): gain = getattr(self.track, 'gain', 1.0) if chunk_size is None: yield fadeout(self.track[self].data, gain) else: start = int(self.start * 44100) end = int((self.start + self.duration) * 44100) for i in xrange(start, end, chunk_size): e = min(end, i + chunk_size) yield (fade(self.track[i:e].data, gain, 1.0 - (float(i - start) / (end - start)), 1.0 - (float(e - start) / (end - start))) .astype(numpy.int16))
def render(self): gain = getattr(self.track, 'gain', 1.0) output = self.track[self] # second parameter is optional -- in place function for now output.data = fadeout(output.data, gain) return output