Jump to content


Photo

cannot set note_range


  • Please log in to reply
3 replies to this topic

#1 catchphrase

catchphrase

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 139 posts
  • Gender:Male
  • Location:Germany

Posted 18 December 2016 - 17:15

I enter a minimum note of 19 (= G-1 ).

   local ci = renoise.song().selected_instrument 

   for i = 1, #ci.samples do
      print( i )
      ci.sample_mappings[renoise.Instrument.LAYER_NOTE_ON][i].note_range[1]=0
      rprint( ci.sample_mappings[renoise.Instrument.LAYER_NOTE_ON][i].note_range[1] )
    end

which prints

1
19
2
19
3
19
4
19
5
19

for five samples. But I expected it to set all the note ranges minimum value to 0. I already checked the read_only variable, but it is always set to false. Am I missing something?

 

Side question, what is the syntax to set the full table to new values? Something like note_range = [0,119] ?

 

Thanks for your thoughts!

 

 


Edited by catchphrase, 18 December 2016 - 23:41.

Tools:
Moveit

#2 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 384 posts
  • Gender:Male

Posted 18 December 2016 - 17:47

I'm not sure catchphrase but you could try setting the two note_range low/high values table in one go, like:

 local ci = renoise.song().selected_instrument 

   for i = 1, #ci.samples do
      print( i )
      ci.sample_mappings[renoise.Instrument.LAYER_NOTE_ON][i].note_range = {0,119}
      rprint( ci.sample_mappings[renoise.Instrument.LAYER_NOTE_ON][i].note_range[1] )
    end

  • catchphrase likes this

#3 catchphrase

catchphrase

    Super Advanced Member

  • Normal Members
  • PipPipPipPip
  • 139 posts
  • Gender:Male
  • Location:Germany

Posted 18 December 2016 - 17:55

Yes, thanks a lot, exactly, what I wanted to do, set all table values at once. But I did not know the correct syntax, just reactivating/learning some long forgotten LUA.

 

On the other hand, is it possible to set just one of the values? (just curious).


Tools:
Moveit

#4 4Tey

4Tey

    Chief Above Chief Member

  • Normal Members
  • PipPipPipPipPipPip
  • 384 posts
  • Gender:Male

Posted 18 December 2016 - 18:03

Good question catchphrase, but I'm not myself a lua expert and to be honest with you I would've thought you could of set the values in the table individually, but apparently RenoiseLua doesn't respond [Edit:  Ah, looks as though note_range is wired as a list so it expects two values in a table.]  Danoise would probably be better to answer this though.  But at least you can read and set the values...luckily :)


Edited by 4Tey, 18 December 2016 - 18:10.