Tool: Write Bpm To Master Track


(Syflom) #1

Every find yourself wanting to make a BPM automation easily? This script does it for you.
It writes the current BPM to the first column in the Master track. Although if you are in a different column in the master track it will write it there.

Set your BPM as usual then right click in the pattern editor and click the new menu option or you can create a key assignment.

2061 WriteBPM_2.7.0.xrnx
2746 WriteBPM_2.8.xrnx


(ungleichklang) #2

:drummer: good idea :)


(vV) #3

I was wondering…

  
function write\_bpm()  
 if renoise.song().transport.bpm \< 256 then -- safety check  
 local column\_index = renoise.song().selected\_effect\_column\_index  
 if renoise.song().selected\_effect\_column\_index \<= 1 then column\_index = 1 end  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[column\_index].number\_string = "F0"  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[column\_index].amount\_value = renoise.song().transport.bpm  
 end  
end  
  

What if the BPM would raise 255, we solve it like this?:

  
function write\_bpm()  
 if renoise.song().transport.bpm \< 256 then -- safety check  
 local column\_index = renoise.song().selected\_effect\_column\_index  
 if renoise.song().selected\_effect\_column\_index \<= 1 then column\_index = 1 end  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[column\_index].number\_string = "F0"  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[column\_index].amount\_value = renoise.song().transport.bpm  
 else  
 renoise.song().transport.lpb = (renoise.song().transport.lpb\*2)  
 renoise.song().transport.bpm = (renoise.song().transport.bpm / 2)  
 write\_bpm()  
 end  
end  
  

(Syflom) #4

That’s a good idea vV. I was thinking about doing something to do with the LPB.


(vV) #5

I think the LPB has to be written into the master track as well using the LPB effect command.
One might want to switch LPB values in specifica patterns if you really want to expand on tempo automation.


(Djeroek) #6

cool lill script! Thanks!


(esaruoho) #7

Hiya, I really think Write BPM should be WriteBPM&LPB. Would really help.
I’ve tried to make the modification myself, but so far have not found a way of enlarging the Master track “effect column”.
I have a feeling I already know it, but am too tired to put it in.

  
  
function write\_bpm()  
 if renoise.song().transport.bpm \< 256 then -- safety check  
 local column\_index = renoise.song().selected\_effect\_column\_index  
 if renoise.song().selected\_effect\_column\_index \<= 1 then column\_index = 3 end  
 column\_index = 3  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[1].number\_string = "F0"  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[1].amount\_value = renoise.song().transport.bpm  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[2].number\_string = "F1"  
 renoise.song().selected\_pattern.tracks[get\_master\_track\_index()].lines[1].effect\_columns[2].amount\_value = renoise.song().transport.lpb  
  
 end  
end  
  

Anyway, column_index does nothing, obviously :)
Seems like the thing is that a selected_track can have a visible_effect_columns=2 set, but getting the script to do that to the master is slightly annoying :)

P.s. ended up modifying my song template to have 2 columns on Master automatically :)


(vV) #8

There is a fairly easy way to detect what type a track is.
There can only be one master, once you know which that one is, expanding the effect columns is peanuts.

-------- Constants

renoise.Track.TRACK_TYPE_SEQUENCER
renoise.Track.TRACK_TYPE_MASTER
renoise.Track.TRACK_TYPE_SEND


(Djeroek) #9

maybe for a future update this tool can be pimped so you can set a beginning and end bpm within a range (pattern / sequence / song?) and the tool interpolates between the set values.

I.o.w sort a like automating bpm rate through pattern commands. Something that would disable the need to make a selection in the pattern editor and interpolate through the advanced editor.


(esaruoho) #10

Detect, yes, but if the effect_column depends on selected_track, then either I learn how to set effect_column amount to 2 on a “TRACK_TYPE_MASTER”, or learn how to set selected_track to “TRACK_TYPE_MASTER”.
Which method would you recommend? :)


(Syflom) #11

if you looked in my code you’d see i have a function to tell you which track is master.

function get\_master\_track\_index()  
 for k,v in ripairs(renoise.song().tracks)  
 do if v.type == renoise.Track.TRACK\_TYPE\_MASTER then return k end   
 end  
end  

so you could then do this line of code somewhere to change it or find out what it is. remember there are always 8 columns but they are just hidden.

show
print(renoise.song().tracks[get_master_track_index()].visible_effect_columns)

change
renoise.song().tracks[get_master_track_index()].visible_effect_columns = 2
renoise.song().tracks[get_master_track_index()].visible_effect_columns = 4

you can’t set a track type as far as i know. if you think about it it makes sense why there would be issues with that.


(vV) #12

I would recommend you to use the Syflom’s iterator here. If the specific function needs to be applied to the master track, then simply write the stuff to the effect column in the master track. No need to have this track “selected” specifically.
You do need to get the selected_line index and the selected pattern index and the master track index is provided to you by Syflom’s routine, from there you can change the effect-column data to your needs.


(Syflom) #13

Have updated the tool for 2.8 due to the changed ZTxx command.


(vV) #14

You might give it a thought for adding support for the Automation parameter for the master track. The master track is the only track that now also supports BPM, LPB and TPL changes through automation.(Automated fractional bpm :D)