formula: Transpose for EQ / Other devices

Ok, because of a forum accident, some important contents by OopslFly were deleted. I hope u don’t mind if I repost your text from google cache. Also have a look here, Taktik posted the proper formulas:https://forum.renoise.com/t/kbd-to-filter-play-the-filter-resoance-not-quit-there-yet/44409

------- OopsIFly wrote:

This is presenting some Work on and inspired by the Slider/Knob range translation formula given by Taktik. Also I would like to have this thread as a place for discussing the formulas and keep an collection of others similliar stuff, to have it all together at one place, and to try to keep it some kind of up to date. I’ve also put some obvious (=linear) scalings here that can be useful to keytrack, and this also has the reason to have a collection of knowledge so you can see right away which parameters could be script-mapped and wich are uncertain atm.

One of the most obvious uses of knowing this formula is keytracking all sorts of frequencies. I.e. to “play” a comb filter or autooscillating resonant filter with the keyboard, to shift filter cutoffs relative to the note they filter, transpose eqs by musical intervals, you name it. Great stuff, very powerful.

I will present each formula with some approximated form that wolfram alpha spat out after setting variables and solving for slider 0…1 and one simple copy&paste formula device in a spoiler that can translate from a keytracker to cutoff/frequency of the named devices. Keep in mind this is different to the LFO table solution given here before for the old devices, for example I’ve added a pitch bend knob to the devices, that can bend the pitch by a number of semitones without steps. You could also detune, add an offset and lfo it, whatever you like, be it in Frequency or Note scaling. The device is split in two functions, one to map key and bend to frequency in herz (“kt2frq”) and another to map frequency to cutoff/freq parameter value (“frq2flt”) to allow for easier modifications of the code, it could maybe be optimized by baking a single function out of it. You can also swap out the formula in ftq2flt easily with the ones given in the listings below.

Also the fomula is configurable in the top rows of the lua code. The “fromnote” and “tonote” numbers are for defining the range of the keytracker that is fed into the device. 0-119 is the full range from c-0 to b-9, you can change both to reflect another range. The “bendrange” is the range in semitones that can be bent up or down with the second slider when it is different from 0.5 . The “a4” and “a4f” are for defining a reference note (a-4 by default, number 57, hence the name of the vars) and its frequency (440 hz by default). You can tune with these values, i.e. to pitch up or down one octave quickly try 880.0 or 220.0 for “a4f”.

Please bear in mind that I’m no experienced code, and the functions can have errors and won’t check for bad configurations. Also the formula devices can only trigger frequencies that the device allows within its range. The formula device seems to clamp out of range values automatically. But for example the mixer eq peak is pretty limited in its note range, and this can’t be done better.

