We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Faking gesture/pattern recognition
Pages: 1 2 
Faking gesture/pattern recognition (Read 3742 times)
Faking gesture/pattern recognition
Jan 17th, 2007, 1:10pm
 
I am developing a project wherea user basically needs to draw patterns (via mouse) and these are converted into sounds. The patterns are like basic shapes of squares, circles, traingles etc.

I have been researching pattern/gesture reconition and think it may be slightly out of my league so I am wondering if anyone can think of anyways on how I could fake it? or find another way to do this.

I would be really grateful for any help.
Re: Faking gesture/pattern recognition
Reply #1 - Jan 19th, 2007, 10:09pm
 
How about converting the drawing to points/lines and then creating sound depending on length and slope of those lines?
Re: Faking gesture/pattern recognition
Reply #2 - Jan 20th, 2007, 11:53am
 
I was thinking along the same lines but not too sure what sound library to use. Any ideas? I basically just want to call in a note and then manipulate it's tempo, pitch and according to the points.
Re: Faking gesture/pattern recognition
Reply #3 - Jan 20th, 2007, 10:44pm
 
Ess and Sonia are both good options. Try them out.
Re: Faking gesture/pattern recognition
Reply #4 - Jan 23rd, 2007, 4:37pm
 
I was thinking of using jmetude as by the looks of the library I will be able to manipulate notes of sound better. Does anyone have any experience with this library?
Re: Faking gesture/pattern recognition
Reply #5 - Feb 6th, 2007, 5:04pm
 
How would you go about measuring the slope of a line?
Re: Faking gesture/pattern recognition
Reply #6 - Feb 6th, 2007, 5:12pm
 
angle=atan2(yDifferenceStartEnd,xDifferenceStartEnd);

Where x/yDifferenceStartEnd is the difference in x and y values form the start to the end of the line or line section.
Re: Faking gesture/pattern recognition
Reply #7 - Feb 11th, 2007, 4:31pm
 
Thanks!

Another question is - my project is based on mouse movement and I was wondering if there was a way to create like a light drawing effect? so that when the mouse is moved it is followed by a pattern of light.
Re: Faking gesture/pattern recognition
Reply #8 - Feb 11th, 2007, 6:15pm
 
http://processing.org/learning/examples/storinginput.html

Wink
Re: Faking gesture/pattern recognition
Reply #9 - Feb 21st, 2007, 9:30pm
 
Is there a way to take that code and modify it so that the circle is a random colour each time?
Re: Faking gesture/pattern recognition
Reply #10 - Feb 22nd, 2007, 4:17pm
 
Code:

int num = 60;
float mx[] = new float[num];
float my[] = new float[num];

void setup()
{
size(200, 200);
smooth();
noStroke();
fill(255, 153);
}

void draw()
{
background(51);

// Reads throught the entire array
// and shifts the values to the left
for(int i=1; i<num; i++) {
mx[i-1] = mx[i];
my[i-1] = my[i];
}
// Add the new values to the end of the array
mx[num-1] = mouseX;
my[num-1] = mouseY;

for(int i=0; i<num; i++) {

// Put changes to colour just before drawing the circle

fill (random(255), random(255), random(255));

// Try basing it on the number of the circle by uncommenting this next line

// fill((random(100, 255) / num) * i, (random(100, 255) / num) * i, (random(100, 255) / num) * i, (255 / num) * i);

ellipse(mx[i], my[i], i/2, i/2);
}
}
Re: Faking gesture/pattern recognition
Reply #11 - Feb 22nd, 2007, 11:26pm
 
yay! thank you! looks great now.
Re: Faking gesture/pattern recognition
Reply #12 - Feb 23rd, 2007, 10:01am
 
angle=atan2(yDifferenceStartEnd,xDifferenceStartEnd);

Where x/yDifferenceStartEnd is the difference in x and y values form the start to the end of the line or line section.

sorry but I haven't done math for ages...If you draw a square without releasing the mouse how does this tells you that it's a square ?

E
Re: Faking gesture/pattern recognition
Reply #13 - Feb 23rd, 2007, 11:07am
 
You combine it with 'dist' which tells you the distance between X and Y and basically take some educated guesses that if there are 4 lines of similar length and slop then it must be a sqaure.

It's not the most full proof of systems but it works for me.
Re: Faking gesture/pattern recognition
Reply #14 - Feb 23rd, 2007, 4:39pm
 
do you have some example code ?

E
Pages: 1 2