Writing to a specific line index (Selected Line Index) in the Phrase?

Hi, I’ve been battling with this:

How to use the LUA API to write a Note-Off to a current phrase line (where the cursor currently is at) renoise.song().instruments[renoise.song().selected_instrument_index].phrases[renoise.song().selected_phrase_index].lines[renoise.song().selected_line_index].note_columns[renoise.song().selected_note_column_index].note_string=“OFF” but unfortunately this will write the “OFF” to where the cursor is in the pattern editor, not in the phrase editor.

A couple of tricks before starting:

  1. Avoid making redundant calls, using a “local”:
    local song = renoise.song
  2. Learn to use code shortcuts in the API to access more directly:
    song().selected_phrase:line(index)

The current API (API5 or API6) does not give access to the index of the line inside the phrase.
This is the index of the line within the pattern, not within the phrase: renoise.song().selected_line_index

You can ask @taktik to add something like this (or similar):
renoise.song().phrase_selected_line_index (this does not exist!)

The current API (API5 or API6) does not give access to the index of the note column inside the phrase.
This is the index of the note column within the pattern, not within the phrase: renoise.song().selected_note_column_index

You can ask @taktik to add something like this (or similar):
renoise.song().phrase_selected_note_column_index (this does not exist!)

InstrumentPhrase:

class: InstrumentPhrase
 properties:
    autoseek
    autoseek_observable
    base_note
    base_note_observable
    delay_column_visible
    delay_column_visible_observable
    instrument_column_visible
    instrument_column_visible_observable
    is_empty
    is_empty_observable
    key_tracking
    key_tracking_observable
    lines
    loop_end
    loop_end_observable
    loop_start
    loop_start_observable
    looping
    looping_observable
    lpb
    lpb_observable
    mapping
    name
    name_observable
    number_of_lines
    number_of_lines_observable
    panning_column_visible
    panning_column_visible_observable
    sample_effects_column_visible
    sample_effects_column_visible_observable
    shuffle
    shuffle_observable
    visible_effect_columns
    visible_effect_columns_observable
    visible_note_columns
    visible_note_columns_observable
    volume_column_visible
    volume_column_visible_observable
 methods:
    __STRICT
    __eq
    add_line_edited_notifier
    add_line_notifier
    clear
    column_is_muted
    column_is_muted_observable
    column_name
    column_name_observable
    copy_from
    has_line_edited_notifier
    has_line_notifier
    line
    lines_in_range
    remove_line_edited_notifier
    remove_line_notifier
    set_column_is_muted
    set_column_name
    swap_effect_columns_at
    swap_note_columns_at

Song:

class: Song
 properties:
    artist
    artist_observable
    comments
    comments_assignment_observable
    comments_observable
    file_name
    instruments
    instruments_observable
    name
    name_observable
    pattern_iterator
    patterns
    patterns_observable
    rendering
    rendering_progress
    selected_automation_device
    selected_automation_device_observable
    selected_automation_parameter
    selected_automation_parameter_observable
    selected_device
    selected_device_index
    selected_device_observable
    selected_effect_column
    selected_effect_column_index
    selected_instrument
    selected_instrument_index
    selected_instrument_index_observable
    selected_instrument_observable
    selected_line
    selected_line_index
    selected_note_column
    selected_note_column_index
    selected_parameter
    selected_parameter_observable
    selected_pattern
    selected_pattern_index
    selected_pattern_index_observable
    selected_pattern_observable
    selected_pattern_track
    selected_pattern_track_observable
    selected_phrase
    selected_phrase_index
    selected_phrase_observable
    selected_sample
    selected_sample_device
    selected_sample_device_chain
    selected_sample_device_chain_index
    selected_sample_device_chain_observable
    selected_sample_device_index
    selected_sample_device_observable
    selected_sample_index
    selected_sample_modulation_set
    selected_sample_modulation_set_index
    selected_sample_modulation_set_observable
    selected_sample_observable
    selected_sequence_index
    selected_sequence_index_observable
    selected_sub_column_type
    selected_track
    selected_track_device
    selected_track_device_index
    selected_track_device_observable
    selected_track_index
    selected_track_index_observable
    selected_track_observable
    selection_in_pattern
    selection_in_phrase
    send_track_count
    sequencer
    sequencer_track_count
    show_comments_after_loading
    show_comments_after_loading_observable
    tracks
    tracks_observable
    transport
 methods:
    __STRICT
    add_track_to_group
    can_redo
    can_undo
    cancel_rendering
    capture_instrument_from_pattern
    capture_nearest_instrument_from_pattern
    clear_midi_mappings
    delete_group_at
    delete_instrument_at
    delete_track_at
    describe_undo
    insert_group_at
    insert_instrument_at
    insert_track_at
    instrument
    load_midi_mappings
    pattern
    redo
    remove_track_from_group
    render
    save_midi_mappings
    select_next_track
    select_previous_track
    swap_instruments_at
    swap_tracks_at
    track
    undo

