Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pitaru.sonia_v2_9.*;
- //vars//////
- int count = 0;
- int gesamt = 0;
- int endpuffer = 200000; //to be cut off later
- int deltime = 1000;
- int mergetime = 100;
- float faktorhoch = 1.02;
- float randomtime = 1;
- int roundedrandomtime = 0;
- float[] inputfloat; //in float
- Sample input;
- Sample output;
- int[] selection;
- float[] transfloat; // übertrag
- //pending
- ///////////////
- /*
- x² = (y - a - b)/z
- x = quadwurz((y - a - b)/z)
- samples = sqrt((input.getNumFrames() - deltime - endpuffer)/faktorhoch)
- */
- void setup() {//runs once
- println(sqrt(4));
- Sonia.start(this);
- input = new Sample("CaliforniaWaiting1.wav"); //////INPUTFILE
- println("-frames = " + input.getNumFrames());
- inputfloat = new float[input.getNumFrames()]; //creates a new array the length of the sample
- input.read(inputfloat);
- selection = new int[round(sqrt((input.getNumFrames() - deltime - endpuffer )/faktorhoch))];
- for (int samples=0; samples < (sqrt((input.getNumFrames() - deltime - endpuffer )/faktorhoch) ); ++samples) {// choose places for deletions.
- selection[samples] = (round((input.getNumFrames() - deltime - endpuffer + 1 ) - (samples*samples*faktorhoch)) + mergetime);
- print(selection[samples] + "; ");
- }
- frameRate(999);//per second
- ///////////pending
- /*
- for (int zounds=0; zounds < input.getNumFrames(); ++zounds) {// zounds "adress"
- mergefloat[zounds] = 0; //initialise track
- }*/
- gesamt = (round(sqrt((input.getNumFrames() - deltime - endpuffer)/faktorhoch)));
- println("-setup done");
- noLoop();
- }
- void draw() {// frame by frame
- println("was da? " + inputfloat[round(inputfloat.length/2)]);
- println(count + " " + selection[count] + " sellength:" + selection.length);
- transfloat = new float[(inputfloat.length - deltime - mergetime)];
- for (int zounds=0; zounds < (selection[count] - mergetime) ; ++zounds) {// zounds "adress" ///transfare untouched start
- transfloat[zounds] = inputfloat[zounds];
- }
- for (int zounds=(selection[count] - mergetime); zounds < selection[count] ; ++zounds) {// zounds "adress" ///fade
- transfloat[zounds] = (((inputfloat[zounds])*(1-((zounds - (selection[count] - mergetime)+1)/mergetime))) + ((inputfloat[(zounds + deltime + mergetime)])*((zounds - (selection[count] - mergetime)+1)/mergetime)));
- }
- for (int zounds = (selection[count]); zounds < (inputfloat.length - deltime - mergetime) ; ++zounds) {// zounds "adress" ///transfare untouched end
- transfloat[zounds] = inputfloat[zounds + deltime + mergetime];
- }
- inputfloat = new float[transfloat.length];
- for (int zounds=0; zounds < (transfloat.length) ; ++zounds) {// zounds "adress" ///transfare untouched start
- inputfloat[zounds] = transfloat[zounds];
- }
- ///////////pending
- //////////////////////////////////////OOOOLDmerge/////////////////////////////////////////////////
- /* for (int zounds=0; zounds < input.getNumFrames(); ++zounds) {// zounds "adress" ///volume down merge
- mergefloat[zounds] = (mergefloat[zounds]/count*(count-1));
- }
- for (int zounds=0; zounds < input.getNumFrames(); ++zounds) {// zounds "adress"
- if(zounds - randomint >= 0){
- magic = zounds ;//- randomint + input.getNumFrames();
- pufferfloat[magic] = pufferfloat[magic] + ((inputfloat[zounds - randomint])/count);
- } else {
- }
- }
- for (int zounds=0; zounds < input.getNumFrames(); ++zounds) {// zounds "adress"
- if(zounds - randomint >= 0){
- } else {
- magic = zounds ;//- randomint + input.getNumFrames();
- mergefloat[magic] = mergefloat[magic] + ((inputfloat[zounds - randomint + input.getNumFrames()])/count); //SOMEHOW IS LIKE PUFFER 1 ROUND TO EARLY
- }
- }*/
- //////////////////////////////////////OOOLDmerge/////////////////////////////////////////////////
- if(count < (gesamt-1)) { //framestopper and layering progress
- count = count + 1;
- print(".");
- loop();
- }
- else {
- output = new Sample(transfloat.length);
- output.write(transfloat);
- println("");
- println("saving to disk");
- output.saveFile("output1");
- noLoop();
- }
- }
- public void stop(){
- Sonia.stop();
- super.stop();
- }
Add Comment
Please, Sign In to add comment