Python synthesizer stuff
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

33 行
649B

  1. import pymod
  2. from math import sin, pi
  3. samplerate = 44100
  4. channels = 2
  5. x = pymod._ysynth_init(samplerate, channels)
  6. samples_processed = 0
  7. def sine_wave(channels):
  8. """
  9. Send simple 440Hz to your speakers
  10. """
  11. global samples_processed
  12. if not samples_processed:
  13. print "First time callback occurred"
  14. print "Array shape is: %s" % str(channels.shape)
  15. for i in xrange(channels.shape[0]):
  16. channels[i][0] = channels[i][1]= sin(440.0 * (i + samples_processed) /
  17. samplerate * (pi * 2.0)) * 20000
  18. samples_processed += channels.shape[0]
  19. return
  20. pymod._ysynth_set_callback(x, sine_wave)