Python synthesizer stuff
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

39 wiersze
1.2KB

  1. from ysynth import *
  2. synth = YSynth()
  3. #synth.set_graph(Sin(440 + 110 * Sin(1)))
  4. #synth.set_graph((Saw(440) + Sin(550)) * 0.25)
  5. #synth.set_graph(Square(220) * 0.5)
  6. #synth.set_graph(Sin(440 + 44 * Sin(4) + 110 * Square(0.5)) * 0.1)
  7. #synth.set_graph(Sin(440 * (Saw(0.5) + 1.0) * 0.5) * 0.05)
  8. #synth.set_graph(Sin(220) * 0.5)
  9. #synth.set_graph(Pulse(220) * 0.25)
  10. #synth.set_graph(Sin(440) * 0.25)
  11. #synth.set_graph(WhiteNoise() * 1.0)
  12. # Should sound vagely similar to a flanged whitenoise signal
  13. noise = WhiteNoise()
  14. synth.set_graph((noise + noise[50 + 100 * (Sin(0.1) + 1)]) * 0.5 * (RevSaw(2) + 1) * 0.5)
  15. #synth.set_graph(Sin(440) * RevSaw(5) * 0.2)
  16. #synth.set_graph((Sin(440) * 0.5, Sin(220) * 0.5))
  17. #synth.set_graph(Sin((440, 220)) * 0.5)
  18. def short_pulse(shortness, silence):
  19. z = (Square(2. ** shortness) + 1) * 0.5
  20. for i in xrange(silence):
  21. z = z * (Square(2. ** (shortness - i)) + 1) * 0.5
  22. return z
  23. # Echo effect
  24. #sine_pulse = Sin(440) * short_pulse(3, 4) * 1.0
  25. #sine_pulse = sine_pulse * 0.9 + sine_pulse[2000] * 0.1
  26. #synth.set_graph(sine_pulse)
  27. def harmonics(osc, freq, count):
  28. return reduce(lambda a, b: a + b,
  29. (osc(freq * i) for i in xrange(1, count + 2))) \
  30. / (count + 1)