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
renoise.song().selected_track.prefx_volume.value = 0
return
elseif db > 3 then
db = 3
end
renoise.song().selected_track.prefx_volume.value = math.pow(10, (db * 0.05)
end
function get_prefx_volume()
-- return the selected track prefx volume parameter as a db value
return (math.log10(renoise.song().selected_track.prefx_volume.value) / 0.05)
end
[s]Hope this helps someone.
Martin[/s]