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.