[Idea] Set Row Count Between Events As Step Length Shortcut

Have to admit took me a little reading to understand quite what you meant, something about the phrasing seems a little in reverse (IE like you want to set the gap to edit step rather than the edit step to the gap.)

I guess this would involve the Iterators, which is something I haven’t looked at yet, but I would think making it so it at least does it if you are actually on the first note should be easy enough and to extend that to between notes probably wouldn’t be all that hard either…

Should it only work in the Note Column you are in? Or all columns in the track?

Should it completely ignore Delay values? Or round them up/down depending on their value?

So, like a tape measure between two notes?

Some missing specs:

Tracks, or columns?
Any note? Or just two notes from the same instrument?
Does a NOTE-OFF count as a note?
You say event, you don’t care if it’s a note? It could be a note and a panning command?

Sorry about the unclarity :)

yes something like that. I’m more interested in it automatically setting the step length though, then just knowing the measure/amount of rows.

All these kind of options, different choices would be cool to have eventually in some kind of gui, to toggle between, but for a first version I’d say have the script work on the column the cursor resides in a track and on 2 notes from the same instrument. So discard other instruments in between. If that is to hard to distinguish in lua, simply forget about it and take any 2 note events in the same column :)

At the moment I’m interested in the space between notes, maybe note-off’s can be optional later, same for other type of events as filters. My main motive is note events programming.

(Also about your question on the delay column kazakore, for me this can be neglected).

So you desire some kind of motive scanner and allow to set the step according to what is appearing in the current notecolumn/selection

Don’t over complicate things with big words like scanning please :wink:

It should run the envisioned script when pressing a keybind and set the step length (= edit step :badteeth: ) according to the amount of rows between 2 events.

I posted a similar idea, however my explanation may have left some a bit lost or confused.

After reading this thread, the words, “dynamic step editing” comes to mind.

What do you mean with dynamic though, I’m not talking realtime attenuation of the edit step value according to the cursor placement in the editor or something!

Dynamic simply as in opposite to static as it currently is. Mostly in agreement to your statement “…automatically sets the amount of rows between 2 events as step length when running it.”

Perhaps I’m using the wrong word.

Jonas I believe only wants in run when you hit the keyboard shortcut. Dynamically implies to me that it will automatically update as you change position. This could cause some problems.

So it is static, you hit the button, it changes and is static again until you call the routine again.

If you have the cursor between the last note in a column and the end of a pattern what value would be returned then? No change maybe? With a message?

Got it, I used the wrong term then to describe it. I didn’t mean real time auto update.

Would it be possible, in the same pattern, to read the last note in a column to the first note in the column ?

I tried a bit, but I’m stumped. I have no way to query the column position of the cursor in the API?

The first part of the code is easy:

  
  
 local rns = renoise.song()  
  
 -- Set variables: iter, insrtument_number  
 local iter = rns.pattern_iterator:lines_in_pattern_track(rns.selected_pattern_index, rns.selected_track_index)  
 local tmp = renoise.song().selected_instrument_index  
 renoise.song():capture_nearest_instrument_from_pattern()  
 local instrument_number = renoise.song().selected_instrument_index  
 renoise.song().selected_instrument_index = tmp  
  
  

This uses capture_nearest_instrument_from_pattern() to find the instrument. There’s a caveat is that it looks forward, not backwards. Don’t think this will affect the outcome of the script too much, but it would be nice to have a backwards option in the API.

Next I thought I would use:

  
renoise.song().selected_note_column  
  

Which returns a renoise.NoteColumn object. But this object doens’t let me query the column number? E.g.

  
oprint(renoise.song().selected_note_column)  
class: NoteColumn  
 properties:  
 delay_string  
 delay_value  
 instrument_string  
 instrument_value  
 is_empty  
 is_selected  
 note_string  
 note_value  
 panning_string  
 panning_value  
 volume_string  
 volume_value  
 methods:  
 __STRICT  
 __eq  
 __tostring  
 clear  
 copy_from  
  

The only other option I see is:

  
renoise.song().patterns[].tracks[].lines[].note_columns[].is_selected  
  

But this works on selection, not cursor, which would make the script stupid.

In order to write this script. The API needs a new feature. We need: Query cursor position. It should return { pattern, track, column }. The column is tricky because the cursor could be in the Effects, which is a renoise.EffectColumn() object. Someone smarter than me will have to chime in.

Or did I miss something in the API that would return the current column position of the cursor?

I may be wrong but the above is how I would understand a dynamic process. Although guess it is dynamic in a way as the result of running it does depend on the changing variables surrounding it. A discretely sampled dynamic process?

Shouldn’t be a problem as far as I can see. Don’t think I’ll have a chance to think about trying to do something like this myself for a while though and there are people out there who could program it in a tenth of the time I could with the eyes closed and arms tied behind their back ;)

Scan a column for note events for a particular instrument (do we even want to go to note value, in case you are using a drum kit instrument?)
When one is found that matches the criterion add the line number to a table. Do the whole pattern.
Find the first entry in the table where the value is higher than current edit position.
Minus entry in table before it to get new Edit Step.
If there is no entry higher than current position use pattern length minus last entry plus first entry.

If I’m not too busy at work tomorrow maybe I’ll try and take a look at it but shit has been hitting the proverbial fan recently!

Damn! I had assumed this would be part of the Edit Position, but that seems only to refer to which pattern is the only being edited out of the sequence. Maybe it could be incorporated into it though, so that it comtains the pattern, track, column result you mention?

EDIT: Think I found it!

It returns a note column object, but no way (I can see) to get the position of said note column?

Nice to see this idea is getting some play time :) , maybe just forget about column particulars of the track the cursor is in and always take into account the first column?

Doh! Sorry I posted that 4 minutes after I was meant to have left work so didn’t double check against what you had written correctly or do any testing.

Still think cursor position in entirety makes most sense as part of EditPosition.

Except it does work and I did copy and paste the correct bit. Look at the Index!

renoise.song().selected_note_column_index
-> [number or nil (when an effect column is selected)]

Just got it to return different values depending on which note column I was in here anyway ;)

Oh, you are right!

I was using selected_note_column instead of selected_note_column_index

Doh!

It’s cool, I’m learning more and more. Not really used oprint until just not looking at various objects :)

Not sure why indexes are not generally part of the objects and rather always separate but it seems to follow that pattern throughout the API so who am I to comment.

Nor am I clear how it gets the format to print the likes of renoise.song().selected_note_column, where you only get some of the listed properties displayed on a normal prints but obviously you can access any of the others by typing renoise.song().selected_note_column.blah_blah.

Really am going off the topic of the thread not though so I apologise Jonas!

as long as there eventually are results, I wont hold it against you B) :wink: