How Max's remote messaging works
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?
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
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!
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!
I’m just curious, for what kind of tasks are you usually use FTM?
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 storkinators.blogspot.com 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
sorry for my long reply. Yes, show me your patch, please. It’s always interesting to hack someone’s patches.
Forums > MaxMSP