[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] MultiParameterSpace (alpha release)



Batuhan Bozkurt escreveu:
Hi Miguel,

I've developed a similar plugin for my Hadron system. It does not deal with physics simulations with differential equations or (yet) recorded paths, but I've tried to make it easy on the CPU using some tricks for making the interpolation scheme lightweight. Most of the optimizations deal with precalculating and storing stuff so I won't have to calculate them in each iteration. And there are some gui optimizations that can be done too, for example like disabling clearOnRefresh on views help a lot. Making the calculations on a fixed rate helps too, for example running things with a clock with a fixed wait time (30 times per second for example), but I'm pretty sure you also have a limit for that. You may check the source for it, maybe that will help. It is HrPresetMorph class in HadronPlugins Quark.

A little screencast is here:

http://vimeo.com/5594848


Hi

That looks cool, I will check it out for sure. Can it be used outside Hadron as it is, or is it hadron specific ? What kind of things are you pre-calculating ? Unless I know where the cursor will be I don't see how I can precalculate much ?. It's true that in looped fixed movements I could precalculate everything and then read from an array. But in most of the movements I can't predict where the cursor will go. I have two timers, one for the screen refresh another for the physics/math calculation. the physics/math timer updates a position variable and the screen refresh timer reads from that variable. Both timers are fixed and adjustable from the gui (fps and physics dt).


he calculations don't seem complicated to me, and I'm sure they are tiny compared to what is going inside a synth in the server. So my question is, what is causing this cpu usage ?

One more thing here, they might be tiny compared to the synthesis operations, but your calculations are interpreted in sclang so they are not like UGens in scsynth compiled into a binary. SCSynth is optimized for realtime audio calculations that uses precompiled big building blocks to crunch numbers as fast as possible, but sclang is an interpreted programming language. As with any interpreted language, this introduces a significant penalty for calculations with severity depending on the usage case.

Hope those help a bit...

Batuhan Bozkurt
/* http://www.earslap.com */


Yes, that's exactly what I was assuming, that the sc language being interpreted just isn't made for this kind of semi-intensive calculations.





On Jul 26, 2009, at 3:11 PM, Miguel Negrao wrote:

Hi

The last two months I've been working on management system for a preset system based on SenseWorld's quark ParameterSpace class* and on the ixi quark ParaSpace gui. The objective is to make it easy to assign Synth's arguments to a particular preset in a 2D space. The logical organizataion is through Collections. Each Collection is a 2D space where presets can be saved. At setup time a group of synths is connected to the system, the arguments of the synths can then be assigned to any of the collections, and new collections can be created and deleted through the gui. The position of the preset in the 2D space and of the cursor can be changed by dragging in the Gui. There is also a system to make movements through the space. These can be of 3 types, a recorded movement (using ParaPath, which is a copy from the trajectory class of the WFS system, thanks Wouter !!), a movement defined by a math equation (e.g. (x,y) = (cos(2pift),sin(2pift) ) or a movement defined by a differential equation. I created a Solver class for solving systems of ordinary differential equations of any order. The solving method can be choosen, altough I default on Runge-Kutta order 4 since it's the most widelly used and recommended in the literature. This class is quite independent of everything else to it can be used for anything really (simulate springs, pendulums, chaotic systems, etc)

Although the lib is basically working, I'm having lots of problems with performance/cpu issues. Since I have been basically stuck for the moment I decided to release the code here, even if there is probably one or two bugs still, in the hope that someone can figure out what I can do to solve this.

Basically I'm getting huge cpu usage whenever the number of synths and parameters tracked increases. this comes from 3 places, the gui refresh, the physical simulation calculations and the interpolation calculations. About the screen refresh there's not much that can be done inside sc, and that is more a less under control (10% - 15%). the other two cpu sources easilly get out of control. With something like 20 synths, with 20 parameters each sc just blows up with 100% cpu usage. The calculations don't seem complicated to me, and I'm sure they are tiny compared to what is going inside a synth in the server. So my question is, what is causing this cpu usage ?
1 - My code is not well written and is not optimized.
2 - I have hit the limit of what the sc language environment can do in terms of heavy calculation stuff.


The solutions I can see are not very nice. One would be to rewrite everything in c++, for example with OpenFrameworks for nice visuals and contact with sc via osc. I could also write everything as language plugin, using the new system released recently. finally I though of implementing the calculations with a synth running in the server at control rate with a lot of outputs (one per parameter per synth) and then connecting those outputs to the correct synth. the first two options are not really options for me, because I'm very amateur at writing c++ code, I can compare code and change this or that, but I can't really write something like this from scratch. So this leaves me with the third option. Any other suggestions ?

pic: http://www.friendlyvirus.org/files/Imagem%203.png
code: http://www.friendlyvirus.org/files/MultiParameterSpaceEditor.zip

there's an rtf file with an example.

cheers,
--
Miguel Negrão // ZLB
http://www.friendlyvirus.org/artists/zlb/


* Basically I copied the entire class and adapted it such that everything is an array, so that it becomes easy to track several synths at the same time. This lib uses adapts code from SenseWorld's ParametricSpace class, from the ParaSpace gui from ixi Quarks and from the WFS library WFSPath class from Wouter Snoei. Thanks !!

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/




--
Miguel Negrão // ZLB
http://www.friendlyvirus.org/artists/zlb/

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/