How Max's remote messaging works

    Jan 11 2014 | 11:09 am
    Hello folks,
    I am currently working on a project that uses Max with FTM library and I want to send fmats trough send/receive objects. The problem is that FTM has a garbage collector that automatically destroys the object if it is not referenced by any FTM object.
    So to develop bug free patch I need to understand how Max's scheduler handles remote messages. Is there any difference for the scheduler when to objects connected directly with patchcords or when they are connected through send/receive pair?
    P.S. Is there is a paper which describes in detail how scheduler works? Maybe some specification?

    • Jan 11 2014 | 3:12 pm
      I cannot help you with explaining how the scheduler works, but why do you want to send fmats through send/receive objects if you can just address them anywhere by creating a ftm message stating the desired fmat. Even if you want to use fmat in multiple patches you can make the fmat global in the inspector.
      so lets say you have a ftm fmat object called myFmat, you can 'receive' it anywhere in your patch by creating a the fmat message '$myFmat' and banging it
    • Jan 11 2014 | 7:13 pm
      Hi Tim,
      this is certainly one of the possible ways to do this, but dynamically generating ftm.mess object contents is not CPU-efficient (see FAQ) and in my patch a lot of fmats can be generated.
      I also asked this question to the FTM mailing list and guys over there answered that in Max "messages are processed depth-first, going through any send-receive and inlet-outlet pair, until the last node, unless a delay (ie. [pipe], [delay]) or a change in priority (ie. [deferlow], [jit.qball]) occurs". This means this is safe to send fmats with some exceptions though.
      But in fact I'm now considering to change the way how my patch is dealing with FTM objects to make it more robust. Maybe creating some kind of big dictionary (or mat) with access methods (like in CataRT) could be a better way to handle a lot of fmats (a little improved version of your proposal).
      Anyway thanks for help!
      Best, Evgeny
    • Jan 13 2014 | 8:04 am
      Right i understand the problem, i've had the similar problem once, learned it the hard way. had to rewrite my all of my patch. my solution (since i'm a mediocre programmer) was to redifine fmat's instead of generating new ones
      Anyway good luck!
    • Jan 14 2014 | 7:01 pm
      I'm just curious, for what kind of tasks are you usually use FTM?
    • Jan 16 2014 | 12:52 pm
      Well mostly to be able to handle large matrices in max, since max is a bitch with in that particular area. It really depends on what i want to do with the list/matrix and based on that i'll either write a javascript list, or a FTM mat.
      The last project i've used FTM was in a little program i made for normalizing a large amount of audio files. I've made some music and soundFX for a game (an audio book kinda adventure game see for more info). It's an ongoing story but it has lots of separate audio files. At the end i wanted to normalize the files, but not all of them. i wanted to normalize them relatively to each other (some of the audio files were background noise, which had a maximum amp of 0.1, don't wanna normalize that off course). So i wrote a maxpatch where i could drop a lot of wavs, put them in a ftm dict, find the maximum amplitude of the bunch, and amplify all the audio files with the same factor.
      I could show you the patch if you're interested
    • Jan 24 2014 | 4:41 pm
      Hi Tim,
      sorry for my long reply. Yes, show me your patch, please. It's always interesting to hack someone's patches.