def generate(self):
		sample_n = 0

		# in samples
		cycle_length = self.sample_rate / float(self.freq)
		midpoint = cycle_length * self.duty_cycle
		ascend_length = midpoint
		descend_length = cycle_length - ascend_length

		while True:
			cycle_position = sample_n % cycle_length
			if cycle_position < midpoint:
				yield (2 * cycle_position / ascend_length) - 1.0
			else:
				yield 1.0 - (2 * (cycle_position - midpoint) / descend_length)
			sample_n += 1
dataset/ETHPy150Open jiaaro/pydub/pydub/generators.py/Sawtooth.generate/original