|
-
- from ysynth import *
-
- synth = YSynth()
- #synth.set_graph(Sin(440 + 110 * Sin(1)))
- #synth.set_graph((Saw(440) + Sin(550)) * 0.25)
- #synth.set_graph(Square(220) * 0.5)
- #synth.set_graph(Sin(440 + 44 * Sin(4) + 110 * Square(0.5)) * 0.1)
- #synth.set_graph(Sin(440 * (Saw(0.5) + 1.0) * 0.5) * 0.05)
- #synth.set_graph(Sin(220) * 0.5)
- #synth.set_graph(Pulse(220) * 0.25)
- #synth.set_graph(Sin(440) * 0.25)
- #synth.set_graph(WhiteNoise() * 1.0)
-
- # Should sound vagely similar to a flanged whitenoise signal
- noise = WhiteNoise()
- synth.set_graph((noise + noise[50 + 100 * (Sin(0.1) + 1)]) * 0.5 * (RevSaw(2) + 1) * 0.5)
- #synth.set_graph(Sin(440) * RevSaw(5) * 0.2)
- #synth.set_graph((Sin(440) * 0.5, Sin(220) * 0.5))
- #synth.set_graph(Sin((440, 220)) * 0.5)
-
- def short_pulse(shortness, silence):
- z = (Square(2. ** shortness) + 1) * 0.5
- for i in xrange(silence):
- z = z * (Square(2. ** (shortness - i)) + 1) * 0.5
-
- return z
-
- # Echo effect
- #sine_pulse = Sin(440) * short_pulse(3, 4) * 1.0
- #sine_pulse = sine_pulse * 0.9 + sine_pulse[2000] * 0.1
- #synth.set_graph(sine_pulse)
-
- def harmonics(osc, freq, count):
- return reduce(lambda a, b: a + b,
- (osc(freq * i) for i in xrange(1, count + 2))) \
- / (count + 1)
|