Some questions on tables.

7 views
Skip to first unread message

Gabriele Battaglia

unread,
Mar 19, 2024, 6:25:07 AM3/19/24
to pyo-d...@googlegroups.com
Hi.

I want to create a table containing frequencies.

Than a simple sine that parses along them with portamento.

Is the lintable the most indicated to use?

In order to read it, do I have to use a osc object or even a
Sine(freq=table.... would be ok?


If I use osc, which kind of waveform does it have?


Could someone post some example of using tables for accomplish simple tasks?


Thanks.


--
Gabriele Battaglia (IZ4APU)
--... ...-- -.. . .. --.. ....- .- .--. ..- - ..- . .
Sent from my Giant Desktop PC

Bibiko

unread,
Mar 19, 2024, 8:34:39 AM3/19/24
to pyo-discuss
Hi, you wrote

On Tuesday, March 19, 2024 at 11:25:07 AM UTC+1 gabriele wrote:
I want to create a table containing frequencies.
Than a simple sine that parses along them with portamento.

There are many, many ways to achieve this. I do it the following way to keep everything under control, i.e. e.g. you could change the portamento time accordingly or whatever :

from pyo import *

s = Server().boot().start()

# endless loop over `alist` and sets the next asigto value
def gen_fn(alist, asigto):
    while True:
        for f in alist:
            asigto.value = f
            yield

# some frequenicies
f_in = [110, 220, 330, 440, 220, 330]

# time hold the portamento time
f_sig = SigTo(value=f_in[0], time=0.5, init=f_in[0])
f_sig.ctrl(title='Portamento Time')

# a Python generator to get the next frequency by calling it as loop
freqs = gen_fn(f_in, f_sig)

a = Sine(freq=f_sig, mul=.2).mix(2).out()

# call every `time` next(freqs)
pat = Pattern(function=lambda f=freqs: next(f), time=1).play()
pat.ctrl(title='Beat Time')

s.gui(locals())

Maybe it helps.
Ciao, Hans

Reply all
Reply to author
Forward
0 new messages