FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   scaling the matrix
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: scaling the matrix  (Read 479 times)
christian


scaling the matrix
« on: Nov 25th, 2003, 10:26pm »

hi over there,
could somebody be so kind to explain me how to
scale, rotate, zoom the created "rect.pattern"?
this code just draws (maybe even not that) the  
rects, and i dont know how to really have these  
objects to work with further.
that would help me a lot.
thanks
+christian
 
// based on Keyboard Functions by REAS  
// Modified from code by Martin
// Original 'Color Typewriter' concept by John Maeda
//  
 
 
int x = 0;    // X position of the letters
int y = 0;    // Y position of the letters
float rX, rY, rZ;
int max_height = 20;
int min_height = 20;
int letter_height = 20; // Height of the letters
int letter_width = 20;  // Width of the letter
 
int numChars = 26; // There are 26 characters in the alphabet
color[] colors = new color[numChars];
float[] spectrum;
float binSpeech, binPraesence, binBass;
float mausescale;
float dB;
float []bin;
 
void setup()
{
  liveInput.start(12;
  spectrum = new float[128];
  size(800, 600);
  //noStroke();
  strokeWeight(0);
 
  // Set a gray value for each key
}
 
void loop()
{
  //clear();
  getSpectrum();
  float dB = float(liveInput.getLevel());
push();
  // Everything happens in this program when
  // a key is pressed, so all actions are
  // diverted to the keyPressed() method below
 
  // if the key is between 'A'(65) and 'z'(122)
 
  // Draw the "letter"
  int y_pos;
  if (letter_height == max_height) {
    y_pos = y;
    stroke(0,0,0, binPraesence/10);
    strokeWeight(1);
    fill(255, 255, 255, binPraesence/10);
    rect( x, y_pos, letter_width, letter_height );
     
     
     
  } else {
    y_pos = y + min_height;
    rect( x, y_pos, letter_width, letter_height );
    fill(dB*255);
    rect( x, y_pos-min_height, letter_width, letter_height );
  }
 
  // Update the "letter" position
  x = ( x + letter_width );  // set x to ( x + 5 )
 
  // Wrap horizontally
  if (x > width) {
    x = 0;
    y+= max_height;
  }
 
  // Wrap vertically
  if( y > height ) {
    y = 0; // reset y to 0
  }
  pop();
 
}
 
void getSpectrum(){
  spectrum = liveInput.getSpectrum();
  for ( int i = 0; i < spectrum.length; i++){
    //bin[i] = spectrum[i];
    binBass = spectrum[1];
    binSpeech =  spectrum[3];
    binPraesence = spectrum[10];
    //println(bin10);
  }
}
 
public void stop(){
  sonia.stop();
  BJSyn.stop();
  super.stop();
}
 
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: scaling the matrix
« Reply #1 on: Nov 27th, 2003, 5:46am »

hi christian,
 
you can perhaps enclose scale() and/or rotate() within push() and pop(). you might also want to store the inputs in an array of sorts so that when you do the translations, you can redraw everything.
 
looking forward to your typewriter with sound have implemented sound before but not using sonia...
http://decode.ateneo.edu/martin/colortype/ColorTypewriter.html
 
cheers,
martin
 
christian


Re: scaling the matrix
« Reply #2 on: Nov 27th, 2003, 12:47pm »

hi martin
 
this is not about a sound typewriter,  
it is part of basic studies in  
a project about how to map sound.
so as far as i am not a programmer but
a designer, i sometimes need
to get some code advice. thats it.
so if you want to, might you help me a bit,
i have little experience with lists in director,
no experiences with handling arrays in p5.
 
thanks christian
« Last Edit: Nov 27th, 2003, 12:49pm by christian »  
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: scaling the matrix
« Reply #3 on: Nov 27th, 2003, 2:36pm »

oh. hmm. could you expound on how you'd want to map the sound?
 
re: arrays, you might want to look into Vectors instead. they're a little easier to use since you have an expanding array.
 
here are two links that might help you get started
http://aegis.ateneo.net/cs21a/cs21-a-L10-Arrays.ppt
http://aegis.ateneo.net/cs21a/cs21a-L11-OddsEnds.ppt
 
christian


Re: scaling the matrix
« Reply #4 on: Nov 27th, 2003, 4:39pm »

thanks for the links, martin.
 
an idea was to map percussive and classic music:  
so that a synchonicity (rigth?) can be produced for
an plus of understanding structures.
 
the advantage was to recognize complicated structures
of compositions, for percussion, the growing rhythmic
patterns should be interesting. mainly, i am in the
conceptional phase of the project rigth now, so these
are first ideas. i think theres a lot to do in this  
direction...
 
greets
christian
 
 
ps: .pps is poor power point format, isnt it?    
     unfortunately,i have to "borrow" it first  
 
     somewhere....
« Last Edit: Nov 27th, 2003, 4:42pm by christian »  
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: scaling the matrix
« Reply #5 on: Nov 28th, 2003, 3:47am »

ah, looking forward to what you whip up.
 
re: ppt, just use openoffice.
« Last Edit: Dec 3rd, 2003, 10:12am by Martin »  
christian


Re: scaling the matrix
« Reply #6 on: Dec 3rd, 2003, 12:22am »

thank you, martin.
 
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: scaling the matrix
« Reply #7 on: Dec 3rd, 2003, 10:13am »

you're welcome
 
Pages: 1 

« Previous topic | Next topic »