What Does Amp * 0.5 Translate To In Db


I’m doing a series of lessons in electronic music, naturally all in renoise :slight_smile:

Anyways, I wanted to demonstrate how adding sines up the overtone series will end up with a saw wave. Since the strength of the n’th overtone should have amplitude 1/n, I need to be able amplify for instance the 2nd overtone by 0.5. I solved it by using an amplifier plugin, but how does this translate into db’s, so I can stick with native-only plugins and use the gainer?

0.5 is roughly -6.021 dB (-6.0205999132796 dB to be more precise)

To convert linear amplitude to dB:
dB = 20 * math.log10(amplitude)

To convert dB to linear amplitude:
amplitude = math.pow(10, (0.05 * dB))

You can do both of these directly in Renoise’s scripting terminal :)

Alternatively, you can use the very handy functions in Renoise’s math library:

dB = math.lin2db(amplitude)

amplitude = math.db2lin(dB)

You can even play with the maths in real time with the *formula meta device that contains the math library. Try to paste this in your track dsps section :

<?xml version="1.0" encoding="UTF-8"?>  
<filterdeviceclipboard doc_version="0"><br>
  <deviceslot type="FormulaMetaDevice"><br>
  	<formulaparagraph>db2lin (-6 )</formulaparagraph><br>
  	<functionsparagraph>function inv(x)</functionsparagraph><br>
  	<functionsparagraph> return (1.0 - x)</functionsparagraph><br>
  	<visualization>Device only</visualization><br>
  	<visualization>Device only</visualization><br>
  	<visualization>Device only</visualization><br>
  	<visualization>Device only</visualization><br>
  	<visualization>Device only</visualization><br>
  	<visualization>Device only</visualization><br>

It’ll be easier to “play” with maths and hear / see the results through the scopes.

Hey , I’ve done the same thing ,I have a renoise template song that has 20 sine wavers ( partials ) 1.2.3…20 each having their own vmixer channel …render the whole lot to sample …
It’s a great method for creating new waveforms

That sounds nice (and looking at the available variables, this could be fun for other stuff indeed). However I can’t make it work

I put “lin2db(A)” in the formula field, and selected the “Gain” of a gainer device I put the same channel as distination. But no matter what values I put slider A to, the gain is at -INF. It seems the formula device tries to write -6.0205999132796 to the “slider” of the gainer, but the slider goes from 0-1. So I need to translate the db to renoise-device-slider-language :slight_smile:

If I input print(math.lin2db(0.5)) in the scripting terminal it correctly prints -6.0205999132796, so it seems the formula is ok?

It ended up being dead simple, the correct formula was “A * .25”. Connected to the gain of a gainer device will allow me to set slider A to 0.5 which moves the gain to -6.021dB, etc…

Thanks for bringing up the formula device!