szk! | Tutorial
21
archive,category,category-tuto,category-21,ajax_leftright,page_not_loaded,,select-theme-ver-1.7,wpb-js-composer js-comp-ver-4.3.4,vc_responsive
patchtut32

How to remote volume using dB values in Max For Live ? DB conversion to 0-to-1 linear value

I had this issue when creating a M4L patch to remote live set track’s volume. Troubleshooting of course, so it was a good occasion to speak a little more about this no-tricky-but-not-so-easy issue. Maybe useful ?

Observe / Remote volume track

You can check this controling live with Max tutorial and use this kind of patch to observe and set back a track volume :

The Live.Observer and Live.Object work with linear values between 0. and 1. My issue was to convert these values to « understandable » dB values for monitoring and setting back purposes.

Empirical observation

dB-by-dB variations of track volume, from -69 to +6 dB returned a step-by-step set of linear values from 0. to 1. and gave a function linear = f (dB)

Polynomial fit

Values of linear = f (dB) are used to fit different high-degrees polynomials. I just limited the use to 2nd and 3rd order polynomials to improve the CPU usage, considering that the resulting maximum ∆dB error nearly ± 0.5 dB is not so bad for my live sessions needs.

Polynomials are given below :

# 2nd degree

y = 2.07201247*(x*x)/10000 + 2.57503387*(x)/100 + 8.342259079/10

# 3rd degree

y = 2.027132923*(x*x*x)/1000000 + 3.987653083*(x*x)/10000 + 3.002900816*(x)/100 + 8.422843694/10

Plots

Figure below indicates the different fit compared to the empirical behaviour

# black : empirical monitored values | linear = f(dB)

# strawberry : 2nd degree polynomial | linear = p2(dB)

# orange : 3rd degree polynomial | linear = p3(dB)

dev71

Data

Values for dB and linear given by the Live.Observer are downloadable below in .txt format for your own calculations if you need it.

Internet discussions and ressources

I found useful informations about this topic at these different places. Check it or die.

https://cycling74.com/forums/topic/linear-to-gui-live-value-to-understandable-db-or-amplitude/
https://forum.ableton.com/viewtopic.php?f=1&t=182375&p=1418659&hilit=lemur+right+expression
https://cycling74.com/forums/topic/db-to-gain-to-db/

# Note

This post is dedicated to a quick discussion about the db-to-linear conversion. You can find related M4L patches and devices that I created here :

szk.DB2LINEAR.amxd
szk.PITCH2LEVEL.amxd