Research yourself. I am not 100% sure. It is strange that the API does not have access to the index of the line or the index of the note column within the current phrase. These are two indexes necessary to be able to edit the current phrase from the API.

Regardless of all this, do not confuse pattern data with phrase data.

yeah… i feel like it’d be a bother for @taktik to , yet again , get asked for lua api feature additions

But in this case, it makes perfect sense to add these two indexes. It is not an “extra thing”, but rather a “missing thing”, to complete the API package.

Can you manipulate the visibility of the columns but not know the index (the position of the cursor inside the phrase)? What? There are less important things that are implemented. But the index of the note column and the index of the line are essential to know the position.

It is a matter of reasoning. In addition, they should be _observable.

1 Like

@esaruoho I think the next issue is directly related. It is necessary for Renoise to keep the focus on the selected editor when the instrument editor window is separated.

In this case, the problem is that the pattern editor always “has priority” (I think it is badly programmed). In fact, the following occurs (R3.2.1):

  1. Separate the instrument editor window.
  2. Be sure to focus the phrase editor.
  3. Go to the terminal and print: print(renoise.app().window.active_middle_frame). This query will return the value 1 (pattern editor), when it should be 3 (phrase editor), since it was the last editor focused.

In addition, OSC does not have specific trigger_on and trigger_off messages for phrases.
So I think there are three things missing to work with phrases properly:

  1. Add selected_phrase.selected_line_index and selected_phrase.selected_line_index_observable for current phrase.
  2. Inside the OSC, add trigger_on and trigger_off for phrases (sound and edit).
  3. Fix the renoise.app().window.active_middle_frame so that the programmer has control of the focused frame at all times (pattern editor or phrase editor), even if the instrument editor window is separated.
  • Also, the phrase editor has another problem: it doesn’t have the option of follow the player’s position for the current phrase.
  • Also, the API also does not give access to the play and stop of the current phrase.

At least 5 essential features are missing and that @taktik should add/fix if he wants to give us access.

1 Like

well, i’d love to know how many hundreds or thousands of euros one would need to pay @taktik to be able to get these API features in. am being pretty serious.

Probably the lack of time. Time is very undervalued and is more valuable than anything. Integrating these things involves two things:

  1. Use time.
  2. Do not use that time on something else.

There are many requests in the forums. I guess there is a list of priorities. Maybe the world of phrases is not in the top positions (it is necessary to attend to other things that are more necessary first).
I have seen requests for things that already exist. I have seen requests for things that can be done with tools. There are also this kind of requests, which complete the API gaps.

The other day I requested that access to the cursor position be added to the sample buffer. It does not exist in the API. They are small things that would facilitate many things. If you are busy with something else, all this can be a mountain. Or put another way, the benefit of attending to all these requests is almost nil. Thanks to this, no more Renoise licenses will be sold.

I don’t usually send emails to Renoise support. I did it once and dBlue answered me and he is in the forums.

But yes. For something to happen, I suppose you would have to convince Taktik widely directly. It seems that lately it is more accessible in the forums.

1 Like