~pbatch/gestvm

ea1d0c02d2a5a703f884c664cb30aa153f30d83e — Paul Batchelor 1 year, 2 months ago c423000
added parametric gliss behavior
4 files changed, 125 insertions(+), 0 deletions(-)

A examples/glissparam.lil
A examples/glissparam.tal
M examples/render.sh
M gestvm.org
A examples/glissparam.lil => examples/glissparam.lil +21 -0
@@ 0,0 1,21 @@

gestvmnew gvm

gestvmload [grab gvm] glissparam.rom


phasor 4.5 0
hold zz
regset zz 0

gestvmnode [grab gvm] [gestvmsym glissparam.rom mel] [regget 0]
add zz 60
mtof zz
blsaw zz

butlp zz 800

unhold [regget 0]

wavout zz glissparam.wav
computes 20

A examples/glissparam.tal => examples/glissparam.tal +28 -0
@@ 0,0 1,28 @@
%NUM { #24 DEO }
%DEN { #25 DEO }
%NEXT { #26 DEO }
%CURR { #2b DEO }
%NOTE { #3c ADD NEXT }
%BHVR { #27 DEO }
%PARAM { #2c DEO #2d DEO }

|0100

@glissamt 00 80 f0 a0 10 b0 20 c0 30
@glisspos 00

@mel

#00 NEXT
BRK
#01 NUM #04 DEN #0b BHVR
;glissamt ;glisspos LDA ADD LDA #00 PARAM
#05 NEXT
BRK



;glisspos LDA
#01 ADD DUP #09 LTH MUL
;glisspos STA
;mel JMP2

M examples/render.sh => examples/render.sh +1 -0
@@ 11,3 11,4 @@ render skew
render weight
render expon
render cur
render glissparam

M gestvm.org => gestvm.org +75 -0
@@ 1220,6 1220,20 @@ case 11:
    gvm->cur = (SKFLT) d->dat[port];
    break;
#+END_SRC
*** Select Behavior Parameter (12)
#+NAME: port_commands
#+BEGIN_SRC c
case 12:
    gvm->pselect = d->dat[port];
    break;
#+END_SRC
*** Set Behavior Parameter (13)
#+NAME: port_commands
#+BEGIN_SRC c
case 13:
    gvm->params[gvm->pselect] = d->dat[port];
    break;
#+END_SRC
** Tick
The =tick= function is called at audio-rate. It reads in
a conductor phasor signal, and uses it to determine whether


@@ 1462,6 1476,35 @@ static SKFLT b_gliss(gestvm *gvm, SKFLT a)
    return a;
}
#+END_SRC

Parametric glissando uses the value in behavior parameter 0
to set the gliss position.

#+NAME: static_funcdefs
#+BEGIN_SRC c
static SKFLT b_gliss_parametric(gestvm *gvm, SKFLT a);
#+END_SRC

#+NAME: funcs
#+BEGIN_SRC c
static SKFLT b_gliss_parametric(gestvm *gvm, SKFLT a)
{
    SKFLT pos;

    pos = scale255(gvm->params[0]);

    if (pos == 1.0) pos = 0.0;
    if (a < pos) {
        a = 0;
    } else {
        a -= pos;
        if (a < 0) a = 0;
        a /= (1.0 - pos);
        a = a * a * a;
    }
    return a;
}
#+END_SRC
*** Exponential
Exponetial behaviors apply various kinds of exponential
curves. There are two main types of exponential curves:


@@ 1583,6 1626,9 @@ static gestvm_behavior find_behavior(int id)
        case 10:
            b = b_expon_concave_high;
            break;
        case 11:
            b = b_gliss_parametric;
            break;
        default:
            break;
    }


@@ 1624,6 1670,35 @@ void gestvm_get_last_values(gestvm *gvm,
    *a = gvm->a;
}
#+END_SRC
** Behavior Parameters
#+NAME: gestvm
#+BEGIN_SRC c
int pselect;
int params[4];
#+END_SRC

#+NAME: init
#+BEGIN_SRC c
{
    int i;
    for (i = 0; i < 4; i++) gvm->params[i] = 0;
    gvm->pselect = 0;
}
#+END_SRC

#+NAME: static_funcdefs
#+BEGIN_SRC c
static SKFLT scale255(int x);
#+END_SRC

#+NAME: funcs
#+BEGIN_SRC c
static const SKFLT oned255 = 1.0 / 255;
static SKFLT scale255(int x)
{
    return (SKFLT)x*oned255;
}
#+END_SRC
* Weight
** Overview
This is an optional signal generator used to influence