[[https://flattr.com/submit/auto?user_id=marierm&url=https://github.com/marierm/mmExtensions&title=mmExtensions&language=en_GB&tags=github&category=software][]]
This repository contains the files required to use to the PresetInterpolator class.
mmPresetInterpolator is a Quark. It can be installed from within SuperCollider using this command:
Quarks.install("https://github.com/marierm/mmPresetInterpolator.git"); // uninstall it Quarks.uninstall("https://github.com/marierm/mmPresetInterpolator.git");
- SenseWorld DataNetwork Quark (by Marije Baalman)
- wslib Quark (by Wouter Snoei)
- ddwGUIEnhancements
- crucial library
PresetInterpolator() is a preset interpolation system similar in concept to the Metasurface found in AudioMulch (created by Ross Bencina) or the max patch SpaceMaster (by Ali Momeni and David Wessel). There is an important difference, though: PresetInterpolator() can interpolate spaces of any number of dimensions.
Interpolator() is the interpolation system used by PresetInterpolator(). It does not do much: it simply outputs weights.
These classes are not documented yet, but here are a few notes to get you started.
There is only one parameter to Interpolator: the number of dimensions. This creates a 2D interpolator:
x = Interpolator(2); x.gui; // nice GUI.
- The (bigger) grey dot is the cursor.
- The colored dots are the data points.
- The size of the transparent circles around the data points is proportional to the weight of that preset.
- Double-click in the area to create a new data points (which is associated to a new Preset).
- Alt-shift-click deletes a data point (and its associated Preset).
- Alt-click and drag to duplicate a data point (and its preset);
- Alt-click and drag also works on the cursor (the grey point);
- Double-click on a data point to edit the Preset;
A PresetInterpolator takes an Interpolator as an argument. If no argument is provided, a 2D Interpolator is created for you.
y = PresetInterpolator(x); y.gui;
There is a row for each data point. Here is a description of the columns:
- The preset name. (Pressing enter after editing the textField is required).
- The Attach button. This button attaches the data point to the cursor. Every time the cursor is moved, the attached point follows it. This is useful to position a point in a multidimensional space using an interface. There will be an screencast of an example soon.
- The Edit button. Opens the corresponding Preset window.
- The data point id (an integer).
- The data points coordinates. (The number of coordinates equals the number of dimensions of the Interpolator instance.)
- The Remove button (X).
- The weight of the data point.
The last row is different: it shows the status of the cursor (or interpolation point).
- Cursor
- Edit button. Click this button to view the result of the interpolation.
- A menu for each coordinate.
- 2D Gui” button: creates an interpolator GUI (2D).
The PopUpMenus have 3 possible values: nothing, x, y. They are used to select which coordinates will be used by the 2D GUI. This is useful to visualize multidimensonal data.
- Click on the Add to add more parameters. The presets can have any number of parameters and these parameters can represent anything. All Presets in a PresetInterpolator will always have the same number of parameters.
- Click on the triangle to edit the parameter’s ControlSpec.
- Click on the none button (below OSC) to set the OSC settings of the parameter.
- Parameters can be named.
Each Preset of a PresetInterpolator always have the same number of Parameters. Changing the Spec or the name of a Parameter will change the spec or the name of the corresponding Parameters of the other corresponding Presets. Example: if I rename the third parameter of a Preset to “foo”, the third parameter of all Presets will be renamed “foo”.
y.cursor; // this 'preset' represents the cursor
When adding an action to the currentPreset’s parameters, moving the cursor does something!
( y.cursor.parameters[0].action_({|mapped, unmapped| "Parameter 0: ".post; mapped.postln; }); )
Each parameter has a ControlSpec (it can be edited in the GUI as well)
y.cursor.parameters[0].spec_(ControlSpec(20,20000,\exp)); y.cursor.parameters[0].spec_(\midi); //this works too.
// Proper doc is on the way.
It is not a planetary model (weight = inverse of distance). It is not natural neighbour interpolation (like Ross Bencina’s Metasurface). It is based on intersecting circles. Here is how it works (briefly):
1- A (invisible) circle is drawn around each points (including the cursor). The radius of each circle is equal to the distance to the nearest neighbour. This means that the size of the circles varies when points are moved.
2- The points which have a circle that intersects the cursor’s circle have a non nil weight. (Not all points do, but at least one does.)
3- The weight of each point is calculated like this:
(intersecting area of the 2 circles) / (total area of the circle).
4- Then we do a weighted sum for each parameter using these weights.
It works in spaces with more than 2D (I tried up to 10D). There is a paper available here:
http://www.nime.org/proceedings/2012/nime2012_159.pdf
Martin Marier