<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Decibel to Linear value to make Dry&#x2F;Wet Slider...]]></title><description><![CDATA[<p dir="auto">As you know, dB values are not linear. So we want to decrease one instrument and increase other one; dB values are not relatively linear. I've found this equation to convert dB to linear percentage</p>
<p dir="auto">dB = 10 log(1 + X )<br />
So if X = 1%<br />
dB = 10 log(1 + 0.01)</p>
<p dir="auto">I've tried this equation on 2 different simple gain unit for making DRY/WET effect relatively for two different instruments. But something is wrong. :(<br />
Both of two Simple gain units' gain amounts are not changing (one will be decreased and other will ve increased and <strong>they are not supposed to be linear</strong> because of the decibel values to keep the level amount same.) - <strong>Like Dry/Wet Knob.</strong></p>
<pre><code>Content.makeFrontInterface(600, 200);

const var DRYWETMIXER = Content.getComponent("DRYWETMIXER");
const var WETT = Synth.getEffect("WETT");
const var DRYY = Synth.getEffect("DRYY");
var tfd;
var neetfd;
var posvalue;

inline function onDRYWETMIXERControl(component, value)
{
    posvalue = value;
    tfd = 100-Math.pow(10, 0.1*posvalue);
    neetfd = 10*Math.log(tfd);
    
	WETT.setAttribute(WETT.Gain, -tfd);
	DRYY.setAttribute(DRYY.Gain, neetfd);
};

