diff --git a/examples/gain.lua b/examples/gain.lua index 01aae12..45e8d95 100644 --- a/examples/gain.lua +++ b/examples/gain.lua @@ -6,23 +6,23 @@ config.bufferSize = 32 function process(block) -- Loop through each column - for i=0,5 do + for i=1,6 do -- Get gain knob gain = block.knobs[i] -- Set gain light (red = 1) - block.lights[i][0] = gain + block.lights[i][1] = gain -- Check mute switch if block.switches[i] then -- Mute output gain = 0 -- Enable mute light (red = 1) - block.switchLights[i][0] = 1 + block.switchLights[i][1] = 1 else -- Disable mute light - block.switchLights[i][0] = 0 + block.switchLights[i][1] = 0 end -- Iterate input/output buffer - for j=0,block.bufferSize-1 do + for j=1,block.bufferSize do -- Get input x = block.inputs[i][j] -- Apply gain to input diff --git a/examples/rainbow.lua b/examples/rainbow.lua index 341447f..db8eadd 100644 --- a/examples/rainbow.lua +++ b/examples/rainbow.lua @@ -34,10 +34,10 @@ function process(block) h = (1 - i / 6 + phase) % 1 rgb = hsvToRgb(h, 1, 1) for c=1,3 do - block.lights[i-1][c-1] = rgb[c] - block.switchLights[i-1][c-1] = rgb[c] + block.lights[i][c] = rgb[c] + block.switchLights[i][c] = rgb[c] end - block.outputs[i-1][0] = math.sin(2 * math.pi * h) * 5 + 5 + block.outputs[i][1] = math.sin(2 * math.pi * h) * 5 + 5 end end diff --git a/examples/vco.lua b/examples/vco.lua index e39252b..5a274f6 100644 --- a/examples/vco.lua +++ b/examples/vco.lua @@ -9,10 +9,10 @@ config.bufferSize = 16 phase = 0 function process(block) -- Knob ranges from -5 to 5 octaves - pitch = block.knobs[0] * 10 - 5 + pitch = block.knobs[1] * 10 - 5 -- Input follows 1V/oct standard -- Take the first input's first buffer value - pitch = pitch + block.inputs[0][0] + pitch = pitch + block.inputs[1][1] -- The relationship between 1V/oct pitch and frequency is `freq = 2^pitch`. -- Default frequency is middle C (C4) in Hz. @@ -22,13 +22,13 @@ function process(block) -- Set all samples in output buffer deltaPhase = config.frameDivider * block.sampleTime * freq - for i=0,block.bufferSize-1 do + for i=1,block.bufferSize do -- Accumulate phase phase = phase + deltaPhase -- Wrap phase around range [0, 1] phase = phase % 1 -- Convert phase to sine output - block.outputs[0][i] = math.sin(2 * math.pi * phase) * 5 + block.outputs[1][i] = math.sin(2 * math.pi * phase) * 5 end end \ No newline at end of file