Api And Playback Position

Hello guys,

I’ve been getting into lua coding again (I know, I said I would not, just like joining again this board but…) and had the idea of a little thing I could start to code for renoise just to get dirty with the API.

Problem is that when I started to lurk into the documents, I always have to change my plans.

So I guess I’m more than right that there is no way to get the playback position (as, the row number of a pattern being played) being automatically updated LIVE on… well, playback. I intended to do something nasty and stupid and for that, I needed to know the playback position on a pattern so I could do a little equation and finally do something else…

So far, I know I’m going to end by coding a renoise tool that will have to write things on the pattern on a one-shot event (like, a function bound on a button event).

My question is: Will there be more methods in a near future so we can finally have more “live” observable events?

ps: no joke about my english, thank you very much.

For realtime control of playback position, you have something called the “playback_pos”, which is both readable and writable. As you are pointing out, it’s not automatically updated, but your script would be running at GUI rate, so you can still sample the value dozens of times per second (enough for most purposes). To pull this off, you need to use the idle time notifier to make your script receive such a constant stream of notifications

But perhaps you have something specific in mind (like, when playback reach THIS line, do COOL STUFF).
Could you tell just a bit about the idea?

No, you’re more than wrong. So melodramatic, too.

There’s no method(), but theres half a dozen Tools that read/write playback already. (Duplex, Step Sequencer Lauflicht, bunch of other experimental stuff in the forums, …) Kind of hard to miss.

Formula Device has a few variables that may be of use to you:

Then you can do your calculations in it in real time too, just then work out how to read the result (probably have to device by a high number, eg 100,000 is what I had to use to be able to show Sample Rate, as the output has to lie between 0-1.)

Here’s a script that can help you get started.


local my_pos = nil  
local my_vb = nil  
local current_dialog = nil  
--[[My code]]--  
function init()  
 my_vb = renoise.ViewBuilder()  
 local dialog_title = "Current Pos"  
 local dialog_content = my_vb:text { text = "0", id = "baguette" }  
 current_dialog = renoise.app():show_custom_dialog(dialog_title, dialog_content)  
function update_position()  
 if (not current_dialog or not current_dialog.visible) then  
 my_pos = renoise.song().transport.playback_pos  
 my_vb.views.baguette.text = my_pos.sequence .. ", " .. my_pos.line  
-- A method, just for you.  
function getBaguette()  
 return my_pos.sequence .. ", " .. my_pos.line  
function run()  
 if not (renoise.tool().app_idle_observable:has_notifier(update_position)) then  
function stop()  
 if (renoise.tool().app_idle_observable:has_notifier(update_position)) then  
 renoise.app():show_status("Fini les baguettes! Last known position was: " .. getBaguette())  
 my_vb = nil  
renoise.tool():add_menu_entry {  
 name = "Main Menu:Tools:Baguette Power!",  
 invoke = init  

Man up, dad.

Do not point the fact I’ve been out of the loops for a year or so, thank you.
Also, do not forget it’s only yesterday I started to venture again on this topic… thank you again.

But thank you guys for pointing “app_idle_observable” as it’s definitely what I needed. You must admit it’s not really something a newcomer to the API could/would/should guess.

I admit it it you admit your first post is totally bitchy and pompous? ;)

Man that’s just stupid, I didn’t want to sound bitchy and pompous so please, stop the hate for one minute… I was looking for advices on something I already tried to start by my own.

I wouldn’t have said it’s that bad, especially for a non-native speaker.

If “So I guess I’m more than right” was instead phrased “Am I right in thinking” then I wouldn’t see anything wrong with the rest of it at all. A few words said overly self-assuredly does not an entirely bitchy and pompous post make.

Alright, sorry.

I do read the Twitter though… I took the post in context of a bigger conversation. I am probably wrong though. I admit it.

Even on the twitter, that was no bitchy at all man.
It’s like when I posted renoise should definitely have a new instrument concept and I got mention from people I never heard about asking, politely, to learn using renoise… or guys I knew who asked me what I had in mind.

It’s like I can’t post a single line about renoise without you believing it’s a complete troll or bitching.
Don’t you forget I’m using renoise since 1.2 and reregistered for 2.6 and actually composed 95% of my latest album all inside renoise? Why would I overly bitch about it and you guys… ok, I’ve ran upside down for a year or so but come on, don’t read what I didn’t say please, it hurts me more than you think.

I apologize. I was wrong. Clearly not my best foot forward. I wish you good luck on your script.

Have to admit I (quite happily) have avoided the Twitter bug so far.

Glad to see it seems you two have shaken hands and made up :)

Conner, really, It’s cool, really, I don’t want that to end in a “forced apologies beautiful moment”.
It’s only “me” you know. Just saying “please, read me well, I don’t hate”

ahh the drama. ;)

show the code you started and you’ll get more help

p.s. much love to the renoise api community and to kaneel

I don’t think that a great idea is born from a technical understand of how the Renoise API works, but from insight into musical process.
That’s the raison d’etre for the scripting Q&A forum

I smell Kaneel here…

Yay, it works. Thanks guys.

by the way, thank you again, I’ve been able to start working on a little tool.
I may be back later with some questions about the GUI API (viewbuilder), because it’s a tad blurry right now.