Play 2+ sine waves together in python with pyo

1.4k views Asked by At

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!

1

There are 1 answers

0
Mike Wild On BEST ANSWER

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.