Here is the code:
// inlets and outlets
inlets = 1;
outlets = 1;
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;
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
<code>-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 640.3ocyW9saaBCEF+ZpTeGr3xIJBCIAZuq6hc6d.llhLAGpiLFjsIKcUqO6 y+IPhZCTOZVTtABmyw1e7iOef7xs234mWuCK7AO.9Avy6EUDOSLcDut.d9Un cqnHgoP+JrPfJw9A6SJw6jlDbLpnOZcqjhkxmav1Y22G7ytbqqYRFpxjw+QN AQ6GFovDrNeycI8AaPxUOQXkK43UR6zEGGENO.jMOLJ.jrPeDlEFcXMXsUDl RAFMGe7JKH+1rxvX0nNTsUvlxgln+41azmUmBblML7uTR+8nog1VpVfWGFOB RISyg9eMFt.eslVbJlAGEZv4yr3xxKMvl.1hFBawSFaCZoZnnm+NC+MNprBy jSzcMLtfihKk6R4whmM2hqjqcW1FAPCr6VoVedMMbi3bCrLW3UpkWQFWlZe5 P7B9OxqtvBzVbwRkbTq7RjTxI4sRaWLuCHSMsDJt+9Z.vnuQ3pZjX9RUw4TS 0Q1j6e1bVeF8kOtGvjdxD6xFeCbAIQm288mMi7VDu+tUvVRILL78DTGFDENh 0NXBus49YiBvEFOcLLUeJ89O.fIWpFmiCPsmGd5lpuBDnpF5Q7cj2HkiXkSy Ul.cvVBSgNQU30AUyaWuFyOAWsIbfrqo0H4mCryRG+qif5NwvDCRyR++BV6r Z1W91OkznMch2faQcKeUGN519ANReEXgjvPRRM6npTM4.vCE8Don.ax2qzBh P2Du3PW7SZ.bVWYWmxRuuxMcEcY0kKxR6cuv5J1EcASth00k0eAcxek8o309 1FnllsXtX+Lakjpc7lZt95EA1qIL601VUp+p4VR2Prur0GwUcAkpVfsbaCzc YK7UYLKn5veAP++VnB -----------end_max5_patcher-----------
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 .
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?
im sorry , i dont know anything about JAVA in relation to MAX