Jump to content


[Help] Quickly return the keymapped phrase from the pressed note???

keymapped phrase pressed note

  • Please log in to reply
No replies to this topic

#1 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1262 posts
  • Gender:Male
  • Location:Spain

Posted 25 February 2018 - 03:21

I'm looking for the fastest way to return the keymapped phrase that sounds pressing a note. What I'm looking for is to return the phrase from the pressed note.




Is there any way to return the object of the phrase, without having to do it through the note_range? I need to access the properties of the phrase quickly, for example the number of its index or its name. I am using this function:

--phrase name keymapped
function phrase_keymapped_name( nte )
  local song = renoise.song()
  local ins = song.selected_instrument
  for i = #ins.phrases, 1, -1 do
    local phr = ins:phrase( i )
    if ( phr.mapping ~= nil ) then
      local note_table = phr.mapping.note_range
      if ( nte >= note_table[1] ) and ( nte <= note_table[2] ) then
        --song.selected_phrase_index = i
        vws["PHT_PHRASE_NAME_1"].text = ("%.02X | %s"):format( i, phr.name ) 

I have tried to use mapping.note_range, but it is excessively slow. What I have done is to verify that the value of the note (nte) is within the range, between the beginning and the end of the .mapping.note_range table. But this method is very slow. I need something instantaneous.


Accessing these numbers is very slow:

  1. note_table[1]     renoise.song().selected_instrument:phrase( i ).mapping.note_range[1] 
  2. note_table[2]     renoise.song().selected_instrument:phrase( i ).mapping.note_range[2]

Is there any way to do it instantaneous? There is no direct way?


Note: The index of the phrase that sounds does not necessarily match with selected_phrase_index

Edited by Raul (ulneiz), 25 February 2018 - 16:51.

:excl: Development of my tool: GT16-Colors


:excl: My API wishlist R3.1 (updated 24 July 2017):



:excl: My Renoise 3.1 wishlist (updated 26 September 2017):