
melter
Thank you both!
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 @jameslo.
@manuels 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!
@jameslo 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.

melter
@jameslo 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.
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.

melter
Hey all.
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.
https://www.engineeringtoolbox.com/inversesquarelawd_890.html
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).
Edit: I said 'should be there' when I meant 'should not'!
I'm also attaching the patches. I'm a bit perplexed, but it could be something very simple that I'm not accounting for!