Text Label That Displays Note Value

You’re using MIDI In (Local GP Port), which isn’t connected to a MIDI controller.
Replace that with an MIDI In Omni block for instance, and then it works fine.
label_again

Still not working.

I’m afraid I’m at the end of my limited capabilities for troubleshooting.
Perhaps someone else will be able to chime in, such as @pianopaul .
He is a far more experienced and capable GP diagnostician than I am.

Gotcha. No worries. Thanks for the help anyway.

Can you upload a small gig file, so I could check?

Because i thought that this might be useful, i wrote a scriptlet which provides the name of a played note as a parameter which then can easily be learned to a label widget - without the user needing to know anything about scripting.

EDIT: I had to change the widget setting, because the label lost its caption after a moment!

This is how it is used in the wiring view:
2024-03-19 09_25_10-notename as parameter

and how it is assigned to a label:

Best if you save the scriptlet as GP-Favorite, so you can eaysily insert it in the wiring view any time you need it.
scriptlet notename.gpfav (4.2 KB)

Here is a gig file which contains a simple rackspace with it:
notename as parameter.gig (651.4 KB)

And this is the script which works behind the curtains of the scriptet (just as an additional information for the “nosy” ones - no further action needed with this, unless you’d like to change something)

// Declare various kinds of parameters
var
playednote ("note name"): Discrete Parameter asNoteNames 0 .. 127 = NoteNumberToNoteName(C0)

Initialization
    SetDisplayMessage("Show the name of a played note as a parameter for a label widget (c) by schamass")
    SetInfoMessage("Show played note name as parameter")
End


//Called when a NoteOn message is received
On NoteOnEvent(m : NoteMessage) 
    SendNow(m)
    If IsNoteOn(m) Then
        playednote=NoteNumberToNoteName(GetNoteNumber(m))
    end// Display a message at the bottom of the scriptlet window

End

Hope this helps…

3 Likes

@schamass Very nice idea. May I suggest a slight improvement to this

Instead of writing out all those note names

Discrete Parameter "C-2", "C#-2", "D-2", "D#-2",  ........ = "C0"

you can just write

Discrete Parameter asNoteNames 0 .. 127 = NoteNumberToNoteName(C0)
2 Likes

There is currently a parameter in the MIDI In block called NoteFollowValue — when it’s turned on (enable the parameter NoteFollow), NoteFollowValue returns the value of a note as either a floating value (for widget mapping) or as a string between 0 and 127 (for labels)

That parameter was actually intended to allow one to do things like adjust filter cutoff based on the note you’re playing (traditional filter keynote tracking)

We already have the concept of the [value] variable in a lable caption. I’m wondering whether we should add [notename] as a variable and so any string between 0 and 127 would be converted to a note name. That’s a trivial change for the next release.

Oh wow, this is cool. I wasn’t at all aware of the possibility of using functions when definining variables… i thought this could only be done after that…

This would be handy!

Well, that’s just optional — one could also just write

Discrete Parameter asNoteNames 0 .. 127 = "C3"

but the point was that there’s no need to manually write out all those note names as strings. The keyword asNoteNames does that for you.

1 Like

I know… the more i think about it, the more logical it appears.
Actually i wrote a small script which printed out the separate note names to the log window, from where i copied it then… :sweat_smile: :grimacing: :blush:
(BTW: i first had to search the internet to see how a quotation mark can be printed, but finally it worked)

1 Like

If you go up about 5 posts you will see one I uploaded. I’m at work and can’t get to this file right now. :point_up:

In the gig file you uploaded you are using the local GP Port.

yeah, I changed it to a omni midi in and it still didn’t work.

Please upload the gig file

OK - turns out the reason the scripts were not working was because he was triggering notes from buttons connected to the note parameters of a MIDI In block — and those of course happen after GP Script sees the incoming messages so there was nothing to process.

4 Likes

Thanks for clarifying the issue.

1 Like