<?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[Inverse Square Law Calculation]]></title><description><![CDATA[<p>Hey all.</p>
<p>I've just been working on making an abstraction for the inverse square law to control the volume of an audio source based on distance. The maths seems okay.</p>
<p><a href="https://www.engineeringtoolbox.com/inverse-square-law-d_890.html" rel="nofollow">https://www.engineeringtoolbox.com/inverse-square-law-d_890.html</a></p>
<p>The mystery I can't figure out is that when the distance between distance 1 and distance 2 is 0, there's a discrepancy in volume, which should not be there (see screenshot).</p>
<p>Edit: I said 'should be there' when I meant 'should not'!</p>
<p>I'm also attaching the patches. I'm a bit perplexed, but it could be something very simple that I'm not accounting for!</p>
<p><a href="/uploads/files/1727792107825-test-inverse_sq_law.pd">test-inverse_sq_law.pd</a><br />
<a href="/uploads/files/1727792107825-inverse_sq_law.pd">inverse_sq_law.pd</a></p>
<p><img src="/uploads/files/1727792122217-screenshot-2024-10-01-at-15.13.44.png" alt="Screenshot 2024-10-01 at 15.13.44.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 06:35:41 GMT</lastBuildDate><atom:link href="http://forum.pdpatchrepo.info/topic/14888.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 01 Oct 2024 14:17:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Inverse Square Law Calculation on Tue, 01 Oct 2024 16:23:20 GMT]]></title><description><![CDATA[<p>Hey all.</p>
<p>I've just been working on making an abstraction for the inverse square law to control the volume of an audio source based on distance. The maths seems okay.</p>
<p><a href="https://www.engineeringtoolbox.com/inverse-square-law-d_890.html" rel="nofollow">https://www.engineeringtoolbox.com/inverse-square-law-d_890.html</a></p>
<p>The mystery I can't figure out is that when the distance between distance 1 and distance 2 is 0, there's a discrepancy in volume, which should not be there (see screenshot).</p>
<p>Edit: I said 'should be there' when I meant 'should not'!</p>
<p>I'm also attaching the patches. I'm a bit perplexed, but it could be something very simple that I'm not accounting for!</p>
<p><a href="/uploads/files/1727792107825-test-inverse_sq_law.pd">test-inverse_sq_law.pd</a><br />
<a href="/uploads/files/1727792107825-inverse_sq_law.pd">inverse_sq_law.pd</a></p>
<p><img src="/uploads/files/1727792122217-screenshot-2024-10-01-at-15.13.44.png" alt="Screenshot 2024-10-01 at 15.13.44.png" class="img-responsive img-markdown" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation</guid><dc:creator><![CDATA[melter]]></dc:creator><pubDate>Tue, 01 Oct 2024 16:23:20 GMT</pubDate></item><item><title><![CDATA[Reply to Inverse Square Law Calculation on Tue, 01 Oct 2024 19:33:13 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/melter">@melter</a> I think you are expecting [env~] to output 100 for [noise~] at full amplitude. The approx 5dB discrepancy appears to be from that. Take a look at the [env~] help--even for a full amplitude sine, the output is -3dB.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/2</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/2</guid><dc:creator><![CDATA[jameslo]]></dc:creator><pubDate>Tue, 01 Oct 2024 19:33:13 GMT</pubDate></item><item><title><![CDATA[Reply to Inverse Square Law Calculation on Tue, 01 Oct 2024 20:18:01 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo">@jameslo</a> thanks. Yes, that's not the problem. It's that when the d1 and d2 (which controls the volume of the sound) is zero, there's a discrepancy at the output stage.</p>
<p>You can see in the screenshot that the noise signal at input is indeed around -5dB as you say. But at the output stage, it's lower by a few dB. This is despite the rms value after the inverse_sq_law abstraction being the same as that going into the abstraction. That's what's stumping me.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/3</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/3</guid><dc:creator><![CDATA[melter]]></dc:creator><pubDate>Tue, 01 Oct 2024 20:18:01 GMT</pubDate></item><item><title><![CDATA[Reply to Inverse Square Law Calculation on Tue, 01 Oct 2024 21:28:58 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/melter">@melter</a> If I understand correctly what your abstraction is doing, you would have to apply its output (the desired rms value) to the analyzed signal after you have divided it by the actual rms value ....</p>
<p>BUT: That's much too complicated! You don't even have to analyze the signal with [env~]. Under the link that you posted there's a table from which you can see, that doubling the distance corresponds to  a decrease of sound pressure by 6dB, which is 1/4 power or 1/2 amplitude. So I guess all you have to do is to multiply the signal with d1/d2.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/4</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/4</guid><dc:creator><![CDATA[manuels]]></dc:creator><pubDate>Tue, 01 Oct 2024 21:28:58 GMT</pubDate></item><item><title><![CDATA[Reply to Inverse Square Law Calculation on Tue, 01 Oct 2024 21:39:28 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/melter">@melter</a> In your first post you wrote &quot;distance <strong><em>between</em></strong> distance 1 and distance 2&quot; but now you're writing &quot;d1 and d2 (which controls the volume of the sound) is zero&quot;. In Pd, division by 0 equals 0 (which is definitely weird IMHO)--is that what you meant?</p>
<p>If you're not making the assumption I think you are, then why are you computing the difference between the log math and the output of [env~] in [inverse_sq_law]?</p>
<p>Why is it not enough to just divide distance 1 by distance 2 (both non-zero) and take that as your RMS factor? e.g.<br />
<img src="/uploads/files/1727818504423-screenshot-2024-10-01-173428.png" alt="Screenshot 2024-10-01 173428.png" class="img-responsive img-markdown" /></p>
<p>Edit: I cross posted with <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/manuels">@manuels</a> ... didn't intend to repeat what he wrote <img class="emoji emoji-extended" src="http://forum.pdpatchrepo.info/plugins/nodebb-plugin-emoji-extended/images/grinning.png" title=":)" alt=":)" /></p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/5</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/5</guid><dc:creator><![CDATA[jameslo]]></dc:creator><pubDate>Tue, 01 Oct 2024 21:39:28 GMT</pubDate></item><item><title><![CDATA[Reply to Inverse Square Law Calculation on Wed, 02 Oct 2024 08:17:34 GMT]]></title><description><![CDATA[<p>Thank you both!</p>
<p>I suppose I was trying to exactly replicate the inverse square law equation at the link in my first post so that I could that I check that I was doing everything correctly. When I checked my abstraction against the examples on the site, I seemed to be getting the correct outputs. What stumped me was why this wasn't translating when applying the abstraction's output to the [*~] in the patch with a sound source. I definitely made an assumption here that I wasn't expecting <a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo"><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo">@jameslo</a></a>.</p>
<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/manuels">@manuels</a> I understand that it might not strictly be necessary and thank you for pointing out that you can just multiply the signal by d1/d2 divided. I will definitely do that for actual calculations!</p>
<p><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo"><a class="plugin-mentions-a" href="http://forum.pdpatchrepo.info/user/jameslo">@jameslo</a></a> I wonder if you're being pedantic about my phrasing, which is fine. I do understand that division by 0 would be 0. That is totally fine in this situation, where I was do that as part of a formula to calculate the reduction in dB at distance 2, and then subtracting that from the dB of the sound at a hypothetical distance 1 (even if it's a bit unnecessary). As I said, I was following the equation at the link to check my work.</p>
]]></description><link>http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/6</link><guid isPermaLink="true">http://forum.pdpatchrepo.info/topic/14888/inverse-square-law-calculation/6</guid><dc:creator><![CDATA[melter]]></dc:creator><pubDate>Wed, 02 Oct 2024 08:17:34 GMT</pubDate></item></channel></rss>