"play Current Line & Advance Edit_Step Amount" - Tweaking

Hi, got this to work after a fashion. It plays a bit of the current_line stuff and then stops, then advances by edit_step. My question is this, I’m using vV’s original “do something while” code to do the 0.2 -length delay, how would I go about making this more like how “8” works in ImpulseTracker (i.e., don’t cut the sound but don’t also play anything other than current step).

  
----------------------------------------------------------------------------------------------------------------  
--8. "8" in ImpulseTracker "Plays Current Line" and "Advances by EditStep".  
function PlayCurrentLine()  
local currpos=renoise.song().transport.edit_pos  
local sli=renoise.song().selected_line_index  
local t=renoise.song().transport  
local result=nil  
t:start_at(sli)  
local start_time = os.clock()  
 while (os.clock() - start_time < 0.2) do  
 -- Delay the start after panic. Dont go below 0.2 seconds   
 -- or you might tempt some plugins to crash and take Renoise in the fall!!   
 end  
 t:stop()  
if renoise.song().selected_line_index == renoise.song().selected_pattern.number_of_lines then  
renoise.song().selected_line_index = 1  
else  
  
if renoise.song().selected_pattern.number_of_lines < renoise.song().selected_line_index+renoise.song().transport.edit_step  
then renoise.song().selected_line_index=renoise.song().selected_pattern.number_of_lines  
  
else  
renoise.song().selected_line_index=renoise.song().selected_line_index+renoise.song().transport.edit_step  
end  
end  
end  
  
renoise.tool():add_keybinding {  
 name = "Global:Paketti:Play Current Line & Advance by EditStep",  
 invoke = function() PlayCurrentLine()  
end}  
  
renoise.tool():add_midi_mapping {  
 name = "Global:Paketti:Play Current Line & Advance by EditStep x[Toggle]",  
 invoke = function() PlayCurrentLine()  
end}  
  

I don’t think you’ll be able to do this. In Renoise, when the playhead stops all sounds are cut abruptly.

If you want a hacky way, you probably want to trigger “OFF” in every scope but keep the playhead in loop mode. It’s a really ugly hack and will not do what you are asking. But if you want to try something…

  
local rns = renoise.song()  
for x=1, table.count(rns.tracks) do  
 if rns.tracks[x].type ~= renoise.Track.TRACK_TYPE_MASTER then  
 rns.tracks[x].mute_state = renoise.Track.MUTE_STATE_OFF  
 OneShotIdleNotifier(100, function() rns.tracks[x].mute_state = renoise.Track.MUTE_STATE_ACTIVE end)  
 end  
end  
  

OneShotIdleNotifer class here.

You’d basically have to:

  1. t:start_at(sli)
  2. Run the above code
  3. Set playhed to loop for a few seconds
  4. t:stop()

Maybe I’ll keep it the way it is. The effects keep playing so that’s good enough for me, this is only for previewing notes anyway, i don’t need to hear more than 0.2

I haven’t thoroughly thought this through, but here’s just a quick idea that popped in my head:

Could renoise be tricked into playing the line longer by temporarily setting a ridiculously low tempo? After the line has played, or song is stopped (catch those events with an idle notifier?), the tempo settings could be reversed back to original state? The tempo based effects would be totally destroyed, though. Actually there’s no guarantee that this will work/be suitable on what you’re trying to do. I guess I’m just asking from anyone who is interested enough if this would be theoretically possible.

Ah, plus: there’s the odd chance that something goes wrong and the current tempo settings are lost… risky, risky…

Far too destructive. But if you can figure out a way of storing “current bpm” on a “run once to do one thing, run a second time to do another thing - then run again to do the first thing” so that it’s stored on the first run and then recovered when it is run a second time, instead of just constantly being re-set again by the “second run” of the script, do please let me know :)