Here is a little lua function to translate two strings (like “a-3” or “f#6” or “Bb5”) to their note numbers so you can configure the formula device note ranges with a little more convenience. You can load it in the renoise scripting window/terminal for example, or make a console app out of it:

Click to view contents

function NoteRange(minnote,maxnote)
local NoteVal = { [“c”]=0, [“d”]=2, [“e”]=4, [“f”]=5, [“g”]=7, [“a”]=9, [“b”]=11 }
local SignVal = { [“b”]=-1, ["-"]=0, ["#"]=1 }
local result1 = -1;
local result2 = -1;
if minnote ~= nil then
local MyNote = string.lower(string.sub(minnote,1,1))
if NoteVal[MyNote] ~= nil then
result1 = NoteVal[MyNote]
local MyNote = string.lower(string.sub(minnote,2,2))
if SignVal[MyNote] ~= nil then result1 = result1 + SignVal[MyNote]; end
if tonumber(string.sub(minnote,3,3)) ~= nil then result1 = result1 + 12.0 * tonumber(string.sub(minnote,3,3)) else result1 = -1; end;
end
end
if maxnote ~= nil then
local MyNote = string.lower(string.sub(maxnote,1,1))
if NoteVal[MyNote] ~= nil then
result2 = NoteVal[MyNote]
local MyNote = string.lower(string.sub(maxnote,2,2))
if SignVal[MyNote] ~= nil then result2 = result2 + SignVal[MyNote]; end
if tonumber(string.sub(maxnote,3,3)) ~= nil then result2 = result2 + 12.0 * tonumber(string.sub(maxnote,3,3)) else result2 = -1; end;
end
end
print ( "From: ", result1, " to ", result2 )
end

Of course there can be other stuff done With these formulas. I just thought It’d be nice to present this with something that people without coding background can use straight away and have fun with.

The main formula from taktik and then modified a bit (the maxf and minf part, it’s maximum and minimum freqeuency of the device) by me is “y = ((pow(10, log10(s)x) - 1) / (s - 1))(maxf-minf)+minf” - where y is the frequency in hz and x the slider value. This is the other way round as we would find interesting to use, I guess this is because the formula was for translating a slider value to the number of hz for the parameter value display. What I’ve done was putting in “s” and “maxf/minf” values in, put it into wolfram alpha and let it solve for “x”, then using the real result and the approximation of it. This seems to work quite nice for s=100.

  • Ok, here we go, the formulas and the devices that use them

1.)

s = 100, min = 40 (?) max = 18000 (?)

AnalogFilterDevice cutoff (Analog Filter in Renoise 3.1, but the diode filter seems off, with cutoff rising when reso increases)

Cutoff/Freq of Moog, Clean, K35, the Diode, Band Pass/Stop, Decimator - filters in Chorus2Device (new chorus in Renoise 3.1)

Most Probably also the Filters in Flanger2Device, (3.1) same as the Chorus (untested).

Also the new 3.1 instrument modulation filters seem to respond by this formula, they are also the same as the Chorus. No real use, because in polyphonic modulation there is no formula device, so frequencies can only be tracked from an effect slot via a macro - only monophonic, no polyphonic action.

Map Hz to Slider: return 0.217147log(0.0000556793(99*inp+14000))

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return 0.217147log(0.0000556793(99inp+14000))

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp
(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





2.)

s = 100, min = 20 (?), max = 20000 (?)

DigitalFilterDevice (Digital Filter in Renoise 3.1)

Theoretically: Phaser2Device (Phase), Floor and Ceiling display correct values, but resonant freq will be very different depending on number of stages, so the mapping is rather useless.

