How can I display a note value in widget caption

Hi Phil,

if you should have bound the two knobs to the min-note and max-note parameters of a midi-in block (which i don’t know, because you didn’t tell!), there would be the very easy option to just use the “[value]” tag as a customized caption of the widget - but this only works if the widget is actually bound to a parameter!

If you have to / want to use GP-Script, there are those two functions that will do the job, when combined:

NoteNumberToNoteName(<i : integer>)
// converts an integer 0-127 to a note name C-2 to G8

and

ParamToMidi(<m : Double>)
// converts a double value 0.0-1.0 to a MIDI-value 0-127

So the single “SetWidgetLabel()” line in this small script will do the job as wanted:

var
knb_maxnote : widget

On WidgetValueChanged (newval : double) from knb_maxnote
    SetWidgetLabel (knb_maxnote, NoteNumberToNoteName (ParamToMidi(newval)))
End
2 Likes