DRYWETMIXER.setControlCallback(onDRYWETMIXERControl);
</code></pre>
<p dir="auto">This is the HISEsnippet</p>
<pre><code>HiseSnippet 1080.3oc6X0kaaaDDdojYZkRUPRQO.D4I4.aARG2zBDTTaIYEHzXGCKWG69RvJxURa0xcIHWZE0fbD54nmhB3iROB809T6L7GKpTZCqBzfX.uOXv428amclYG4CCUtrnHUHw39GOOfQL9ByAyk5IclP4RR+tDiGXtOMRyBsRY0dd.MJh4QLLp9BjgQs0HIq+76aSEToKaAKB4DE2k8RtOWufavN+.WH5Q8XGy8Kn816z2UI6nDpX.OUMsIAT2ozwrCnnZULImyYyhHF1lOcqVgScF9K61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xO7ul49HskS9TxXrwG9czuw0EmuYSH5TtEasxV7zU1hsWYK95U1hmsxV7MqrEe60XA9OsX2XsxOMemP9G.w4sNm
</code></pre>
<p dir="auto"><img src="https://media.giphy.com/media/ZvTDAqLLG9SlSFrPTX/giphy.gif" alt="alt text" class=" img-fluid img-markdown" /></p>
]]></description><link>https://forum.hise.audio/topic/595/decibel-to-linear-value-to-make-dry-wet-slider</link><generator>RSS for Node</generator><lastBuildDate>Sun, 19 Apr 2026 20:07:11 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/595.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 11 Mar 2018 08:26:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Decibel to Linear value to make Dry&#x2F;Wet Slider... on Sun, 11 Mar 2018 09:53:06 GMT]]></title><description><![CDATA[<p dir="auto">Ah I was wondering why the variable names are so weird. Congratulations, you've just invented <strong>Encapsulation by Mystification</strong> :)</p>
]]></description><link>https://forum.hise.audio/post/3783</link><guid isPermaLink="true">https://forum.hise.audio/post/3783</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Sun, 11 Mar 2018 09:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to Decibel to Linear value to make Dry&#x2F;Wet Slider... on Sun, 11 Mar 2018 09:51:19 GMT]]></title><description><![CDATA[<p dir="auto">Hmm I didn't know <code>Engine.getGainFactorForDecibels() </code> is exist.<br />
Yes you are right it's useless to give weird names to variables. I will take this advice....<br />
Great solution bro, thank you so much :)</p>
]]></description><link>https://forum.hise.audio/post/3782</link><guid isPermaLink="true">https://forum.hise.audio/post/3782</guid><dc:creator><![CDATA[resonant]]></dc:creator><pubDate>Sun, 11 Mar 2018 09:51:19 GMT</pubDate></item><item><title><![CDATA[Reply to Decibel to Linear value to make Dry&#x2F;Wet Slider... on Sun, 11 Mar 2018 09:39:10 GMT]]></title><description><![CDATA[<ol>
<li>Use <code>Engine.getDecibelsForGainFactor()</code> and its brother <code>Engine.getGainFactorForDecibels()</code> for the conversion between db values and <code>0...1</code>. No need to reinvent the wheel here and get dirty with <code>log</code> and <code>pow</code></li>
<li>Use the Slider mode <code>LinearPercentage</code>, which shows a percentage value, but uses a value from <code>0...1</code> internally.</li>
<li>This is not crucial for the functionality, but use <code>local</code> variables whenever you can. <code>tfd</code> <code>neetfd</code> and <code>posValue</code> have no usability outside of the control callback so their lifetime / visibility should be limited to this scope. For more information, google  <em>Encapsulation</em>, which is the paradigm behind that advice.</li>
</ol>
<p dir="auto">This is the recommended way to make a Dry Wet knob:</p>
<pre><code class="language-javascript">inline function onKnob1Control(component, value)
{
    local wValue = Engine.getDecibelsForGainFactor(value);
    Wet.setAttribute(Wet.Gain, wValue);
	
    local dValue = Engine.getDecibelsForGainFactor(1.0 - value);
    Dry.setAttribute(Wet.Gain, dValue);
};
</code></pre>
<p dir="auto">As complete example:</p>
<pre><code>HiseSnippet 1082.3oc6X0saZbDEdVfIIPJQIQU45UHUIrjCBxesRUUAavDgbsCJD6zzahFlcVXDyNypYm0NjnH0Gs9nzGg9FzdlcWXgFL0ToFEKYtaN+9sey4bli8.shxhhTZjyse8rPFx4avCmIMS5Lgvkn9cQN2AeDIxvztoh1eVHIJh4gbbJ9Bq.mxkPI+9ymuOQPjTVtHD5TEmx9Yd.2jKMr8gbgnGwi8ZdvRV+j18oJYGkPEC3oHtIJjPmRFyNlXMq.FcFmcdDxoI9wOpgdZqQeXuF+ieGt29cZ36upbDMVqYRyof6HGryeA+bvG3wMJ8PCwvfXVbek2rgSTmKSS8o7H9HAydnEZHfoTwnNS3BuAyosHDxozfbRrXJI9s3i3d7ExyIy6lnvM2ikoSmBqBoRq.oVWDj5oDd1.bAvyYI3UJEd2COjp4glbMVrcabeIbO6SfavkgUpsnB+ZAbGEXgzzHfLk0SCGV3Q8m0r4ttOsYyc9wpUpVAtGiLtmQztc0yb+I2jZpFiYlC78YTS8Zf3ZVSyM7MLy5LDDWKMlUqvkBtj45GKoFtR5pjGJUiZYQkVIpSUAgJIfucg.JhY6TsxGqVorPQIB2yO0JBxvAxwPPronKixGwDQ8TZakbOBEH+5otBYrLj5FQLydFilOJ1vpaEXsb2rnkX0hL3cYyPqFMcenadd.t3hxi2h77oDNX9E.D6Ny+ZqWKgEpsiMHYbQGhPLBZdpuJEYCzRr2wJC6kx56T4iUJW4SelFe+0oJKTBldcZscz5M3VcYbvHld9MTlcPk4pk923xU5SSoikLTI6K4lWFxxNm2bzZMMGnL9z1ljAPvTSRSxcxZRFJ3dLMhCA4l3DxDkf8kmxgNoeWhgLOLPDgrDxzFt8iwoK6LXJXZuWYbWVzTiJLw1rqPn46eMoueQBaeR6Y4Y+UsOm6YlXmq8avwIL93IF6IXZ.JxLyxZ2HIFn.tmmfMPEwsWJ4g3OddTruO+8VZ56P9bQPDTJF1O.l8hbtO9jHlqGymDKLtQSgQYAJOPwCvGqzADA+CLuALME9PrNf97ANvXOkWrfXVcVnsFOSgEOKOzwNXQB3b1xuurECHat1AjqsF3RB26gGvMzIqGuEVCdgpg+uwa1yMUwoSKyAaIbue4KvaKEVBK2bw9C7fPA6EygBFCy21vZCHTWlfrBu8lzB54Bda60rXgSwM89cq+iueu4B.KvcuxTvdebBwdUBvIW7Wc.7cwCHeMTP7JUrgKGeDAlZCCwwGGGLD1glx.nJkv9G1mCJXetK8bS6YKfFxjdMmuQblxV1yNYJaMWI5R0oCKtrgN8296W2oecm90c5ek2o+kHGADpV8NZ5J21VyakHA9tkI+s9kwGYO6tXWaK2.quxeGkZ2t4g.6rdOdzV6wi2ZOdxV6wS2ZOd1V6w2u0d7CavC6+mh8hMpfz5cD5uQz7tGH
</code></pre>
]]></description><link>https://forum.hise.audio/post/3781</link><guid isPermaLink="true">https://forum.hise.audio/post/3781</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Sun, 11 Mar 2018 09:39:10 GMT</pubDate></item></channel></rss>