Map Hz to Slider: return 0.217147log(0.00045045(11*inp+2000))

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return 0.217147log(0.00045045(11inp+2000))

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp
(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





Linear Scaling, min = 20, max = 20000

Eq5Device, Eq10Device EQ Points Frequency (EQ5 and EQ10)

Map Hz to Slider: return (inp - 20.0) / (20000.0 - 20.0)

Map Hz to Slider Nodivision: return (inp - 20.0) * 0.00005005

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return (inp - 20.0) * 0.00005005

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp*(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





Linear Scaling, min = 400, max = 3400

MixerEqDevice “Mid Freq.” (Mixer EQ)

Map Hz to Slider: return (inp - 400.0) / (3400.0 - 400.0)

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return (inp - 400.0) / (3400.0 - 400.0)

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp*(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





Linear Scaling, min = 10, max = 4999

Reverb3Device “Low Cut” (mpReverb)

Map Hz to Slider: return (inp - 10.0) / (4999.0 - 10.0)

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return (inp - 10.0) / (4999.0 - 10.0)

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp*(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





Linear Scaling, min = 500(=Off), max = 3000

Reverb3Device “Color” (mpReverb, Will be “off” if the lowest possible value of 0 / 500hz is hit)

Map Hz to Slider: return (inp - 500.0) / (3000.0 - 500.0)

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return (inp - 500.0) / (3000.0 - 500.0)

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp*(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





7.)

s = 100, min = 0(?), max = 22050(?):

Filter3Device (Filter up to renoise 3, but 4pole shelf will be off and drift when shelf is changed)

FilterDistortionDevice (Scream Filter up to renoise 3)

CrossoverDevice Low & High (Multiband Send)

ExciterDevice Low & High (Exciter)

Map Hz to Slider: return 0.217147log(0.000408163(11*inp+2450))

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return 0.217147log(0.000408163(11inp+2450))

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp
(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





8.)

s = 100, min = 20(?), max = 11020(?)

CombDevice (old comb filter)

Map Hz to Slider: return 0.217147log(9inp+820)-1.5

Click to view contents <?xml version="1.0" encoding="UTF-8"?>





true

true

Init

Bundled Content

true



1.0

Device only





frq2flt(kt2frq(A, B))





– keytracker range:

local fromnote = 0.0

local tonote = 119.0



– bend range in semitones:

local bendrange = 12.0





– reference note and its frequency:

local a4 = 57.0

local a4f = 440.0



local trt = 1.0594630943592952645



function frq2flt (inp)

– put Hz to slider translation formula here

return 0.217147log(9inp+820)-1.5

end



function kt2frq (inp, bnd)

– maps 0…1 keytracker value with bend to frequency in hz

local nnbr = inp*(tonote-fromnote) + fromnote + (bnd-0.5)bendrange2.0

return a4f * pow(trt, nnbr-a4)

end





Key

Bend

-

true



1.0

Device only





0.5

Device only





0.0

Device only





-1

Device only





-1

Device only





-1

Device only





  • A Todo List for parameter I (or anyone of you) would like to see in this collection:

  • Old Chorus filters (like Filter3Device?)

  • Multitapdelay Filters (seems not the same formula as Filter3Device by the reported slider values…)

  • flanger + chorus + delay + multitapdelay + mpreverb & convolver pre-delay - delay values could be mapped to freq in hz for comb filter like FX

  • LoFiDevice + Old Ringmod

  • test instrument filters (could be mapped via a macro)

  • Other than direct frequency: value to delay in modulation devices delays, for perfect automated syncing to song speed.

  • Delay sliders in general for automated syncing purposes

  • Wishlist for other functions we would like to know from Taktik

(sorry big and red, so meeebie he will have his eyes on this sometime)

  • Old Chorus filters (like Filter3Device?)
  • Multitapdelay Filters (seems not the same formula as Filter3Device by the reported slider values…)
  • Old and New Chorus and Flanger Delay parameter scalings
  • LoFiDevice real frequency formula (given seems wrong)
  • old Ringmod real frequency formula (given seems wrong)
  • The real Phaser reso peaks Frequencies?
  • Correction Formula for the 3.1 diode filter?

LoFiDevice and the old Ringmod were given by Taktik with the log formula with “s” being 16 for the Lofidevice and 20000 for the old Ringmod - I’ve tested both configurations, and some other I just guessed, but couldn’t find any configuration that hit the frequencies just right.

Treat this as a gift to the community (= public domain), but don’t demand anything from me.

I have taken Time to research and test this, but errors could still be here, be it copy & paste or bad code, please comment here if you find something fishy…

Original Thread Opening Message:

Hi, Taktikmade a nice postclearing up the actual formula involved in translating a frequency to some filter devices cutoffs. Keep in mind the formula given there seems to translate the other way round, and needs to be solved for “x” to be useful for i.e. translating from a keytracker with a formula device. No need to break your head over this, stuff like wolfram alpha can do it automatically for you.

I thought in this thread we could collect the basic and warping formulas for all kinds of sliders of devices, and maybe share formula device setups for warping something useful with them.

Or nag @taktik to give out more formulas, before I make a post with the formulas and setups already known after some testings, I’d like to make a request regarding the formula for EQ5 and EQ10 frequency parameter warpings, the currently known formula won’t fit in.

Edited by OopsIFly, 09 January 2016 - 15:09.

  • danoise and ffx like this