def unpitched_low(dur, idx): """ Non-harmonic bass/lower frequency sound as a list (due to memoization). Parameters ---------- dur: Duration, in samples. idx: Zero or one (integer), for a small difference to the sound played. Returns ------- A list with the synthesized note. """ env = sinusoid(lag2freq(dur * 2)).limit(dur)**2 freq = 40 + 20 * sinusoid(1000 * Hz, phase=uniform(-pi, pi)) # Hz result = (low_table(freq * Hz) + low_table(freq * 1.1 * Hz)) * env * .5 return list(result)
def unpitched_low(dur, idx): """ Non-harmonic bass/lower frequency sound as a list (due to memoization). Parameters ---------- dur: Duration, in samples. idx: Zero or one (integer), for a small difference to the sound played. Returns ------- A list with the synthesized note. """ env = sinusoid(lag2freq(dur * 2)).limit(dur) ** 2 freq = 40 + 20 * sinusoid(1000 * Hz, phase=uniform(-pi, pi)) # Hz result = (low_table(freq * Hz) + low_table(freq * 1.1 * Hz)) * env * 0.5 return list(result)
def zcross_pitch(sig, size=2048, hop=None): for blk in zcross(sig, hysteresis=.01).blocks(size=size, hop=hop): crossings = sum(blk) yield 0. if crossings == 0 else lag2freq(2. * size / crossings)
def zcross_pitch(sig, size=2048, hop=None): for blk in zcross(sig, hysteresis=0.01).blocks(size=size, hop=hop): crossings = sum(blk) yield 0.0 if crossings == 0 else lag2freq(2.0 * size / crossings)