florian-grond / SC-HOA

HOA wrapper classes for SuperCollider based on https://github.com/sekisushai/ambitools
GNU General Public License v3.0
32 stars 7 forks source link

Azimuth and elevation parameters should wrap internally, not clamp #42

Open totalgee opened 4 years ago

totalgee commented 4 years ago

With HOAEncoder, If you use an azimuth of 0.5pi, the sound will appear to come from the left side (correct). If you use 2.5pi (a full 360º rotation away), it should still sound from the same place. However, it appears to come from behind, since internally the UGen seems to clamp the values to the range [-pi, pi]. (same for elevation, except with the range [-0.5pi, 0.5pi]).

I can "solve" this by calling azim.wrap2(pi) on the parameter I set to HOAEncoder, but this doesn't work when using lag in the SynthDef, or even just with regular control-rate interpolation.

Example: If I have something mostly behind me but a bit to the left (azim: 0.95pi) and it moves slowly across to behind and right (azim: -0.95pi), this should be a barely noticeable position change. But instead, the Control rate input will very quickly move from 0.95 to -0.95, going through 0 on the way, so the sound spins completely around me.

What I would do (and e.g. what I do with ATK) is send continuous azimuth values (movement from 0.95pi to 1.05pi in my example), interpolation should be fine (i.e. the "final" wrapping to [-pi,pi] should happen within the UGen). (1.05pi should sound at the same position as -0.95pi).

Thanks, Glen.

florian-grond commented 4 years ago

Glen, sorry for getting back to you late, I agree with your observation of the azimuth behavious, the clamping happens in the Faust code which comes from ambitools, so it might not change any time soon.

Florian

thibaudk commented 4 years ago

Hi, you can actually use the "CircleRamp" object for a circular linear ramp. I use it on every encoder, as well as vbap, and it solved this issue for me.

totalgee commented 4 years ago

Thanks @thibaudk, I wasn't aware of this UGen. I'll take a look!