Does IanniX engine sometimes freeze variables state ?

Accueil Forums Scripts Does IanniX engine sometimes freeze variables state ?

  • Ce sujet contient 4 réponses, 2 participants et a été mis à jour pour la dernière fois par Anonyme, le il y a 12 années et 3 mois.
5 sujets de 1 à 5 (sur un total de 5)
  • Auteur
    Messages
  • #2275 Répondre
    Anonyme
    Inactif

    Hello,

    I’m actually working on my first IanniX project, a reservoir of 3D curves for spatialization of various audio tracks, with remote control of each cursor from Max/MSP via osc.

    Nearly everything is doing fine, except a few weird behaviours :

    It seems that a track is kept of bad scripts that can’t be erased after that.
    For example, I want some curves to be plaid one shot, and some others in loop.
    But since I don’t know exactly when, my curves don’t behave anymore like they should according to the setPattern message I give them. They just play once and that’s all.
    More precisely than that, the behaviour seems to keep frozen at a previous scripting state.

    Are there some messages that disable others ? Maybe using setSpeedF disables setPattern ?
    I tried to trash the preferences, use the message « clear » at the beginning of my script, even rename the script and copy-paste the code in a new one with a different name, but all of this won’t work.

    In the following code, on my machine only the second curve responds to the setPattern message I give it, the others play once whatever I do :


    var ENTONNOIR = 0;
    var BOURONNE = 1;
    var COURONNE = 2;

    var playEntonnoir = 0;
    var entonnoirSpeed = 1;
    var entonnoirDuration = 10;

    var playBouronne = 0;
    var bouronneSpeed = 1;
    var bouronneDuration = 10;

    var playCouronne = 1;
    var couronneSpeed = 1;
    var couronneDuration = 10;

    function onCreate() {

    var id = 0;

    run("clear");

    //
    :::::::::::::::::::::::::::::: Entonnoir
    run("add curve " + (1000 + id));
    run("setPos current " + id * 7 + " 0 0");

    //Plot curve
    info = plot(function(t) { return {
    index : 0, nbPoints: 900,
    offset : {x: 0, y:0, z:0},

    x : 3 * pow(1-t,3) * cos(t * TWO_PI * 12),
    y : 3 * pow(1-t,3) * sin(t * TWO_PI * 12),
    z : 2 - (pow(t,1.5) * 4),

    t : [0,1] }});

    run("add cursor " + id);
    run("setCurve current lastCurve");
    run("setSpeed current auto " + entonnoirDuration);
    run("setSpeedF current " + playEntonnoir * entonnoirSpeed);
    run("setPattern current 0 0 1"); // one shot
    run("setWidth current 1");

    //Set custom cursor message
    //*
    run("setMessage current 20, osc://127.0.0.1:57120/entonnoir " + id
    + " {cursor_xPos - curve_xPos}"
    + " {cursor_yPos - curve_yPos}"
    + " {cursor_zPos - curve_zPos}"
    + " cursor_time_percent");
    //*/
    id++;

    //_________________________________________________________________________//

    //
    ::::::::::::::::::::::::: Bouronne
    run("add curve " + (1000 + id));
    run("setPos current " + id * 7 + " 0 0");

    // curve variables :
    var ray = 2;
    var revs = 5;
    var hf = 0.5;

    //Plot curve
    info = plot(function(t) { return {
    index : 0, nbPoints: 900,
    offset : {x: 0, y:0, z:0},

    //theta : sin(6 * TWO_PI * t),
    //r : 2.5 - (5 * t),
    //phi : cos(6 * TWO_PI * t),
    x : ray * cos(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t)),
    y : ray * sin(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t)),
    z : ray * cos(HALF_PI + hf * sin(revs * TWO_PI * t)),

    t : [0,1] }});

    //Add a cursor
    run("add cursor " + id);
    run("setCurve current lastCurve");
    run("setSpeed current auto 10");
    run("setPattern current 0 0 1"); // back and forth
    run("setWidth current 1");

    //Set custom cursor message
    //*
    run("setMessage current 20, osc://127.0.0.1:57120/bouronne " + id
    + " {cursor_xPos - curve_xPos}"
    + " {cursor_yPos - curve_yPos}"
    + " {cursor_zPos - curve_zPos}"
    + " cursor_time_percent");
    //*/
    id++;

    //_________________________________________________________________________//

    //
    ::::::::::::::::::::::::: Couronne
    run("add curve " + (1000 + id));
    run("setPos current " + id * 7 + " 0 0");

    //Plot curve
    info = plot(function(t) { return {
    index : 0, nbPoints: 900,
    offset : {x: 0, y:0, z:0},

    //r : 2,
    //theta : TWO_PI * t,//cos(22 * TWO_PI * t),
    //phi : sin(TWO_PI * 5 * t),//TWO_PI * t,
    x : 2 * cos(t * TWO_PI),// * (2 - abs(sin(6 * TWO_PI * t))),
    y : 2 * sin(t * TWO_PI),// * (2 - abs(sin(6 * TWO_PI * t))),
    z : sin(6 * TWO_PI * t), //2 - (pow(t,1.5) * 4),

    t : [0,1] }});

    run("add cursor " + id);
    run("setCurve current lastCurve");
    run("setSpeed current auto " + couronneDuration);
    run("setSpeedF current " + playCouronne * couronneSpeed);
    run("setPattern current 0 0 1"); // mono directionnal infinite loop
    run("setWidth current 1");

    //Set custom cursor message
    run("setMessage current 20, osc://127.0.0.1:57120/couronne " + id
    + " {cursor_xPos - curve_xPos}"
    + " {cursor_yPos - curve_yPos}"
    + " {cursor_zPos - curve_zPos}"
    + " cursor_time_percent");
    id++;

    // Play on init :
    run("play");

    }

    //If a message is received
    function onMessage(protocol, host, port, destination, values) {

    if(protocol == "osc") {

    // :::::::::::::::::::::::::::::::::::: Entonnoir control
    if(destination == "/entonnoir/play") {
    playEntonnoir = values[0];
    run("setSpeedF " + ENTONNOIR + " " + playEntonnoir * entonnoirSpeed);
    if(playEntonnoir == 0) {
    run("setTime "+ ENTONNOIR + " 0");
    }
    }
    if(destination == "/entonnoir/duration") {
    entonnoirDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
    }
    if(destination == "/entonnoir/speed") {
    entonnoirSpeed = values[0];
    run("setSpeedF " + ENTONNOIR + " " + playEntonnoir * entonnoirSpeed);
    }

    // :::::::::::::::::::::::::::::::::::: Couronne control
    ///*
    if(destination == "/couronne/play") {
    playCouronne = values[0];
    run("setSpeedF " + COURONNE + " " + playCouronne * couronneSpeed);
    if(playCouronne == 0) {
    run("setTime "+ COURONNE + " 0");
    }
    }
    if(destination == "/couronne/duration") {
    couronneDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
    }
    if(destination == "/couronne/speed") {
    couronneSpeed = values[0];
    run("setSpeedF " + COURONNE + " " + playCouronne * couronneSpeed);
    }
    //*/
    }
    }

    Sorry the code is a bit long, but since I don’t know where the bug comes from, it may be anywhere (maybe using global variables or osc messages … but I really need them !)

    Another symptom is that once, I also had to rewrite the same script from scratch in order to have a cursor attached to a curve with the run(« setCurve current lastCurve »); instruction. Before I did that the cursor was stuck at the origin (0,0,0) and wouldn’t move. After that it reworked fine, but the same trick won’t work for the setPattern problem.

    Any clues ? Maybe there is a method to « reinit » some frozen variables states hidden in the IanniX engine ?
    Sorry if it is somewhere in the documentation but I didn’t find anything.

    Thank you very much, and keep up the very good work.
    IanniX is definitely powerful !!!
    Cheers,
    J

    #2824 Répondre
    Anonyme
    Inactif

    Hi Joseph, I’m the author of GeoSonix which was branched off IanniX about a year ago.

    I was curious to know whether the problems you are reporting existed in GeoSonix so I converted your script to a GeoSonix script. The commands are similar but the syntax is simplified (see below). As far as I can tell the script builds a score that runs as you intended, although I have not tried controlling it with OSC.

    The converted script is at the end of this post. It needs the GeoSonix Version 0.9 Beta (OS X only for now). If you’d like to try it contact me at the email address in the message signature for download information.

    – Chris

    var ENTONNOIR = 0;
    var BOURONNE = 1;
    var COURONNE = 2;

    var playEntonnoir = 0;
    var entonnoirSpeed = 1;
    var entonnoirDuration = 10;

    var playBouronne = 0;
    var bouronneSpeed = 1;
    var bouronneDuration = 10;

    var playCouronne = 1;
    var couronneSpeed = 1;
    var couronneDuration = 10;

    function onCreate() {

    var id = 0;

    clear();
    rotate();
    center(6.5,0,0);
    zoom(50);

    //
    :::::::::::::::::::::::::::::: Entonnoir
    addCurve(1000 + id);
    setPosition(id * 7,0,0);

    //Plot curve
    fx = function(t) {return 3 * pow(1-t,3) * cos(t * TWO_PI * 12)};
    fy = function(t) {return 3 * pow(1-t,3) * sin(t * TWO_PI * 12)};
    fz = function(t) {return 2 - (pow(t,1.5) * 4)};
    plot( 300, fx, fy, fz);

    addCursor(id);
    setCurve();
    setDuration(entonnoirDuration);
    //setSpeedMultiplierRT(playEntonnoir * entonnoirSpeed);
    setPattern("1 0"); // one shot
    setCursorWidth(1);

    //Set custom cursor message

    setMessage(20, "osc://127.0.0.1:57120/entonnoir " + id
    + " {cursorXPosition - curveXPosition}"
    + " {cursorYPosition - curveYPosition}"
    + " {cursorZPosition - curveZPosition}"
    + " cursorTimePercent");

    id++;

    //_________________________________________________________________________//
    //
    ::::::::::::::::::::::::: Bouronne
    addCurve(1000 + id);
    setPosition(id * 7,0,0);

    // curve variables :
    var ray = 2;
    var revs = 5;
    var hf = 0.5;

    //theta : sin(6 * TWO_PI * t),
    //r : 2.5 - (5 * t),
    //phi : cos(6 * TWO_PI * t),
    fx = function(t) {return ray * cos(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
    fy = function(t) {return ray * sin(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
    fz = function(t) {return ray * cos(HALF_PI + hf * sin(revs * TWO_PI * t))};
    plot( 300, fx, fy, fz);

    //Add a cursor
    addCursor(id);
    setCurve();
    setDuration(10);
    setPattern("1 -1"); // back and forth
    setCursorWidth(1);

    //Set custom cursor message

    setMessage(20, "osc://127.0.0.1:57120/bouronne " + id
    + " {cursorXPosition - curveXPosition}"
    + " {cursorYPosition - curveYPosition}"
    + " {cursorZPosition - curveZPosition}"
    + " cursorTimePercent");

    id++;

    //_________________________________________________________________________//

    //
    ::::::::::::::::::::::::: Couronne
    addCurve(1000 + id);
    setPosition(id * 7,0,0);

    //Plot curve
    //fx = function(t) {return 2 * cos(t * TWO_PI)};// * (2 - abs(sin(6 * TWO_PI * t)))};
    //fy = function(t) {return 2 * sin(t * TWO_PI)};// * (2 - abs(sin(6 * TWO_PI * t)))};
    //fx = function(t) {return sin(6 * TWO_PI * t)};//2 - (pow(t,1.5) * 4)};

    fx = function(t) {return ray * cos(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
    fy = function(t) {return ray * sin(TWO_PI * t) * sin(HALF_PI + hf * sin(revs * TWO_PI * t))};
    fz = function(t) {return ray * cos(HALF_PI + hf * sin(revs * TWO_PI * t))};
    plot( 300, fx, fy, fz);

    addCursor(id);
    setCurve();
    setDuration(couronneDuration);
    //run("setSpeedF current " + playCouronne * couronneSpeed);
    setPattern("1"); // mono directionnal infinite loop
    setCursorWidth(1);

    //Set custom cursor message
    setMessage(20, "osc://127.0.0.1:57120/couronne " + id
    + " {cursorXPosition - curveXPosition}"
    + " {cursorYPosition - curveYPosition}"
    + " {cursorZPosition - curveZPosition}"
    + " cursorTimePercent");
    id++;

    // Play on init :
    play(1);
    }

    //If a message is received
    function onMessage(protocol, host, port, destination, values) {
    if(protocol == "osc") {
    // :::::::::::::::::::::::::::::::::::: Entonnoir control
    if(destination == "/entonnoir/play") {
    playEntonnoir = values[0];
    setSpeedMultiplierRT(ENTONNOIR, playEntonnoir * entonnoirSpeed);
    if(playEntonnoir == 0) {
    setTime(ENTONNOIR, 0);
    }
    }
    if(destination == "/entonnoir/duration") {
    entonnoirDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
    }
    if(destination == "/entonnoir/speed") {
    entonnoirSpeed = values[0];
    setSpeedMultiplierRT(ENTONNOIR, playEntonnoir * entonnoirSpeed);
    }
    // :::::::::::::::::::::::::::::::::::: Couronne control
    if(destination == "/couronne/play") {
    playCouronne = values[0];
    setSpeedMultiplierRT(COURONNE, playCouronne * couronneSpeed);
    if(playCouronne == 0) {
    run("setTime "+ COURONNE + " 0");
    }
    }
    if(destination == "/couronne/duration") {
    couronneDuration = (values[0] <= 1) ? 0.001 : values[0]/1000;
    }
    if(destination == "/couronne/speed") {
    couronneSpeed = values[0];
    setSpeedMultiplierRT(COURONNE, playCouronne * couronneSpeed);
    }
    }
    }
    #2825 Répondre
    Anonyme
    Inactif

    Hello Chris,

    Thanks a lot for your reply.
    I downloaded GeoSonix and ran your adapted script without any problem.
    That’s a good start.

    But what makes me perplex is the fact that in my script (in IanniX), the second curve behaves as I tell it : I can change the pattern and it will act accordingly after saving.
    The first and 3rd ones will go on playing one-shot whatever I do.

    That keeps me thinking that there is, I guess in a mysterious place in my system files that I didn’t find yet, some track of my previous scripting errors, because during the scripting process I generated parsing errors due to my begginer’s bad scripting. And these errors concerned the first and 3rd curves.

    I tried to make syntax errors in GeoSonix but this didn’t seem to affect the behaviour when I corrected them back.
    Maybe I didn’t make the right errors … or maybe you corrected the bug by improving the scripting interface in GeoSonix.

    I just tried once again to trash IanniX, remove all the preference files I could find, re-install it and create a new script where I copied-pasted the code of my curves script (without a change because I’m sure it is correct) from TextEdit (external editor, just in case it would matter).
    No way … same thing is happening over and over.

    I am tempted to use GeoSonix for my project (because it seems to work well !), but I stand frustrated and I would really love an explanation of what’s going on here in IanniX.
    Moreover, although you have done a really great work on the scripting part of Geosonix, I would like to continue using IanniX if possible, because I know a bit the people who started and still work on this project, and would like to contribute to its evolution.

    I guess they have little time to spend on this for the moment because they must have other businesses to deal with, so if you have any suggestions that could help Guillaume find the bug, or a fix that could help me get my project back working in IanniX without recompiling, I think that would be a great thing.

    For now I’ll be using GeoSonix because I need this script to work for my project.
    Be sure I’ll keep you informed if I experience any bugs with your software.

    Thank you again,
    Joseph

    #2826 Répondre
    Anonyme
    Inactif

    Hi Joseph,

    I don’t want to take up space on the IanniX list to discuss GeoSonix. I saw that you didn’t have a reply for a while so I thought I’d offer assistance. If you need help or have problems with your GeoSonix script feel free to email me directly at chrisgr99 at gmail dot com we’ll see what we can do to get your project working.

    Regarding the relationship between GeoSonix and IanniX, the GeoSonix code has evolved in a different direction from IanniX as I’ve been pursuing somewhat different objectives: rhythm (e.g. the auto-generated triggers), precise control of note durations (although only in midi so far), integrated harmony processing, simplified scripting syntax with useful defaults for parameters, etc. I see the two projects as complementary. The IanniX team is welcome to borrow ideas from GeoSonix if they find them useful.

    #2827 Répondre
    Anonyme
    Inactif

    Hi,

    You’re right.
    Thanks for your help, and for the precisions about GeoSonix.
    I’ll definitely have a deeper look at it.

    J

5 sujets de 1 à 5 (sur un total de 5)
Répondre à : Does IanniX engine sometimes freeze variables state ?
Vos informations :





© IanniX Association

Qu'est-ce que IanniX ? | Téléchargement | Showcase | Forum | Recherche | À propos