TimeVars
TimeVar var()
A TimeVar is an abbreviation of “Time Dependent Variable” and is a key feature of Renardo. A TimeVar has a series of values that it changes between after a pre-defined number of beats and is created using a var object with the syntax var([list_of_values], [list_of_durations]).
Generates the values: 0,0,0,0,3,3,3,3…
Console Output - (The first value may differ): 0, 0
Console Output: 4, 3
Console Output: 8, 0
Duration can also be a list
When a TimeVar is used in a mathematical operation, the values it affects also become TimeVars that change state when the original TimeVar changes state – this can even be used with patterns:
Console Output: 5
Console Output: 8
Console Output: P[0, 1, 2, 3]
Console Output: P[3, 4, 5, 6]
Use ‘var’ with your Player objects to create chord progressions.
You can add a ‘var’ to a Player object or a var.
Updating the values of one ‘var’ will update it everywhere else
Vars can be named …
And used later
Any players using the named var will be updated
You can also use a ‘linvar’ that changes its values gradually over time. Change the value from 0 to 1 over 16 beats
Run this multiple times to see the changes happening
Change the amp based off that linvar
a ‘Pvar’ is a ‘var’ that can store patterns (as opposed to say, integers)
Change the scale every 16 beats
You even set the value to last forever once it is reached using a special value called “inf”
Other types of TimeVar
There are several sub-classes of var that return values between the numbers specified. For example a linvar gradually change values in a linear fashion:
Increase the high-pass filter cutoff over 32 beats
Other types include sinvar and expvar
Offsetting the start time
Another useful trick is offsetting the start time for the var. By default it is when the Clock time is 0 but you can specify a different value using the “start” keyword
This can be combined with Clock.mod() to start a ramp at the start of the next 32 beat cycle:
It should be noted that when a Player() object uses a gradually changing TimeVar function, the value stored in it will be used at the time the note was triggered. This means that after playing a note you will not hear a change in value over time in the note itself. Try these lines of code for yourself:
No gradual change in high pass frequency:
Apparent gradual change in high pass frequency:
You can also use a duration of 0 to immediately skip the gradual change and move on to the next value. This is useful for “resetting” values and creating drops.
Raise the high pass frequency filter to 4000Hz, then back to 0:
As with normal TimeVars functions, TimeVars can be nested within other TimeVars as they gradually change to better manage the application of the values. For example, we can only increase the high pass filter frequency on the last 4 beats of a 32 beat cycle as follows.
Use a normal TimeVar function to set the value to 0 for 28 beats:
TimeVars as Patterns
Pvar(patterns,dur) >> So far we have only saved individual values in a TimeVar, but sometimes it makes sense to save an entire Pattern object.
You cannot do this with a regular TimeVar because each pattern in the input list of values is treated as a nested list of individual values. To avoid this behavior, you have to use a Pvar, short for Pattern-TimeVar (time variable pattern).
It is created just like any other TimeVar, but values can be entire lists/patterns.
Console output >> 0, P[0,1,2,3]
You can even nest a Pvar within a pattern like you would with a normal pattern to play alternate values.
Alternate the alternating notes every 8 beats: