def impulse(self, amp, width, pan, hz): width = int(dsp.htf(hz) * math.fabs(width)) snd = dsp.cycle(dsp.fth(width)) snd = dsp.amp(snd, amp) snd = dsp.pan(snd, pan) snd = dsp.pad(snd, 0, dsp.htf(hz) - dsp.flen(snd)) return snd
def test_lengths(self): freqs = range(1, 20000, 200) for freq in freqs: self.assertEqual(dsp.flen(dsp.cycle(freq, 'random')), dsp.htf(freq))