Little scripts you can run from the terminal/editor

Oi, the tool forum has been tumbleweed for a while now. What’s up? :)/> Scripters run out of ideas or maybe the api has been utilized now for what it has to offer?

Maybe most keep their tools for them self, no feature requests of maintenance worries ;)/>… I wonder though if some of you use little helpful scripts, not worthy of wrapping in a tool, but executable from the Scripting Terminal & Editor every now & than?

Stuff like this:

Please share!

Nice idea Djeroek. Here’s a very short script that renders out the song and then loads it in the currently selected sample. I usually solo tracks to have it basically render that full track to sample.

function callback(tempfile)   
 renoise.song().selected_sample.sample_buffer:load_from(tempfile)  
 os.remove(tempfile)  
end  
  
function main(options)  
 local tempfile = os.tmpname('wav')  
 renoise.song():render(options, tempfile, function() callback(tempfile) end)  
end  
  
local options = {sample_rate=44100,bit_depth=24,interpolation='sinc'}  
main(options)  

Personally, I’m waiting to see what the next version brings, I have some ideas around XRNI instruments and realtime midi note processing but if these are overhauled in the next release (which I really hope they are) then it may become a lot easier to implement them, or I might find myself having to rewrite things.

Anyway, seeing as you asked…

Here’s a script that lets you do micro tuning in instruments. The first line has an array of 12 variables where you can set the fine tuning (-127 to +127) of each note starting at C. This is then repeated across the keyzone range.

  
-- SET YOUR FINE TUNINGS HERE - RANGE FOR EACH VALUE = -127 to +127  
local tunings = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }   
  
  
-- CODE  
local ins = renoise.song().selected_instrument_index  
local notes = { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }  
local note_layer = renoise.Instrument.LAYER_NOTE_ON  
local base_note = 48   
local min_note = 0   
local max_note = 119   
local current_note = 1   
local current_sample = 2   
  
local mappings = #renoise.song().instruments[ins].sample_mappings[note_layer]   
for n = mappings, 1, -1 do  
 renoise.song().instruments[ins]:delete_sample_mapping_at( note_layer, n )  
end   
  
local samples = #renoise.song().instruments[ins].samples  
for n = samples, 2, -1 do  
 renoise.song().instruments[ins]:delete_sample_at(n)  
end   
  
for n = current_sample, (current_sample + 11), 1 do   
 renoise.song().instruments[ins]:insert_sample_at(n)   
 renoise.song().instruments[ins].samples[n]:copy_from(renoise.song().instruments[ins].samples[1])   
 renoise.song().instruments[ins].samples[n].name = notes[current_note]   
 renoise.song().instruments[ins].samples[n].fine_tune = tunings[current_note]   
 for note_index = min_note, max_note, 12 do  
 renoise.song().instruments[ins]:insert_sample_mapping( note_layer, current_sample, base_note, {(note_index+current_note-1), (note_index+current_note-1)} )  
 end  
 current_note = current_note + 1  
 current_sample = current_sample + 1   
end  
  
  

I was going to mash this up with DBlue’s SCL loading script but with the current version I would need to duplicate the sample 120 times to make it work properly! So like I said, ima gonna wait…

understandable!

Very cool! Will try this asap :)

About the 120x duplication, you can add slice markers on top of each other to create multiple aliases of the same sound, triggered at the same point in time. Maybe this can act as a workaround to the redundancy?

You need to do this per layer / sample? In that regard you are indeed limited (as only 255 samples are possible per instrument)
Djeroek’s slice marker trick could work (and save memory).

I did try that but I think you have to manually change the ‘play to end’ setting in the instrument editor for it to work. You can’t change it via scripting so I thought whatever I made wasn’t going to be the most elegant of solutions.
Also SCL tuning is done in 100ths of a semitone and Renoise uses 127 steps per semitone so each Renoise tuning step is going to correspond to 0.79 cents, therefore any SCL conversion is never going to be accurate.

Still, if you can live with all that and running it from the terminal (GUI’s take ages to code!), I don’t mind having a go at adapting the script and trying to make it work with DBlue’s code, I do have code for the slice marker approach so it will just come down to how easy it is to mash the two together.

It doesn’t have to be done that way, it just saves you having to change the slice settings manually… Ok, challenge accepted, i’ll give it a try

Personally, I’ve ran out of ideas / have no further requirements at this time.

Works great, thanks! :yeah:

any progress?

Soon, soon… :)