|
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
|
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 » |
|
|
|
|
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
|
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
|
Re: scaling the matrix
« Reply #7 on: Dec 3rd, 2003, 10:13am » |
|
you're welcome
|
|
|
|
|