ArrayAlign | ArrayAlignHierarchy | ArrayAlign_ConstantRange | ArrayAlign_Equal | ArrayAlign_Multiply | ArrayAlign_PermutationCycle | ArrayAlign_Power | AudivolvNetwork | AudivolvSummary | Brainwaves | CodeSimian | CodeTree | Func | FuncPurpose_MeasureOtherFunc | FuncPurpose_SoundColorMouse | FuncPurpose_Unknown | HardCoded_CodeTree_BreedFunction | HeapQueue | HighStandards | Hypercube | Javassist | LongTermGoalsOfAudivolvDesign | MindReadingHelmet | MovementScore | NeatVsScruffy | NoSpying | Node | NormedCodeTree | PermutationCompilerAndInterpreter | Plugin | ShortTermGoalsOfAudivolvDesign | SoundCardPart | Template | TuringTests_per_second | flo | int | ob

Audivolv - Func


All evolved code implements this Java-interface which is simply an efficient way to write code at the stack level. The 4 parameters of the run function are used as a stack.
Example: Java code goes in a JCodeTree, a type of Func.
There may be a few more functions, but they will be for optimization, not for changing behaviors.

public interface Func{
    public void run(double flos[], int f, Object obs[], int o) throws Exception;
    public int flos(); //floating-point stack frame size. Never changes for the same Func. Start at flos[f].
    public int obs(); //object stack frame size. Never changes for the same Func. Start at obs[o].
    public boolean stateless(); //True if the run function is stateless
}

A recursive call into a child Func c would be c.run(flos, f+flos(), obs, o+obs()),
but to avoid slowness and infinite-loops caused by the Halting-Problem
(the logical impossibility of knowing if every program will halt or not),
evolved code will have a customizable maximum recursion depth (Example: depth 5).
One whole call tree has to finish before the next audio sample is needed 1/44100
of a second later. Letting evolved code choose to finish next week is simply not an option.
It IS an option to let evolved code save its work and continue later.


It will evolve Turing-Complete code. Recursion is a convenience,
not necessary for Turing-Complete. One call of a Func is not Turing-Complete,
but many calls on the same data, each time changing that data, is Turing-Complete.
The evolved code is stateless so that is easy.

Interaction with connectionist artificial intelligence algorithms
(like neural network or bayesian network) will be done on the obs[] stack.
Code that only plays sound will usually use the more efficient flos[] stack.
Most evolved flos (Java's 64-bit floating point type) will provably
stay in range -1 to 1, except for roundoff-error. If roundoff-error becomes a problem,
it can be completely avoided with Java's strictfp math type but that is much slower.

In Audivolv version 0.1.6, real audio evolution occurs
using only flos[] (not obs[]) and flos()==25.
f2, f3, and f4 mean the same as flos[f+2], flos[f+3], and flos[f+4],
which you can see in evolved Java code it saves on the hard-drive.

In that specific code, f2 is red, f3 is green, and f4 is blue, and f0 and f1 are
the left and right speaker amplitudes which change 44100 times per second for 44.1 khz
audio that reacts to mouse movements (not prerecorded).

Func is the core of Audivolv, and its just a Java-interface. It contains no code, only function names and parameter/return types. Its extremely flexible.

Type into Audivolv window{
    green = green*.9999 + .0001*(-mousex);
    double yellow = (red + green)/2;
    left = Math.sin(yellow*5000);
}

First substitution{
    f3 = f3*.9999 + .0001*(-f7);
    double yellow = (f2 + f3)/2;
    f0 = Math.sin(yellow*5000);
}

"void run(double flos[], int f, Object obs[], int o){
    flos[f+3] = flos[f+3]*.9999 + .0001*(-flos[f+7]);
    double yellow = (flos[f+2] + flos[f+3])/2;
    flos[f] = Math.sin(yellow*5000);
    //Recursion would run(flos, f+25, obs, o+5)
}"

SoundCard.play(Javassist compile "void run(d...");


REVERSE LINKS: ArrayAlign_Multiply | AudivolvSummary | CodeTree | FuncPurpose_MeasureOtherFunc | FuncPurpose_Unknown | Hypercube | LongTermGoalsOfAudivolvDesign | MovementScore | ShortTermGoalsOfAudivolvDesign | SoundCardPart | Template | ob AUDIVOLV WEBSITES: http://audivolv.com | http://audivolv.sourceforge.net | http://audioevolve.com | http://instrumentsplaythemusicians.com