0

I would like to play 2, 3 or more sine waves in python for 5 seconds. I know how to write a .au or .wav file that could do this, but now I would like to play directly to the sound card. I know how to do this with 1 sine wave using pyo, but now I would like to do this with 2 or more and I'm stuck. Could you show me the way?

Thanks!

Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
LucasBr
  • 461
  • 1
  • 7
  • 19

1 Answers1

1

The oscillators in pyo are individual entities, so we can create multiple instances which work simultaneously.

from pyo import *
s = Server().boot()
osc1 = Sine(freq=440).out()
osc2 = Sine(freq=810).out()
s.start()
s.gui(locals())

The harmonics are quite painful, but should quite clearly show that you have two oscillators being summed.

Mike Wild
  • 171
  • 7