Mix() object alternating channels with midi input

10 views
Skip to first unread message

kjel

unread,
Sep 14, 2022, 12:19:58 PM9/14/22
to pyo-discuss
Hello again,

I can't for the life of me figure out why the following alternates channels on each noteon:

from pyo import *

s = Server()
s.setMidiInputDevice(99)
s.boot()

note = Notein(poly=10, scale=0, first=0, last=127, channel=0, mul=1)
note.keyboard()

p1Env = MidiAdsr(note['velocity'], attack=0.1, decay=0.02, sustain=0.3, release=0.1, mul=1)

freq = MToF(note['pitch'])

p1 = Sine(freq=freq, mul=p1Env)

sound = Mix(p1, 2).out()

s.amp = 0.3

s.start()
s.gui(locals())

Isn't Mix saying take everything in my input and distribute it over two channels, and then out() is just passing those to the respective outputs?

The following code has a different problem which is that the right channel is used exclusively (no alternation):

from pyo import *

s = Server()
s.setMidiInputDevice(99)
s.boot()

note = Notein(poly=10, scale=0, first=0, last=127, channel=0, mul=1)
note.keyboard()

p1Env = MidiAdsr(note['velocity'], attack=0.1, decay=0.02, sustain=0.3, release=0.1, mul=1)

freq = MToF(note['pitch'])

p1 = Sine(freq=freq, mul=p1Env)

sound = Mix(p1, 1)

SL = sound.out()
SR = sound.out(1)

s.amp = 0.3

s.start()
s.gui(locals())

I'm guessing this is because SR = sound.out(1) overwrites the previous statement because they're both referencing the same object (sound). But shouldn't this be an example of parallel processing since they have different variable names (SL, SR)? I think it has something to do with polyphony management but haven't been able to figure it out.

Thanks again for your help. I was going to try to ask one question at a time, but I'm too excited about Pyo.

Kjel
Reply all
Reply to author
Forward
0 new messages