parameterMap.modulate emits 127 when the base is lowered toward 0 under a downward modulation

Firmware: 4.1.4 Hardware: Electra One mk2

Summary

When a parameter is being held at 0 by an active downward (negative) modulation, moving that parameter’s base value toward 0 makes parameterMap.modulate() emit 127 instead of keeping the output clamped at 0. The output should stay pinned to the 0 floor; instead it jumps to the maximum. The base must be actively moving toward 0 — a static low base does not trigger it.

How I found it

I started from the official modulation tutorial (sawtooth via parameterMap.modulate) and modified it only enough to reach this edge case — base moving toward 0 while the modulation swings downward. The bug reproduces from that near-stock example.

Reproduction

Preset: one CC7 control on device 1 (PT_CC7, param 1), plus two virtual params (PT_VIRTUAL 1 = depth, PT_VIRTUAL 2 = a readout). Lua:

local startTime = controller.uptime()
local period    = 8000    -- sawtooth period (ms)
local amplitude = 1.0

local modulated = parameterMap.map(1, PT_CC7, 1)
local depth     = parameterMap.map(1, PT_VIRTUAL, 1)
local modulator = parameterMap.map(1, PT_VIRTUAL, 2)

function preset.onLoad()
    timer.setPeriod(10)
    timer.enable()
end

function timer.onTick()
    local value = getModulatorOutput()          -- bipolar, -1.0 .. 1.0
    parameterMap.modulate(1, PT_CC7, 1, value, depth())
    modulator(((value * 100 + 100) // 1))
end

function getModulatorOutput()
    local elapsed = controller.uptime() - startTime
    local phase   = 1 - (elapsed % period) / period
    return (2 * phase - 1) * amplitude
end

function formatPercentage(valueObject, value)
    return string.format("%d%%", value)
end

Steps:

  1. Set depth high, so the downward half of the sawtooth would push the value below 0.
  2. While the modulation is in its downward phase (output sitting at the 0 floor), turn the CC7 control’s base value down toward 0 — do this while it’s moving, not by leaving it parked at a low value.
  3. Watch device 1’s MIDI output on a monitor.

Expected

While the downward modulation holds the value at the 0 minimum, the output stays clamped at 0 as the base is lowered — the same way the top end clamps at 127.

Actual

As the base is moved toward 0 under the active downward modulation, the output jumps to 127 (a 0↔127 flutter) rather than staying at 0. The region where the value should be pinned to the 0 floor instead outputs the maximum.

Best Regards
Michael