Issue with javascript and [play~] object

    Dec 26 2013 | 11:06 am
    I have been working on a solution based on the [play~] object. However I have had challenges with "clipping" so I have designed a solution where the aim was to generate an envelope at the beginning and at the end of the playback of the segment. However I have not been able to get this to work using javascript and clipping is still occuring.
    Here is the code:
    // inlets and outlets
    inlets = 1;
    outlets = 1;
    var tskOneFragment;
    function playOneFragment(){
    line1= this.patcher.getnamed("sn_line1");
    play1 = this.patcher.getnamed("sn_play1");
    tskOneFragment = new Task(fade, this);
    //----Set line object to 0
    //----start playback of fragment (play from 300ms to 800ms
    //and use 500ms on the operation)
    //increase envelope to 1 using 20ms on the operation
    //playback should have started giving a nice fade up
    //----Fade before the fragment ends
    tskOneFragment.interval = 450;
    function fade(){
    var iter= arguments.callee.task.iterations;
    //Need to use iter=2 because task first run is immediate
    //Fade clip should end playback 10ms before fragment playback ends

    • Dec 26 2013 | 11:12 am
      you wont be able to trigger objects at precise time im afraid . JS is not good at time related operations , i would nor rely on this . maybe this is issuing your clicks . can you recreate MAX equivalent circuit of that introduced in JS to prove the difference ? .
      edit : but im not sure if it is causing your clicks , i cant check your max patch to be sure . im just guessing that JS in an issue as ive experienced it before already ,trying to do similar things .
    • Dec 26 2013 | 12:54 pm
      I believe the clicks are caused by the fact that the wave might be raw cut using a fragment play - hence I need the envelope. I guess one option would be to create the logic in pure JAVA - do you know if it is possible to use this style in pure JAVA or is it JS only?
      line1= this.patcher.getnamed(“sn_line1″);
    • Dec 26 2013 | 3:38 pm
      im sorry , i dont know anything about JAVA in relation to MAX