Commit c40617b5 authored by jhammen's avatar jhammen
Browse files

use lv2 control change message

parent 1a31e777
......@@ -20,11 +20,8 @@ local synth = Lv2.Plugin("http://calf.sourceforge.net/plugins/Monosynth", "Velo
local reverb = Lv2.Plugin("http://calf.sourceforge.net/plugins/Reverb")
reverb.control("amount", 0.0)
reverb.connect(synth)
local mainOutput = Audio.StereoOutput("main", "system:playback_1", "system:playback_2")
mainOutput.connect(reverb)
synth => reverb => Audio.StereoOutput("main", true)
/**
## Controller Setup
......@@ -87,27 +84,30 @@ synth.schedule(melody, 1)
## Scheduling Control Changes
Another way to change plugin control values is to schedule the value change on a point in
the transport using the _scheduleControl_ method.
the transport using an _Lv2.ControlChange_ message.
In this case we'll schedule two changes to the reverb amount: it was originally set to zero,
we'll bump it up to 0.3 at the beginning of measure 5 and then up again to 0.7 at measure 9.
*/
reverb.scheduleControl("amount", 0.3, 5)
reverb.scheduleControl("amount", 0.7, 9)
reverb.schedule(Lv2.ControlChange("amount", 0.3), 5)
reverb.schedule(Lv2.ControlChange("amount", 0.7), 9)
/**
Schedule changes like this may work for many situations but will be too abrupt for others. When
Scheduled changes like this may work for many situations but will be too abrupt for others. When
that is the case we can achieve a smoother response by sending smaller control change events
within a short interval.
In this case we will ramp the reverb amount from 0.7 back down to 0 over the course of measure
13 by sending a total of 32 control changes on each 32nd note:
13 by sending a total of 32 control changes on each 32nd note. We can reuse a single
control change message object and just adjust the amount before scheduling:
*/
local change = Lv2.ControlChange("amount", 0.7)
for(local i = 0; i < 32; i++) {
local amount = 0.7 * (1 - i / 32.0)
reverb.scheduleControl("amount", amount, 13 + i / 32.0)
change.value = 0.7 * (1 - i / 32.0)
reverb.schedule(change, 13 + i / 32.0)
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment