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.
Page Index Toggle Pages: 1
Pitch shifting (Read 664 times)
Pitch shifting
Apr 27th, 2007, 5:52am
 
I'm a beginner, and I try to make pitch goes up and down.
It seems simple, but I can't figure out.

Here is my code, and when I press key 'a', pitch goes up,
but when I press key 'b', pitch doesn't go down(still goes up). Anybody can help me please?

-----------------------------------------------------------

import krister.Ess.*;

AudioChannel  myChannel4;

PitchShift myPitchShift;

int shift;

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

 Ess.start(this);

//  myChannel3=new AudioChannel("news.aif");
 myChannel4=new AudioChannel("yaa.aif");
//  myChannel3.play(Ess.FOREVER);

 myPitchShift=new PitchShift(Ess.calcShift(1));

 
 shift=5;
 
//  frameRate(30);

 stroke(255);
 fill(255);
}

void draw() {
 background(0,0,255);
//  rect(0,500-shift,256,shift);
 
 if (keyPressed==true) {
   if (key=='a'){
   myPitchShift.filter(myChannel4);  
   myChannel4.play();
   shift+=1;
 }
 if (key=='b'){
   myPitchShift.filter(myChannel4);
   myChannel4.play();
   shift=shift-1;
 }
}
}
public void stop() {
 Ess.stop();
 super.stop();
}
Page Index Toggle Pages: 1