Pitch / Frequency Indicator For Loop Marker Region

Ello,

I was working on a track tonight that had a snare sample with a loop in it, such a short loop the resulting snare sound transformed in a tone at the end… and I was trying to adjust the loop markers in such a way the tone would match up in key with the rest of the song.

Now this was a trial and error affair and eventually I’ve got it just about right, but I was thinking this could be more easier if there would be a frequency indicator in the sample editor for the space between loop markers (maybe something for the ‘loop-fine editor’?).

Does this make sense?

yes it does, thank you

Why not to calculate yourself and if able, write a tool.

formula: 1 / ((loop end - loop start sample) / samplerate) = loop Hz

Yes it is weird Renoise does not show loop length in any numeral form. But, you can measure it by marking the whole loop range. A bit more work, but the result is the same.

removed

Yes it does, and yes, it would be a no-brainer for something as advanced as Renoise to have it natively.

Well, I’m not able to calculate it by myself, but thanks to your formula, I am able to extract the required information out to get this:

function showsamplehz()  
local selsamp=renoise.song().selected_sample  
local sb=selsamp.sample_buffer  
local a=renoise.app()  
local currentsamplerate=sb.sample_rate  
local loopend=selsamp.loop_end  
local loopstart=selsamp.loop_start  
local looplength=nil  
local loophz=nil  
  
looplength=selsamp.loop_end-selsamp.loop_start  
loophz=1/(looplength/currentsamplerate)  
  
a:show_status("[Samplerate " .. currentsamplerate .. " | Selected Sample Loop-length " .. looplength .. " | Loop is in: " .. loophz .. " Hz]")  
end  
  
renoise.tool():add_menu_entry {  
name = "Sample Editor Ruler:Loop in Hz",  
invoke = function() showsamplehz()   
end}  
  

The cooler boyz could obviously improve on this with some sort of an observable, maybe even so that it would constantly keep a tiny button available that reads the current Hz of the current sample.
I might do a tiny 4-6 letter button gui for this, if you like, Jonas (it would just be a static button you can add next to the Pattern Editor lower row… and u could click it. Didn’t bother making a keyshortcut for it yet.

Thanks Esa! Took me a while before I found out the tool outputs the frequency in the status row :) , getting the morning snot out of my eyes…but yeah already helpful, though I was thinking of a more dynamic feature. So the the amount of Hz gets updated dynamically when adjusting the loop markers.

It would be uber-great if besides frequency, you could have the respective key, cents and octave too, which I bet also relate to some kind of formula?

If all of this could be collected in a tool that be very useful, but maybe the devs can implement such a thing natively eventually!

Thanks again Esa for your scripting work!

1 / Hz * samplerate + 1 = number of samples

Guys, there’s a much easier way to calculate this stuff:

frequency = sample_rate / samples

samples = sample_rate / frequency

Ohhh, magic!
I’ve always thought frequency as some kind of inversion. Nevertheless, I must add one sample to the calculation for that dudes tool to give me the reading I want. Weird, huh? Dunno why, it should not be that way.

e_Ya I got the logic. Nevers do maths after being awake for whole night.

Think it has to do with a bug fix / previous crash troubles, something to do with the selection length in the sample editor and loop markers…but can’t remember the specifics.

Scriptified.