var samplePlayer = new maximJs.maxiSample(); var stretch = new Module.maxiPitchStretch(); // var grains = new Module.maxiTimestretch(); // var shift = new Module.maxiPitchShift(); var speed = 0.5; function setup(){ loadSample("./beat2.wav", samplePlayer); } var grainsSet = false; function play(){ // this is necessary as file loading may not complete in setup if(samplePlayer.isReady()){ // set grainPlayer sample if(!grainsSet){ stretch.setSample(samplePlayer); // shift.setSample(samplePlayer); grainsSet = true; } output = stretch.play(1, 2,0.1, 2, 0); // ouptut = grains.play2(pos, 0.1, 4); } }