# Virtual controls sending unexpected MIDI from Lua function

**URL:** <https://forum.electra.one/t/virtual-controls-sending-unexpected-midi-from-lua-function/3947>\
**Category:** General discussion\
**Created:** [October 4, 2025, 8:18am UTC](https://forum.electra.one/t/virtual-controls-sending-unexpected-midi-from-lua-function/3947 "2025-10-04T08:18:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Electrolove](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/electrolove/32/2440_2.png) [@Electrolove](https://forum.electra.one/u/Electrolove)\
**Post date:** [October 4, 2025, 8:18am UTC](https://forum.electra.one/t/virtual-controls-sending-unexpected-midi-from-lua-function/3947/1 "2025-10-04T08:18:19Z")

</div>

I’m working on a preset for Strymon BigSky. I have two functions in Lua called **setType** and **sendControlChange**. When I turn the first controller, **setType** is called. There is no code in that function that sends MIDI. The **sendControlChange** function sends MIDI and works as it should. Yet MIDI is sent when I call the **setType** function. All controllers are virtual. What is happening? Is it even possible to get a virtual control to send MIDI on its own?

---

<div class="post-metadata">

**Author:** ![rkram53](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@rkram53](https://forum.electra.one/u/rkram53)\
**Post date:** [October 9, 2025, 3:59pm UTC](https://forum.electra.one/t/virtual-controls-sending-unexpected-midi-from-lua-function/3947/2 "2025-10-09T15:59:21Z")

</div>

One possibility: Duplicate Parameters. Make sure you are not duplicating parameters between controls. This bites me all the time. If you have two controls with the same parameter, one might be firing when you think the other one is being used. This is why I wish there was a simple debug option to show all controls with their parameters to try and find duplicates you set without realizing it. Of course this could be something else.

---

<div class="post-metadata">

**Author:** ![martin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/martin/32/145_2.png) [@martin](https://forum.electra.one/u/martin)\
**Post date:** [October 11, 2025, 6:49am UTC](https://forum.electra.one/t/virtual-controls-sending-unexpected-midi-from-lua-function/3947/3 "2025-10-11T06:49:25Z")

</div>

I talked to @Electrolove about it on the private chat. The messages were sent by the control lua function that called `midi.sendControlChange`. An alternative approach using the `parameterMap.onChange()` was suggested.
