[comparison] transratio vs. expr / speed test
ive heard somewhere that [expr] might be expensive for some sort of operations .
well seems like its still the best solution to convert "midinotes" to "ratio" required by audio objects .
if someone know the solution that will win over the [expr] , please post it here !
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1741.3oc6asrjahCEcsSU4efhZVjjwwERhmyTyh4CX9BRR0EFjcSBFn.4Ndl tx+9nG.Fv7PzgF2owaLfjP5pit5nqNH+3aeyJ0swmvYpJ+gxmTVs5QZJq3ow RYUQBqTO3dxKzMiWPUu3CGvQD004YRvmH7LRNRTBhHwz6wmR170LkcAg3xxk 3R7tOHZ+coXOhnIsAfMZqU.FFhK1rKPsMZJeo3sB740c71u9QqxpJ53gfnPL gaPfhT2EGQxB9OLOQHspNW53ijhhqU0t8hCiSE1h1FSfgos4Z5cFFPGc.6Na nktA8NPUaZW59s7p5bavZ6H2C71V8uSCbCU447i29F1U5k0+7.7+3RteCEZe 2FMCKKSHzz32O899.XCKyMFTqGjCvN8BvlOy.rECeQLXEwvWHGf0Q.j0KD.l j5Fkk5RBh6CTQVvJfpoduXpwRGSo9qoJMbZ+scfdca0Q07Z05Eg0W5Hr6QR7 2Yfnxeo.9yOGIvf7Gx6h4O84ncGi7n92QJGx1eGks9cmd+izzIO3RGknkpEN lOb58rWkHpp2osFyd9GkFRXPD1K9XD2Zbjft2pJcO.A5XfEMsCrOyCO6BioM boISwyxZll9gdWGzTGxcwyYT3+BQUgkD2TZsQvo2gib2Fhq0ypfYfQMaPuKP CVjrHMx+lfEVJqa5R8AUT25FsWshy+DBkQ3uS6KsDfgDXXtyEBdIFVElLdhv TMlghfCnbDz0DLL3LCHVrCMXFpCtfNA29wyZcdbZNBV.gzWgFs0C3zL5r6pM yJU2jjJoup5KwP9uJ5QlqOmVPjHMsyokheHnnJrySkMpVzHmGI.1bBaCMdzF 5N7o4HspHB0EXeXr22v90ZE03DLk9JIEmQY5XqCGUOee7N2igj65X3odA145 g690aGbWotO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c8UaqepxaIJlVhfo0AWoMLDRJCSa9MLV3efgLrll +bYXvAMLv0wvFbnDcEFJAxXXrOER0A74vvzj1vlWDqYS1wPo07aXVRgXFyug IGA67OqjcbpGlt.htNF1vHl80wvFj4GbE7wjasRqYmGCJGyu47iXxw7CmeCS SZCadGJARw7CmedLtgMLOl10wvFltX9IXaRc1CcwLaXRsHNX9oK.xQvN+zE. o3wPCaX0+FLqq8CPC3XV0Q9pzIf5SZm3PfeRLcm2YEZwwTeygKUogEn3gqcm F3LWcZDvdbc5b0GZb5D382lmJglmHgKNMB7Zk9y+CuHkPi. -----------end_max5_patcher-----------
LUT? just shot in the dark, though
yes Andrzej ,good suggetsion , but what about interpolation then
to be honest – i don’t know. The easiest would be if [peek~] had an interpolation implemented (*** @cycling74: FR!!!! ***). But for now you have to do it yourself. I lastly learned about FTM – I don’t know if there is any ready solution, but it seems it’s worth checking. Or if you don’t need very smooth transitions (for which you would have to do all calculations in signal domain anyway) just make the table large enough.
:) … thank you Andrzej , i wanted to know about the other solutions anyway . its not bad that something has some difficulties , its all about to know what others may see as a substitution ,there might be some gems hidden or evils . brainstorming .
in my case [expr] has very good results and does the natural interpolation . but i wouldnt mind to experiment with look ups ,there might be reasons for it ,so thanks again for pointing that out . need to check how much costs are required by doing interpolation yourself only .
IMHO, comparing efficiency on something like that is not worth the trouble. The difference of a few micro seconds won’t matter until you’re doing that at very fast rate (which you’re not since you’re doing this operation on messages). I always advice my student to focus on readability vs efficiency.
Also if you want to compare the efficiency, you might want to do the operation more than once, otherwise you measure mainly the rest of the patcher than the specific object. Using uzi 10000 gives a better idea.
#2 js is faster, but runs in low priority that’s why you need to wait for the process to be done, in order to trigger the next thing (see the extra outlet)
hi Emmanuel ! . thank you for the clarification , ive learned two new things here .
Also , considering that JS result , the number is higher because of the "crossing" time that is required for the outlets , right ?
Does it also means that i do not need to be afraid of doing maths and checking conditions inside JS ?
Yes, going in/out of js is slightly slower than with normal objects. You shouldn’t be afraid with js at all ;-) It’s pretty fast, runs with high precision (64 bits numbers, instead of 32 bits for Max). Don’t forget though that it runs at low priority.
well in short, for doing transratio operation… I would just use the abstraction, it comes with Max and it’s really fast.
:) great to know !
as for the abstraction .
well, my engine needs to use that exponential result not just for the pitch . At first it provides the pitch but later on it is used for some loop calculations (for the groove~) to mimic "looping regions" .
as from this and other lessons i would love to stay in JS for the pitch and other calculations thats need to be computed for the [groove~] , to minimize inlet/outlet crossing as much as possible .
as for tests .
Ive been doing comparisons basing on decimal points to see if im crossing the threshold of 1ms per operation , i believe that the whole thing (from pressing the KEY and hearing the result) should happen under this threshold . now i know how the get the correct order with advantage of low priority thread .
Forums > MaxMSP