SigTo portamento

12 views
Skip to first unread message

Gabriele Battaglia

unread,
Mar 19, 2024, 9:04:45 AM3/19/24
to pyo-d...@googlegroups.com
...what is the minimum resolution for portamento?

Thanks.

Gabe.

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

Bibiko

unread,
Mar 19, 2024, 9:10:43 AM3/19/24
to pyo-discuss
Hi,

what do you mean by 'resolution'? 

For SigTo(value, time=0.025, init=0.0,...) `time` specifies how long (in seconds from 0.0 to whatever) it will take to come from the current value (frequency) to the new one. You can set it to 0.123456789 (seconds) if you like.

See also class definition:

class SigTo(PyoObject):
    """
    Convert numeric value to PyoObject signal with portamento.

    When `value` is changed, a ramp is applied from the current
    value to the new value. Can be used with PyoObject to apply
    a linear portamento on an audio signal.

    :Args:

        value: float or PyoObject
            Numerical value to convert.
        time: float or PyoObject, optional
            Ramp time, in seconds, to reach the new value. Defaults to 0.025.
        init: float, optional
            Initial value of the internal memory. Defaults to 0.
...

Ciao, Hans

Gabriele Battaglia

unread,
Mar 19, 2024, 9:20:43 AM3/19/24
to pyo-d...@googlegroups.com

Il 19/03/2024 14:10, Bibiko ha scritto:
> Hi,
>
> what do you mean by 'resolution'?
>

Ciao Hans, nice to read from you.

I mean what is the smalest number I can give to time=, in SigTo.

It's default to .025 but for my specific case I need to work with a very
large numbers of transitions and I need to have a very very fast ramps
in between frequencies.


Example.

I have a 20K lenght list of frequencies.

I want to create a 10 seconds of audio where a Sine sweeps all the
frequencies.


I saw that 10 seconds are not enough to parse all the 20000 values.

So I would need to know what's the minimum ramp I could consider.


Gabe.

Bibiko

unread,
Mar 19, 2024, 12:38:56 PM3/19/24
to pyo-discuss
Hi,

oha - one can only try - my quick&dirty solution would be:

import random
from pyo import *
from time import sleep
from threading import Thread

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

# some frequenicies
f_in = [random.randint(100, 300) for x in range(20000)]

out_length = 10  # in secs

# since the accurancy of time.sleep depends on OS and
# python's implementation and internal runtimes - play with it
sleep_correction = .66
beat_time = out_length/len(f_in) * sleep_correction

f_sig = SigTo(value=0, time=beat_time/2, init=0)

# only to avoid play and stop cracks
fader = Fader(.05, .05, mul=.5)

a = Sine(freq=f_sig, mul=fader).out()

def run():
    for f in f_in:
        f_sig.setValue(f)
        sleep(beat_time)
    fader.stop()
    sleep(.1)
    a.stop()

def start():
    fader.play()
    thread = Thread(target=run)
    thread.start()

# start audio in 2 secs
x = CallAfter(start, 2)

s.gui(locals())


Ciao, Hans
Reply all
Reply to author
Forward
0 new messages