Menu

#15 var names and comments in sample Java codes that AI uses

open
nobody
None
1
2009-10-04
2009-10-04
BenRayfield
No

In this code, "angle += Math.PI" does not calculate the angle. After an arc-sine, the angle has a total range of pi. If the correct angle is in the other half of a "unit circle", then that angle should be mirrored across a dimension. The bug is adding pi instead of mirroring, but that code should not be removed from Audivolv because Audivolv is unusually skilled at creating music compared to other AI softwares and that "bug" may be helping. Do not remove the "bug". Instead, rename the variables and comments in that sample code to describe what it really does, and copy that sample code to a second file and fix the angle code there. Let Audivolv choose to use 1, the other, or both. Audivolv is very skilled at choosing which code to use. I expect both of those samples will be useful somewhere.

{

double radius = Math.sqrt(f13*f13 + f20*f20);

double angle = Math.asin(f20/Math.max(.000000001,radius));

if(f13 < 0){ angle += Math.PI; }

double speed = 1 / Math.max(.000000001, Math.abs(f6));

angle += f12*speed;

f13 = Math.max( -1., Math.min(radius*Math.cos(angle), 1.) );

f20 = Math.max( -1., Math.min(radius*Math.sin(angle), 1.) );

}

Also, check the var names and comments in all the other sample Java codes.

Do not look for serious bugs because Audivolv automatically tests for those when it starts playing sound. Example: If some sample code can exceed the range -1 to 1 in 1 of the vars but only 1 out of 1000 times, Audivolv will probably find that 9 out of 10 times you run Audivolv.

Discussion