[Solved] Help: check notes with follow the player position in Patt. Ed

I still do not move here!

I have tried to try other codes to register the “playback position” which is my reference at all times (renoise.song().transport.playback_pos.line).

What is my problem? If I use a app_idle_observable (or add_timer), if the BMP and LPB are very fast or slow, print the position of line skipping values or repeat values. Example:

function tnc_check_playback_line( song, stpl )
  song = renoise.song()
  stpl = song.transport.playback_pos.line
  print ( " ________ : ", stpl )
end

function line_timer()
  if vb.views['TNC_CB'].value == true then -- a checkbox to active
    --if not renoise.tool().app_idle_observable:has_notifier(tnc_check_playback_line) then
    -- renoise.tool().app_idle_observable:add_notifier(tnc_check_playback_line)
    if not renoise.tool():has_timer(tnc_check_playback_line) then
      renoise.tool():add_timer( tnc_check_playback_line, 5 )
    end
  end
end

Then, the “tnc_check_playback_line” function is inside a loop of repetition desynchronized (a machine gun).In case of repeating values because add_timer work in 5 or 10 or 20ms and BPM and LPB are reasonably low, how do I return a single value to launch a specific function?

I do not know if this approach would be correct, but I can not build a code that works by following your instructions.I’ve tried a thousand things inside the function that works with add_timer, but I can not get it to work properly. I’ve also tried to stop with remove_timer, and reactivate, but nothing.

Can you provide a code that prints in the terminal the line number each time the playback position is changed?

A minimum reference speed could be: BPM = 400 and LPB = 8 (I do not think I use a higher speed ever, but of course, the ideal is a tool that works well at any speed.)

It seems obvious that what I want to look for is something like this: "_renoise.song().transport.playback_pos.line _observable _ " , but this does not exist in the API.I’ve been searching the forums and I have found that already tried to build several tools but always with problems, and with the request to add the observable for transport.playback_pos.line.If it implies a great impact to the CPU depending on the functions to be executed, add a warning for the programmer to know.From what I see, make visual changes using the viewbuilder does not imply a great impact of the CPU.

Not having theobservable fortransport.playback_pos.line involves using add_timer with imprecision and for me, a very big mess to build such a basic tool, like changing the color of a button when the playback position changes.

Could you help me with a custom code that works?I do not know what to try.

A related topichttps://forum.renoise.com/t/executing-a-script-function-with-timing/34936