A very basic question.

45 views
Skip to first unread message

iz4...@libero.it

unread,
Dec 15, 2023, 3:53:12 AM12/15/23
to pyo-d...@googlegroups.com

Hello all…

 

I’ve already asked about this and also got an answer. By the way, the question is still not clear to me and I would like to bother you once more, if you don’t mind. My apologize for that.

 

My question is very very basic and has to do with the way in which Pyo obj receives parameters.

 

If I set a sine’s frequency as 440hz, it’s absolutely clear what I’m doing; but what is happening in real, if I pass a list like [440, 880]?

Am I creating 2 sine objs? Or a single sine with 1 armonic? And, in this second case, which is the volume/ratio in between the two?

And if I would pass a …200 items list, what’s happen?

 

More in general: which is the difference to pass a single parameter or a list of values and, most important, where these basics are in the documentation? I searched for them but I didn’t find it.

 

Thank you very much.

 

Gabe.

 

Gabriele Battaglia (Gabe / Gabry) - IZ4APU

--... ...--  -.. .  .. --.. ....- .- .--. ..-  - ..-  . .

Sent from Outlook on Windows, Genus Bononiae's computer. (Libero)

 

barmin

unread,
Dec 15, 2023, 4:20:43 AM12/15/23
to pyo-d...@googlegroups.com
Hi Gabe,

> If I set a sine’s frequency as 440hz, it’s absolutely clear what I’m doing; but what is happening in real, if I pass a list like [440, 880]?

Yeah, it's called multi-channel expansion. It's a very nice and central feature of pyo that is not so easy to find in the docs.

You'll find an introduction there:
http://ajaxsoundstudio.com/pyodoc/examples/02-controls/06-multichannel-expansion.html
http://ajaxsoundstudio.com/pyodoc/examples/02-controls/07-multichannel-expansion-2.html

> Am I creating 2 sine objs? Or a single sine with 1 armonic? And, in this second case, which is the volume/ratio in between the two?

So you're creating 1 Sine object with 2 streams (or channels). The volume will depend on the mul argument. If you write

s = Sine([100,200])

you'll have two streams with the default volume 1. The streams are computed separately, so you could process them differently until you mix them down.

If you write something like

s = Sine([100,200], mul=[.5, .8])

you can assign volumes separately.

> And if I would pass a …200 items list, what’s happen?

It would create 1 sine object with 200 streams. What happens then will definitely depend on your machine, your audio settings, your processing chain and what you're running in parallel on the same machine...

(see http://ajaxsoundstudio.com/pyodoc/perftips.html#mix-down-before-applying-effects for considerations on multichannel expansion and efficiency)

Hope that helps,

Matthieu

gabriele....@gmail.com

unread,
Dec 15, 2023, 5:09:17 AM12/15/23
to pyo-d...@googlegroups.com
Thank you Matteu. Going to study! LOL.

barmin

unread,
Dec 15, 2023, 5:13:34 AM12/15/23
to pyo-d...@googlegroups.com
> Thank you Matteu. Going to study! LOL.

Definitely worth it!

Olivier Bélanger

unread,
Dec 15, 2023, 6:47:35 AM12/15/23
to pyo-d...@googlegroups.com
Multi-channel expansion really deserves a dedicated page in the documentation. Added to my TODO list!

Olivier


On Fri, Dec 15, 2023 at 5:13 AM barmin <bar...@bluewin.ch> wrote:
> Thank you Matteu. Going to study! LOL.

Definitely worth it!

--
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyo-discuss/ecb80409-c72b-42f1-87f1-9e5f8cd0dd24%40bluewin.ch.

barmin

unread,
Dec 15, 2023, 7:29:24 AM12/15/23
to pyo-d...@googlegroups.com
> Multi-channel expansion really deserves a dedicated page in the documentation. Added to my TODO list!

After quite a few years on this list, I think the most frequently asked questions are about (in no particular order)

1) multi-channel expansion

2) the necessity of keeping the python process alive (no sound because the main python process quits)

3) scoping problems (defining a PyoObject in a function that gets garbage-collected before it produces sound)

Adding some documentation about some or all of these subjects would definitely help people who are discovering pyo. I'm aware that #2 and #3 are more python-related than pyo-related, but still...

Olivier, if you need help I'm willing to contribute to this documentation. Mutli-channel expansion would probably best be explained by you, but if you want to start e.g. a FAQ page with the two other ones, I could try and write answers if you want.

Cheers,

Matthieu

gabriele....@gmail.com

unread,
Dec 15, 2023, 7:32:43 AM12/15/23
to pyo-d...@googlegroups.com

Thank you all guys. You’re very kind on my basic dubts. LOL.

Alexandros Drymonitis

unread,
Dec 19, 2023, 5:52:40 AM12/19/23
to pyo-d...@googlegroups.com

When you pass a list to any kwarg of a PyoObject, then you create as many streams of that object as the number of items in your list. If you create a sine wave with [440, 880] list as the freq kwarg, then you'll create two sine waves, one at 440Hz and the other at 880Hz. The first one will come out your left speaker, and the second will come out your right speaker.

--
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.

Olivier Bélanger

unread,
Jan 5, 2024, 2:27:36 PM1/5/24
to pyo-d...@googlegroups.com
Hi Matthieu,

Added to my TODO list!

Olivier


--
You received this message because you are subscribed to the Google Groups "pyo-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyo-discuss...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages