9. Phrases

A gesture is built of out of chunks known as as a phrase. Phrases convert an incoming conductor signal into a single monoramp, and then divide that monoramp into a polyramp.

9.1. Struct Declaration

<<typedefs>>=
typedef struct gest_phrase gest_phrase;
<<struct_phrase>>=
struct gest_phrase {
    gest_node *top;
    SKFLT mod;
    int beats;
    gest_phrase *next;
    gest_phrase* (*nextf)(gest_d *, gest_phrase *);
    gest_metaphrase *meta;
    gest_phrase* (*get)(gest_d *, gest_phrase *);
    void *ud;
<<phrase_skew>>
};

The phrase forms the top of a Ramp Tree that gets populated.

When a phrase is over, it points to the next phrase. If there is no phrase, it loops back to itself.

9.2. Initialization

A phrase gets initialized with phrase_init. The duration of the phrase, measured in beats, is supplied.

<<static_funcdefs>>=
static void phrase_init(gest_d *g,
                        gest_phrase *phrase,
                        int beats,
                        int div);
<<funcs>>=
static void phrase_init(gest_d *g,
                        gest_phrase *phrase,
                        int beats,
                        int div)
{
    if (beats > 0) phrase->mod = 1.0 / beats;
    else phrase->mod = 0;
    phrase->beats = beats;
    phrase->next = NULL;
    phrase->top = mkpolyramp(g, NULL, div);
    phrase->meta = NULL;
    phrase->get = NULL;
    phrase->nextf = NULL;
<<phrase_skew_init>>
}

9.3. Temporal Skewing

Time (represented here as a linear construct) within a phrase can be skewed using a function.

This function is a callback called skew, and it is set to be NULL by default.

<<phrase_skew>>=
SKFLT (*skew)(SKFLT, SKFLT);
<<phrase_skew_init>>=
phrase->skew = NULL;

skew takes in two arguments, the current linear point in time t, and the increment value inc. Skew can return a new local increment value based on the linear point in time.



prev | home | next