import pitaru.sonia_v2_9.*;
Sample forwardTune;
Sample reverseTune;
boolean direction = true;
void setup(){
size(200,200);
Sonia.start(this);
forwardTune = new Sample("noise14_rs.wav");
int dataLength = forwardTune.getNumFrames();
float[] forwardArray = new float[dataLength];
forwardTune.read(forwardArray);
float[]backwardArray = new float[dataLength];
backwardArray = reverse(forwardArray);
reverseTune = new Sample(dataLength);
reverseTune.write(backwardArray);
forwardTune.play();
forwardTune.repeat();
fill(255);
ellipse(width/2,height/2,100,100);
}
void draw(){
}
void mousePressed(){
if(direction == false){
direction = true;
reverseTune.stop();
forwardTune.play();
forwardTune.repeat();
fill(255);
ellipse(width/2,height/2,100,100);
save("115.jpg");
}else{
direction = false;
forwardTune.stop();
reverseTune.play();
reverseTune.repeat();
fill(0);
ellipse(width/2,height/2,100,100);
}
}
public void stop(){
Sonia.stop();
super.stop();
}
コメント
コメントを投稿