What is this?

MetaSurface is a library for processing that allows you to easily control multiple parameters and whole sets of those. Additionally you can fade smoothly from one set to another, record changes of settings over time, play those back again and export your sketch to video. If that description wasn't helpful at all you might just want to try the demo below.

Getting Started

First download the latest version and extract it to sketch-folder/libraries/. (Re-)start Processing. If everything went okay you should now have a few examples in
File » Sketchbook » Libraries » Examples » MetaSurface.

Command Reference

metaSurface = new MetaSurface(this, labels[], minValues[], maxValues[], defaultValues[] )
Creates a new metasurface object.
metaSurface.values[i]
Access the current value as set by the metasurface
metaSurface.open( "filename" )
Opens a file with user-generated parameter sets. The user has an open button to do the same, but you can use this to present a default option.
If you pass null an open-dialog will be shown to the user.
metaSurface.save( "filename" )
Saves a file with user-generated parameter sets. The user has a save button to do the same, but you can use this to save the settings automatically (for instance when the sketch exits).
If you pass null the currently opened file's name will be used for saving.

Thanks, attribution and such...

As one might have figured this project isn't all that unique. Even more so, it was created when I needed something like Audiomulch's metasurface, but to control a processing sketch instead of an audio patch (har har).
So a big thanks also goes to Francesco Meneghini, who led the original project that resulted in this code, for letting me open source the it.

Example Usage

import metasurface.*;

// If you don't want to use the "export sketch to movie" functionality
// built into the metasurface disable the following line: 
import processing.video.*; 

float t; 
float rotX, rotY; 
float rotXSpeed, rotYSpeed; 
float amplitude;

MetaSurface surface; 

void setup(){
  size( 200, 200, P3D ); 

  // Create the meta surface object
  surface = new MetaSurface(
    this, 
    new String[]{ "Rotation speed X", "Rotation speed y", "Amplitude" }, // Labels
    new float[]{ -.1, -.1,  0 },  // Minimum Values
    new float[]{  .1,  .1, 90 },  // Maximum Values
    new float[]{   0,   0, 90 }   // Default Values
  );
}

void draw(){
  rotXSpeed = surface.values[0];  // Access first value
  rotYSpeed = surface.values[1];  // Access second value
  amplitude = surface.values[2];  // Access third value
  
  // now do some drawing with those parameters
  background( 255 ); 
  
  lights();   
  noStroke(); 
  fill( 150 ); 
  t += 0.1;
  rotX += rotXSpeed; 
  rotY += rotYSpeed;  
  
  translate( width/2, height/2 ); 
  rotateX( rotX ); 
  rotateY( rotY ); 
  for( int x = -50; x < 50; x += 5 ){
    for( int y = -50; y < 50; y += 5 ){
      pushMatrix(); 
      translate( x, y ); 
      box( 5, 5, f( x, y ) ); 
      popMatrix(); 
    }
  }
}


float f( float x, float y ){
  return amplitude * sin( x + t ) * cos( x*x ) * cos( y/4 + t ); 
}

Feedback

Hansi 21 Oct 2008, 21:28 Enjoy!
Ross Bencina, http://www.audiomulch.com 5 Nov 2009, 04:53 You might want to reconsider the name of this class since it doesn't seem to represent the same concept of user modifiable natural neighbour interpolation implemented by the AudioMulch Metasurface.

Bencina, R. (2005), “The Metasurface – Applying Natural Neighbour Interpolation to Two to Many Mapping,” Proceedings of the 2005 Conference on New Instruments for Musical Expression (NIME'05), Vancouver, pp 101 – 104.




$img = imagecreate( 100, 35 ); $white = imagecolorallocate( $img, 255, 255, 255 ); $black = imagecolorallocate( $img, 0, 0, 0 ); imagefill( $img, $white, 0, 0 ); imagettftext( $img, 22, 0, 15, 35, $black, realpath( "f_bm_neco.ttf" ), $_SESSION["ANTI_SPAM"] ); ob_start(); imagepng( $img ); $content = ob_get_contents(); ob_end_clean(); echo ""; ?>