violin_blender.py 783 B

12345678910111213141516
  1. #!/usr/bin/env python
  2. from wavebender import *
  3. def violin(amplitude=0.1):
  4. # simulates a violin playing G.
  5. return (damped_wave(400.0, amplitude=0.76*amplitude, length=44100 * 5),
  6. damped_wave(800.0, amplitude=0.44*amplitude, length=44100 * 5),
  7. damped_wave(1200.0, amplitude=0.32*amplitude, length=44100 * 5),
  8. damped_wave(3400.0, amplitude=0.16*amplitude, length=44100 * 5),
  9. damped_wave(600.0, amplitude=1.0*amplitude, length=44100 * 5),
  10. damped_wave(1000.0, amplitude=0.44*amplitude, length=44100 * 5),
  11. damped_wave(1600.0, amplitude=0.32*amplitude, length=44100 * 5))
  12. channels = (violin(),)
  13. samples = compute_samples(channels, 44100 * 60 * 1)
  14. write_wavefile(stdout, samples, 44100 * 60 * 1, nchannels=1)