How to use NoteMapper_CreateScale()?

I am playing with some scriplets working with scales. I was going to create them programmatically but found the GPScript function NoteMapper_CreateScale(nm: NoteMapper, rootNote: Integer, scale: Integer array). Is there any documentation or examples of how to access and use the generated scale?

Does anyone have any ideas on this?

I just noticed that nobody responded to this — I actually just did a trivial case of this where I wanted to
a) change an Eb3 to E3 and
b) mute F3

Here is an example scriptlet that does that


var
   Map1 : NoteMapper
   

Initialization
   NoteMapper_MapNotes(Map1, [D#3, F3], [E3, -1])
End   
   
On NoteEvent(m : NoteMessage)
    
   var n : integer = m.GetNoteNumber()
   notes : Integer Array = NoteMapper_GetMappedNotes(Map1, n)
   
   if (Size(notes) > 0)
      then SendNow(m.WithNoteNumber(notes[0]))  // and send it out
   end     
          
End





1 Like

But what about NoteMapper_CreateScale(nm: NoteMapper, rootNote: Integer, scale: Integer array)… how is that used? Does it create an array of notes that I can access using NoteMapper_GetMappedNotes(Map1, n)?

CreateScale is much simpler – you define offsets for a single octave and then it works across the entire keyboard range.

E.g.

NoteMapper_CreateScale(nm, C3, [0,0,0,1,0,0,0,0,0,0,0,0])

When you get the notes, that will bump ever Eb to E

1 Like

Aaah, I see! Thank you!