Commit c52a542b authored by Dr-Dan's avatar Dr-Dan
Browse files

all js functions are wrapped in class/namespace. No longer mandatory to use...

all js functions are wrapped in class/namespace. No longer mandatory to use maxim webAudio implementation.
parent d80bb324
...@@ -3,6 +3,7 @@ src/cpp/Maximilian-master/ ...@@ -3,6 +3,7 @@ src/cpp/Maximilian-master/
Recordings/ Recordings/
maxiLib/maximilian_examples_web/load_sample_test.html maxiLib/maximilian_examples_web/load_sample_test.html
maxiLib/sed_addText.sh maxiLib/sed_addText.sh
maxiLib/sed_replace.sh
maxiLib/sed_text_stuff/ maxiLib/sed_text_stuff/
maximilian_examples_cpp/ maximilian_examples_cpp/
old_stuff/ old_stuff/
\ No newline at end of file
...@@ -5,15 +5,15 @@ EMSCR=../../em++ ...@@ -5,15 +5,15 @@ EMSCR=../../em++
# Maximilian base stuff # Maximilian base stuff
# POST_JS is all the external js stuff that handles web audio etc # POST_JS is all the external js stuff that handles web audio etc
POST_JS_webAudio_all=src/js/maxi_webAudio_wExtras.js POST_JS_webAudio_all=src/js/maxi_webAudio_Complete.js
POST_JS_extras=src/js/maxi_extras.js # POST_JS_extras=src/js/maxi_extras.js
#the .cpp file that is used #the .cpp file that is used
SOURCE_MAXI=src/cpp/maxi_emscr_new.cpp SOURCE_MAXI=src/cpp/maxi_emscr_new.cpp
# destination .js file # destination .js file
OUTPUT_MAXI=maxiLib/maxiLib.js OUTPUT_MAXI=maxiLib/maxiLib.js
OUTPUT_MAXI_noAudio=maxiLib/maxiLib_noWebAudio.js # OUTPUT_MAXI_noAudio=maxiLib/maxiLib_noWebAudio.js
# ---------------------------------------- # ----------------------------------------
# extra libs stuff # extra libs stuff
...@@ -36,7 +36,8 @@ CFLAGS=-O3 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTION ...@@ -36,7 +36,8 @@ CFLAGS=-O3 -s DISABLE_EXCEPTION_CATCHING=0 -s ALLOW_MEMORY_GROWTH=1 -s ASSERTION
full: full:
$(EMSCR) $(CFLAGS) --post-js $(POST_JS_webAudio_all) --bind -o $(OUTPUT_MAXI) $(SOURCE_MAXI) $(SOURCES_LIBS) $(EMSCR) $(CFLAGS) --post-js $(POST_JS_webAudio_all) --bind -o $(OUTPUT_MAXI) $(SOURCE_MAXI) $(SOURCES_LIBS)
basic: # without webAudio stuff
$(EMSCR) $(CFLAGS) --post-js $(POST_JS_extras) --bind -o $(OUTPUT_MAXI_noAudio) $(SOURCE_MAXI) $(SOURCES_LIBS) # basic:
# $(EMSCR) $(CFLAGS) --post-js $(POST_JS_extras) --bind -o $(OUTPUT_MAXI_noAudio) $(SOURCE_MAXI) $(SOURCES_LIBS)
all: full all: full
\ No newline at end of file
...@@ -2,6 +2,4 @@ An implementation of maximilian in javascript using emscripten to compile code f ...@@ -2,6 +2,4 @@ An implementation of maximilian in javascript using emscripten to compile code f
To use: move the maxiLib.js file from the maxiLib folder to an appropriate location and include using the <script> tag right now. To use: move the maxiLib.js file from the maxiLib folder to an appropriate location and include using the <script> tag right now.
If you want to use without webAudio API setup for you, include maxiLib_noWebAudio.js. You can still include the maxi_webAudio file (from the src/js folder) after this and all will function as usual.
Examples are in maxiLib/maximilian_examples_web. Examples are in maxiLib/maximilian_examples_web.
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code --> <!-- Our javascript code -->
<script type="text/javascript"> <script type="text/javascript">
maximJs.maxiAudio.init();
var myCounter = new maximJs.maxiOsc(); //these oscillators will help us count and play sound var myCounter = new maximJs.maxiOsc(); //these oscillators will help us count and play sound
var mySwitchableOsc = new maximJs.maxiOsc();// var mySwitchableOsc = new maximJs.maxiOsc();//
...@@ -55,15 +56,15 @@ var myOscOutput,myFilteredOutput;// ...@@ -55,15 +56,15 @@ var myOscOutput,myFilteredOutput;//
var myEnvelope = new maximJs.maxiEnv(); var myEnvelope = new maximJs.maxiEnv();
var myFilter = new maximJs.maxiFilter(); var myFilter = new maximJs.maxiFilter();
function setup(){
//Timing is in ms //Timing is in ms
myEnvelope.setAttack(0); myEnvelope.setAttack(0);
myEnvelope.setDecay(1); // Needs to be at least 1 myEnvelope.setDecay(1); // Needs to be at least 1
myEnvelope.setSustain(1); myEnvelope.setSustain(1);
myEnvelope.setRelease(1000); myEnvelope.setRelease(1000);
}
function play(){ maximJs.maxiAudio.play = function(){
myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger); myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger);
...@@ -84,7 +85,7 @@ function play(){ ...@@ -84,7 +85,7 @@ function play(){
// The last input is the resonance. // The last input is the resonance.
myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10); myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10);
output=myFilteredOutput;//left speaker this.output=myFilteredOutput;//left speaker
} }
...@@ -119,7 +120,7 @@ function setup(){ ...@@ -119,7 +120,7 @@ function setup(){
myEnvelope.setRelease(1000); myEnvelope.setRelease(1000);
} }
function play(){ maximJs.maxiAudio.play = function(){
myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger); myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger);
...@@ -140,7 +141,7 @@ function play(){ ...@@ -140,7 +141,7 @@ function play(){
// The last input is the resonance. // The last input is the resonance.
myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10); myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10);
output=myFilteredOutput;//left speaker this.output=myFilteredOutput;//left speaker
} }
</pre> </pre>
</body></html> </body></html>
...@@ -43,25 +43,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -43,25 +43,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code --> <!-- Our javascript code -->
<script type="text/javascript"> <script type="text/javascript">
maximJs.maxiAudio.init();
// change this.output to an array
maximJs.maxiAudio.outputIsArray(true, 2);
var myOsc = new maximJs.maxiOsc(); var myOsc = new maximJs.maxiOsc();
var myAutoPanner = new maximJs.maxiOsc(); var myAutoPanner = new maximJs.maxiOsc();
var myStereoOutput = GetArrayAsVectorDbl([0,0]); var myStereoOutput = maximJs.maxiTools.getArrayAsVectorDbl([0,0]);
var myOutputs = new maximJs.maxiMix();//this is the stereo mixer channel. var myOutputs = new maximJs.maxiMix();//this is the stereo mixer channel.
function setup(){
// change output to an array
OutputIsArray(true, 2);
}
function play(){
maximJs.maxiAudio.play = function(){
myOutputs.stereo(myOsc.noise(),myStereoOutput,(myAutoPanner.sinewave(1)+1)/2);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the output[numberofchannels], and the pan (0-1,equal power). myOutputs.stereo(myOsc.noise(),myStereoOutput,(myAutoPanner.sinewave(1)+1)/2);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the this.output[numberofchannels], and the pan (0-1,equal power).
output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly this.output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the this.outputs explicitly
output[1]=myStereoOutput.get(1);// this.output[1]=myStereoOutput.get(1);//
} }
</script> </script>
...@@ -84,17 +80,17 @@ function play(){ ...@@ -84,17 +80,17 @@ function play(){
function setup(){ function setup(){
// change output to an array // change this.output to an array
// setNumOutputChannels(2); // setNumOutputChannels(2);
OutputIsArray(true, 2); OutputIsArray(true, 2);
} }
function play(){ maximJs.maxiAudio.play = function(){
myOutputs.stereo(myOsc.noise(),myStereoOutput,(myAutoPanner.sinewave(1)+1)/2);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the output[numberofchannels], and the pan (0-1,equal power). myOutputs.stereo(myOsc.noise(),myStereoOutput,(myAutoPanner.sinewave(1)+1)/2);//Stereo, Quad or 8 Channel. Specify the input to be mixed, the this.output[numberofchannels], and the pan (0-1,equal power).
output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly this.output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the this.outputs explicitly
output[1]=myStereoOutput.get(1);// this.output[1]=myStereoOutput.get(1);//
} }
</pre> </pre>
</body></html> </body></html>
...@@ -43,21 +43,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -43,21 +43,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code --> <!-- Our javascript code -->
<script type="text/javascript"> <script type="text/javascript">
maximJs.maxiAudio.init();
maximJs.maxiAudio.init();
var samplePlayer = new maximJs.maxiSample(); var samplePlayer = new maximJs.maxiSample();
var mySine = new maximJs.maxiOsc(); var mySine = new maximJs.maxiOsc();
function setup(){ maximJs.maxiTools.loadSample("audio/beat2.wav", samplePlayer);
loadSample("./beat2.wav", samplePlayer); // maximJs.maxiTools.loadSample("audio/beat2.wav", samplePlayer, maximJs.maxiAudio.context);
}
function play(){ maximJs.maxiAudio.play = function(){
// this is necessary as file loading may not complete in setup // this is necessary as file loading may not complete in setup
if(samplePlayer.isReady()){ if(samplePlayer.isReady()){
output = samplePlayer.play();//just play the file. Looping is default for all play functions. this.output = samplePlayer.play();//just play the file. Looping is default for all play functions.
// output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed. // this.output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed.
// output=samplePlayer.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing. // this.output=samplePlayer.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing.
// output=samplePlayer.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing. // this.output=samplePlayer.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing.
} }
} }
...@@ -82,13 +83,13 @@ function setup(){ ...@@ -82,13 +83,13 @@ function setup(){
loadSample("./beat2.wav", samplePlayer); loadSample("./beat2.wav", samplePlayer);
} }
function play(){ maximJs.maxiAudio.play = function(){
// this is necessary as file loading may not complete in setup // this is necessary as file loading may not complete in setup
if(samplePlayer.isReady()){ if(samplePlayer.isReady()){
output = samplePlayer.play();//just play the file. Looping is default for all play functions. this.output = samplePlayer.play();//just play the file. Looping is default for all play functions.
// output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed. // this.output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed.
// output=samplePlayer.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing. // this.output=samplePlayer.play(0.5,0,44100);//linear interpolationplay with a frequency input, start point and end point. Useful for syncing.
// output=samplePlayer.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing. // this.output=samplePlayer.play4(0.5,0,44100);//cubic interpolation play with a frequency input, start point and end point. Useful for syncing.
} }
} }
</pre> </pre>
......
...@@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code --> <!-- Our javascript code -->
<script type="text/javascript"> <script type="text/javascript">
maximJs.maxiAudio.init();
var a = new maximJs.maxiOsc(); var a = new maximJs.maxiOsc();
var xs = [0,0,0], ys = [0,0,0]; var xs = [0,0,0], ys = [0,0,0];
...@@ -52,48 +53,49 @@ var Q = 1.0; ...@@ -52,48 +53,49 @@ var Q = 1.0;
var mySwitchableOsc = new maximJs.maxiOsc(); var mySwitchableOsc = new maximJs.maxiOsc();
function setup() {//some inits
var cos = Math.cos;
var w0 = 2*Math.PI*f0/44100;
var alpha = Math.sin(w0)/(2*Q);
//Band-pass reson:
// b0 = alpha;
// b1 = 0;
// b2 = -1 * alpha;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
//Notch:
b0 = 1;
b1 = -2*cos(w0);
b2 = 1;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
//LPF:
// b0 = (1 - cos(w0))/2;
// b1 = 1 - cos(w0);
// b2 = (1 - cos(w0))/2;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
}
function play() {//this is where the magic happens. Very slow magic. var cos = Math.cos;
var w0 = 2*Math.PI*f0/44100;
var alpha = Math.sin(w0)/(2*Q);
// Band-pass reson:
// b0 = alpha;
// b1 = 0;
// b2 = -1 * alpha;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
//Notch:
b0 = 1;
b1 = -2*cos(w0);
b2 = 1;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
//LPF:
// b0 = (1 - cos(w0))/2;
// b1 = 1 - cos(w0);
// b2 = (1 - cos(w0))/2;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
maximJs.maxiAudio.play = function() {//this is where the magic happens. Very slow magic.
xs[0] = mySwitchableOsc.sawn(400); xs[0] = mySwitchableOsc.sawn(400);
ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2] ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2]
- (a1/a0)*ys[1] - (a2/a0)*ys[2]; - (a1/a0)*ys[1] - (a2/a0)*ys[2];
output = ys[0]; this.output = ys[0];
ys[2] = ys[1]; ys[1] = ys[0]; ys[2] = ys[1]; ys[1] = ys[0];
xs[2] = xs[1]; xs[1] = xs[0]; xs[2] = xs[1]; xs[1] = xs[0];
} }
</script> </script>
</head> </head>
...@@ -105,7 +107,9 @@ function play() {//this is where the magic happens. Very slow magic. ...@@ -105,7 +107,9 @@ function play() {//this is where the magic happens. Very slow magic.
</p> </p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" > <pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
var a = new maximJs.maxiOsc(); var a = new maximJs.maxiOsc();
var xs = [0,0,0], ys = [0,0,0]; var xs = [0,0,0], ys = [0,0,0];
var a0, a1, a2, b0, b1, b2; var a0, a1, a2, b0, b1, b2;
...@@ -114,44 +118,45 @@ var Q = 1.0; ...@@ -114,44 +118,45 @@ var Q = 1.0;
var mySwitchableOsc = new maximJs.maxiOsc(); var mySwitchableOsc = new maximJs.maxiOsc();
function setup() {//some inits
var cos = Math.cos;
var w0 = 2*Math.PI*f0/44100;
var alpha = Math.sin(w0)/(2*Q);
//Band-pass reson:
// b0 = alpha;
// b1 = 0;
// b2 = -1 * alpha;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
//Notch:
b0 = 1;
b1 = -2*cos(w0);
b2 = 1;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
//LPF:
// b0 = (1 - cos(w0))/2;
// b1 = 1 - cos(w0);
// b2 = (1 - cos(w0))/2;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
}
function play() {//this is where the magic happens. Very slow magic. var cos = Math.cos;
var w0 = 2*Math.PI*f0/44100;
var alpha = Math.sin(w0)/(2*Q);
// Band-pass reson:
// b0 = alpha;
// b1 = 0;
// b2 = -1 * alpha;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
//Notch:
b0 = 1;
b1 = -2*cos(w0);
b2 = 1;
a0 = 1 + alpha;
a1 = -2*cos(w0);
a2 = 1 - alpha;
//LPF:
// b0 = (1 - cos(w0))/2;
// b1 = 1 - cos(w0);
// b2 = (1 - cos(w0))/2;
// a0 = 1 + alpha;
// a1 = -2*cos(w0);
// a2 = 1 - alpha;
maximJs.maxiAudio.play = function() {//this is where the magic happens. Very slow magic.
xs[0] = mySwitchableOsc.sawn(400); xs[0] = mySwitchableOsc.sawn(400);
ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2] ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2]
- (a1/a0)*ys[1] - (a2/a0)*ys[2]; - (a1/a0)*ys[1] - (a2/a0)*ys[2];
output = ys[0]; this.output = ys[0];
ys[2] = ys[1]; ys[1] = ys[0]; ys[2] = ys[1]; ys[1] = ys[0];
xs[2] = xs[1]; xs[1] = xs[0]; xs[2] = xs[1]; xs[1] = xs[0];
} }
</pre> </pre>
</body></html> </body></html>
...@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code --> <!-- Our javascript code -->
<script type="text/javascript"> <script type="text/javascript">
maximJs.maxiAudio.init();
//This shows how to use maximilian to build a monophonic synth //This shows how to use maximilian to build a monophonic synth
//These are the synthesiser bits //These are the synthesiser bits
...@@ -53,7 +54,6 @@ var LFO1 = new maximJs.maxiOsc(); ...@@ -53,7 +54,6 @@ var LFO1 = new maximJs.maxiOsc();
var LFO2 = new maximJs.maxiOsc(); var LFO2 = new maximJs.maxiOsc();
var VCF = new maximJs.maxiFilter(); var VCF = new maximJs.maxiFilter();
var ADSR = new maximJs.maxiEnv(); var ADSR = new maximJs.maxiEnv();
//This is a bunch of control signals so that we can hear something //This is a bunch of control signals so that we can hear something
...@@ -63,16 +63,14 @@ var currentCount,lastCount;//these values are used to check if we have a new bea ...@@ -63,16 +63,14 @@ var currentCount,lastCount;//these values are used to check if we have a new bea
//and these are some variables we can use to pass stuff around //and these are some variables we can use to pass stuff around
var VCO1out,VCO2out,LFO1out,LFO2out,VCFout,ADSRout; var VCO1out,VCO2out,LFO1out,LFO2out,VCFout,ADSRout;
function setup(){ ADSR.setAttack(1000);
ADSR.setAttack(1000); ADSR.setDecay(1);
ADSR.setDecay(1); ADSR.setSustain(1);
ADSR.setSustain(1); ADSR.setRelease(1000);
ADSR.setRelease(1000);
}
function play(){ maximJs.maxiAudio.play = function(){
//so this first bit is just a basic metronome so we can hear what we're doing. //so this first bit is just a basic metronome so we can hear what we're doing.
currentCount=Math.round(timer.phasor(0.5));//this sets up a metronome that ticks every 2 seconds currentCount=Math.round(timer.phasor(0.5));//this sets up a metronome that ticks every 2 seconds
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
...@@ -98,10 +96,8 @@ function play(){ ...@@ -98,10 +96,8 @@ function play(){
var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
ADSR.trigger=0; ADSR.trigger=0;
output=finalSound; this.output=finalSound;
} }
</script> </script>
</head> </head>
...@@ -115,6 +111,7 @@ function play(){ ...@@ -115,6 +111,7 @@ function play(){
</p> </p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" > <pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
//This shows how to use maximilian to build a monophonic synth //This shows how to use maximilian to build a monophonic synth
//These are the synthesiser bits //These are the synthesiser bits
...@@ -134,16 +131,14 @@ var currentCount,lastCount;//these values are used to check if we have a new bea ...@@ -134,16 +131,14 @@ var currentCount,lastCount;//these values are used to check if we have a new bea
//and these are some variables we can use to pass stuff around //and these are some variables we can use to pass stuff around
var VCO1out,VCO2out,LFO1out,LFO2out,VCFout,ADSRout; var VCO1out,VCO2out,LFO1out,LFO2out,VCFout,ADSRout;
function setup(){ ADSR.setAttack(1000);
ADSR.setAttack(1000); ADSR.setDecay(1);
ADSR.setDecay(1); ADSR.setSustain(1);
ADSR.setSustain(1); ADSR.setRelease(1000);
ADSR.setRelease(1000);
}
function play(){
maximJs.maxiAudio.play = function(){
//so this first bit is just a basic metronome so we can hear what we're doing. //so this first bit is just a basic metronome so we can hear what we're doing.
currentCount=Math.round(timer.phasor(0.5));//this sets up a metronome that ticks every 2 seconds currentCount=Math.round(timer.phasor(0.5));//this sets up a metronome that ticks every 2 seconds
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
...@@ -169,7 +164,7 @@ function play(){ ...@@ -169,7 +164,7 @@ function play(){
var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
ADSR.trigger=0;