map gain to angle
in
Programming Questions
•
3 months ago
Hi everyone,
I'm pretty new to processing, having some fun with reactivision and beads library and playing with some sounds.
Now here is my problem: Reactivision can track objects and also their angle via a webcam.
What I did was mapping the angle to the volume gain of the sound output, so when I rotate the object the volume changes.
here is the part of my code (angles in Reactivision go from 0-6):
mx=map (tobj.getAngle(),0,6,0,1);
gainValue.setValue(mx);
Although this is working fine, my problem is, that if the angle goes above one, it jumps back to zero and so does the volume. What I'd like to do is that if I reach max vol/angle and rotate the object further in the same direction, the volume stays at it's max and doesnt jump back to zero. And if I then rotate to the other direction, the Volume should immediately decrease.
So, I'm looking forward for your suggestions, many thanks in advance :)
I'm pretty new to processing, having some fun with reactivision and beads library and playing with some sounds.
Now here is my problem: Reactivision can track objects and also their angle via a webcam.
What I did was mapping the angle to the volume gain of the sound output, so when I rotate the object the volume changes.
here is the part of my code (angles in Reactivision go from 0-6):
mx=map (tobj.getAngle(),0,6,0,1);
gainValue.setValue(mx);
Although this is working fine, my problem is, that if the angle goes above one, it jumps back to zero and so does the volume. What I'd like to do is that if I reach max vol/angle and rotate the object further in the same direction, the volume stays at it's max and doesnt jump back to zero. And if I then rotate to the other direction, the Volume should immediately decrease.
So, I'm looking forward for your suggestions, many thanks in advance :)
1