Howto: Set A Specific Db Value As The Volume

See the reply from vV below (scroll or click here). These functions are built in.

[s]Hi all,

I couldn’t figure out an easy way to set a specific dB value for a volume parameter, so I did some calculations and came up with the following formulas:[/s]

renoise_volume = 10^(db_value * 0.05) and thus  
db_value = log10(renoise_volume) / 0.05  

Here is some example code that incorporate the above:

function set_prefx_volume(db)  
 -- set the prefx volume for the selected track to the specified db value  
 if db < -96 then = 0  
 elseif db > 3 then  
 db = 3  
 end = math.pow(10, (db * 0.05)  
function get_prefx_volume()  
 -- return the selected track prefx volume parameter as a db value  
 return (math.log10( / 0.05)  

[s]Hope this helps someone.


Hi martin,
Values from 0 to 1 (or 0 to 4) have to be supplied to these controls.
The Renoise LUA API has two functions which convert these figures to DB and back to figures for you which you can also use:


Saves you a lot of code.