# Sustained notes

**URL:** <https://forum.electra.one/t/sustained-notes/1720>\
**Category:** General discussion\
**Created:** [October 19, 2022, 6:59pm UTC](https://forum.electra.one/t/sustained-notes/1720 "2022-10-19T18:59:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [October 19, 2022, 6:59pm UTC](https://forum.electra.one/t/sustained-notes/1720/1 "2022-10-19T18:59:37Z")

</div>

I’m working on an interactive controller for the Gibson EDP. One nice function is you can trigger functionality using Note On messages.

I’m trying to use a pad, type = note, and set it to toggle so I press it once, it should send a note on and then sustain until I press it again. What ends up happening though is that after 0.48 seconds (lol - I see the record time on the EDP) the sustain stops.

So is the only way to do an arbitrary sustain time is via a virtual control that sends a MIDI note ON then a MIDI note off when pressed again?

Also - if it type VIRTUAL and is set to TOGGLE and you set the ON value to something (say 40) and the OFF value to 0, and the default state to OFF, the very first time you press the note button, it sends a value of 0 (wrong) then the second press is also a 0 (correct) then finally the third press sends the 40 (correct) as you would expect.

I think that’s not correct (this is OS 2.2) - the first press should send the ON value specified.

---

<div class="post-metadata">

**Author:** ![NewIgnis](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.electra.one/newignis/32/767_2.png) [@NewIgnis](https://forum.electra.one/u/NewIgnis)\
**Post date:** [October 19, 2022, 8:34pm UTC](https://forum.electra.one/t/sustained-notes/1720/2 "2022-10-19T20:34:23Z")

</div>

I just tested this, @oldgearguy . In my case the note remains on, as long as I press. In other words, as hoped and expected.

See settings below

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/5/5ecfa79ca265f3a0b670710e7ff1d0a8601f0808.png)

Then I tested a virtual pad with on On value of 40 and an Off value of 5 where the function sendNote is to trigger an F#:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/electraone/original/2X/b/b449990cc5fe3477521cfc5d86636049a335771b.png)  
The first transmission immediately sent out the NoteOn message, but with a value of 1, followed by the Off message with a value of 0. So not with 40 , resp. 5.

Below the lua used:

> deviceId = 1  
> device= devices.get(deviceId)  
> devPort = device:getPort ()  
> channel = device:getChannel ()
> 
> function sendNote(ValueObject, value)  
> midi.sendNoteOn (devPort , channel, 66, value)  
> end

What lua did you use?

[https://app.electra.one/preset/UrHVPfXLEQKsBqQVMDEF/edit](https://app.electra.one/preset/UrHVPfXLEQKsBqQVMDEF/edit)

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [October 19, 2022, 10:12pm UTC](https://forum.electra.one/t/sustained-notes/1720/3 "2022-10-19T22:12:38Z")

</div>

Momentary is ok, I wanted toggle to work so I can free up my hands for something else.  
Below is for a Virtual pad, set to toggle, on value is 38, off value is 0, default state is off. Parameter number is 38

I wasn’t trying to be final/definitive/fancy at first, just testing note on/off, so lots of things hardcoded.  
Running OS 2.2 on a 2.4 hw platform

LUA is:

```auto
function recToggle(ValueObject, Value)

   local message = ValueObject:getMessage()
   local keyNum = message:getValue ()
   local paramNum = message:getParameterNumber ()
   print(string.format("param number = %d", paramNum))
   print(string.format("key value = %d", keyNum))

   if (keyNum == 0) then
      midi.sendNoteOn(PORT_1, 1, 38, 127)
   elseif (keyNum == 38) then
      midi.sendNoteOff(PORT_1, 1, 38, 0)
   end
end

```

---

<div class="post-metadata">

**Author:** ![oldgearguy](https://avatars.discourse-cdn.com/v4/letter/o/f4b2a3/32.png) [@oldgearguy](https://forum.electra.one/u/oldgearguy)\
**Post date:** [October 20, 2022, 9:47am UTC](https://forum.electra.one/t/sustained-notes/1720/4 "2022-10-20T09:47:02Z")

</div>

Please hold off any more research on this point for a day or so.  
Even though there may be issues trying to combine toggle mode with note commands, I may be misinterpreting the Gibson EDP MIDI spec and how it responds to note commands.

Let me do some more testing to see if this may be a non-issue for what I’m trying to implement.

---

<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 20, 2022, 10:03am UTC](https://forum.electra.one/t/sustained-notes/1720/5 "2022-10-20T10:03:09Z")

</div>

toggle mode works for notes on beta as of 3.0-a.20.
