Commit a2a106f8 authored by Jakub Fiala's avatar Jakub Fiala

merged changes from master

parents 351db365 292fe4b2
# change '../../em++' to path to em++ in emscriten folder
# change '../../em++' to path to em++ in emscripten folder
EMSCR=../../em++
# ----------------------------------------
......
This diff is collapsed.
......@@ -44,7 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
var myCounter = new maximJs.maxiOsc(); //these oscillators will help us count and play sound
var mySwitchableOsc = new maximJs.maxiOsc();//
......@@ -64,7 +65,7 @@ myEnvelope.setSustain(1);
myEnvelope.setRelease(1000);
maximJs.maxiAudio.play = function(){
audio.play = function(){
myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger);
......@@ -85,7 +86,7 @@ maximJs.maxiAudio.play = function(){
// The last input is the resonance.
myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10);
output=myFilteredOutput;//left speaker
this.output=myFilteredOutput;//left speaker
}
......@@ -102,6 +103,9 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
var audio = new maximJs.maxiAudio();
audio.init();
var myCounter = new maximJs.maxiOsc(); //these oscillators will help us count and play sound
var mySwitchableOsc = new maximJs.maxiOsc();//
......@@ -112,15 +116,15 @@ var myOscOutput,myFilteredOutput;//
var myEnvelope = new maximJs.maxiEnv();
var myFilter = new maximJs.maxiFilter();
function setup(){
//Timing is in ms
myEnvelope.setAttack(0);
myEnvelope.setDecay(1); // Needs to be at least 1
myEnvelope.setSustain(1);
myEnvelope.setRelease(1000);
}
myEnvelope.setAttack(0);
myEnvelope.setDecay(1); // Needs to be at least 1
myEnvelope.setSustain(1);
myEnvelope.setRelease(1000);
maximJs.maxiAudio.play = function(){
audio.play = function(){
myCurrentVolume=myEnvelope.adsr(1.,myEnvelope.trigger);
......@@ -141,7 +145,7 @@ maximJs.maxiAudio.play = function(){
// The last input is the resonance.
myFilteredOutput=myFilter.lores(myOscOutput,myCurrentVolume*1000,10);
output=myFilteredOutput;//left speaker
this.output=myFilteredOutput;//left speaker
}
</pre>
</body></html>
......@@ -43,9 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
// change output to an array
maximJs.maxiAudio.outputIsArray(true, 2);
audio.outputIsArray(true, 2);
var myOsc = new maximJs.maxiOsc();
var myAutoPanner = new maximJs.maxiOsc();
......@@ -54,10 +55,10 @@ var myOutputs = new maximJs.maxiMix();//this is the stereo mixer channel.
maximJs.maxiAudio.play = function(){
audio.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).
output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly
output[1]=myStereoOutput.get(1);//
this.output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly
this.output[1]=myStereoOutput.get(1);//
}
</script>
......@@ -73,24 +74,23 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
var myOsc = new maximJs.maxiOsc();
var myAutoPanner = new maximJs.maxiOsc();
var myStereoOutput = GetArrayAsVectorDbl([0,0]);
var myOutputs = new maximJs.maxiMix();//this is the stereo mixer channel.
var audio = new maximJs.maxiAudio();
audio.init();
// change output to an array
audio.outputIsArray(true, 2);
var myOsc = new maximJs.maxiOsc();
var myAutoPanner = new maximJs.maxiOsc();
var myStereoOutput = maximJs.maxiTools.getArrayAsVectorDbl([0,0]);
var myOutputs = new maximJs.maxiMix();//this is the stereo mixer channel.
function setup(){
// change output to an array
// setNumOutputChannels(2);
OutputIsArray(true, 2);
}
maximJs.maxiAudio.play = function(){
audio.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).
this.output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly
this.output[1]=myStereoOutput.get(1);//
}
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).
output[0]=myStereoOutput.get(0);//When working with mixing, you need to specify the outputs explicitly
output[1]=myStereoOutput.get(1);//
}
</pre>
</body></html>
......@@ -42,23 +42,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
var samplePlayer = new maximJs.maxiSample();
var mySine = new maximJs.maxiOsc();
maximJs.maxiTools.loadSample("audio/beat2.wav", samplePlayer);
// maximJs.maxiTools.loadSample("audio/beat2.wav", samplePlayer, maximJs.maxiAudio.context);
// load sample to 'samplePlayer' using 'audio' object
audio.loadSample("audio/beat2.wav", samplePlayer);
maximJs.maxiAudio.play = function(){
audio.play = function(){
// this is necessary as file loading may not complete in setup
if(samplePlayer.isReady()){
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.
// 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.play();//just play the file. Looping is default for all play functions.
// this.output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed.
// this.output=samplePlayer.play(0.5,0,44100);//linear interpolationplay 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.
}
}
......@@ -75,21 +75,23 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
var audio = new maximJs.maxiAudio();
audio.init();
var samplePlayer = new maximJs.maxiSample();
var mySine = new maximJs.maxiOsc();
function setup(){
loadSample("./beat2.wav", samplePlayer);
}
// load sample using 'audio' object
audio.loadSample("audio/beat2.wav", samplePlayer);
maximJs.maxiAudio.play = function(){
audio.play = function(){
// this is necessary as file loading may not complete in setup
if(samplePlayer.isReady()){
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.
// 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.play();//just play the file. Looping is default for all play functions.
// this.output=samplePlayer.play(0.69) ;//play the file with a speed setting. 1. is normal speed.
// this.output=samplePlayer.play(0.5,0,44100);//linear interpolationplay 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>
</body></html>
\ No newline at end of file
......@@ -43,7 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
var a = new maximJs.maxiOsc();
var xs = [0,0,0], ys = [0,0,0];
......@@ -83,12 +84,12 @@ a2 = 1 - alpha;
maximJs.maxiAudio.play = function() {//this is where the magic happens. Very slow magic.
audio.play = function() {//this is where the magic happens. Very slow magic.
xs[0] = mySwitchableOsc.sawn(400);
ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2]
- (a1/a0)*ys[1] - (a2/a0)*ys[2];
output = ys[0];
this.output = ys[0];
ys[2] = ys[1]; ys[1] = ys[0];
xs[2] = xs[1]; xs[1] = xs[0];
......@@ -108,7 +109,8 @@ maximJs.maxiAudio.play = function() {//this is where the magic happens. Very slo
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
var a = new maximJs.maxiOsc();
var xs = [0,0,0], ys = [0,0,0];
......@@ -148,15 +150,17 @@ a2 = 1 - alpha;
maximJs.maxiAudio.play = function() {//this is where the magic happens. Very slow magic.
xs[0] = mySwitchableOsc.sawn(400);
ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2]
- (a1/a0)*ys[1] - (a2/a0)*ys[2];
output = ys[0];
ys[2] = ys[1]; ys[1] = ys[0];
xs[2] = xs[1]; xs[1] = xs[0];
audio.play = function() {//this is where the magic happens. Very slow magic.
xs[0] = mySwitchableOsc.sawn(400);
ys[0] = (b0/a0)*xs[0] + (b1/a0)*xs[1] + (b2/a0)*xs[2]
- (a1/a0)*ys[1] - (a2/a0)*ys[2];
this.output = ys[0];
ys[2] = ys[1]; ys[1] = ys[0];
xs[2] = xs[1]; xs[1] = xs[0];
}
</pre>
</body></html>
......@@ -44,7 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
//This shows how to use maximilian to build a monophonic synth
//These are the synthesiser bits
......@@ -69,7 +70,7 @@ ADSR.setSustain(1);
ADSR.setRelease(1000);
maximJs.maxiAudio.play = function(){
audio.play = function(){
//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
......@@ -96,7 +97,7 @@ maximJs.maxiAudio.play = function(){
var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
ADSR.trigger=0;
output=finalSound;
this.output=finalSound;
}
</script>
......@@ -111,7 +112,7 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
audio.init();
//This shows how to use maximilian to build a monophonic synth
//These are the synthesiser bits
......@@ -121,7 +122,6 @@ var LFO1 = new maximJs.maxiOsc();
var LFO2 = new maximJs.maxiOsc();
var VCF = new maximJs.maxiFilter();
var ADSR = new maximJs.maxiEnv();
//This is a bunch of control signals so that we can hear something
......@@ -137,7 +137,7 @@ ADSR.setSustain(1);
ADSR.setRelease(1000);
maximJs.maxiAudio.play = function(){
audio.play = function(){
//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
......@@ -164,7 +164,7 @@ maximJs.maxiAudio.play = function(){
var finalSound=VCFout*ADSRout;//finally we add the ADSR as an amplitude modulator
ADSR.trigger=0;
output=finalSound;
this.output=finalSound;
}
</pre>
</body></html>
......@@ -44,23 +44,45 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
// change output to an array
maximJs.maxiAudio.outputIsArray(true, 2);
audio.outputIsArray(true, 2);
//This shows how to use maximilian to build a polyphonic synth.
// Chrome doesn't like this one for some reason
var VCO_ArraySize = 6;
//These are the synthesiser bits
// maxiTools makes it quicker to fill arrays with maxim objects
var VCO1 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var VCO2 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var LFO1 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var LFO2 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var VCO1 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCO1.push(new maximJs.maxiOsc());
}
var VCO2 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCO2.push(new maximJs.maxiOsc());
}
var VCF = maximJs. maxiTools.arrayOfObj(maximJs.maxiFilter, VCO_ArraySize);
var ADSR = maximJs. maxiTools.arrayOfObj(maximJs.maxiEnv, VCO_ArraySize);
var LFO1 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
LFO1.push(new maximJs.maxiOsc());
}
var LFO2 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
LFO2.push(new maximJs.maxiOsc());
}
var VCF = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCF.push(new maximJs.maxiFilter());
}
var ADSR = [];
for(var i = 0; i < VCO_ArraySize; ++i){
ADSR.push(new maximJs.maxiEnv());
}
//and these are some variables we can use to pass stuff around
var VCO1out = [], VCO2out = [], LFO1out = [],LFO2out = [], VCFout = [], ADSRout = [];
......@@ -93,7 +115,7 @@ for (var i=0;i<VCO_ArraySize;i++) {
}
maximJs.maxiAudio.play = function(){
audio.play = function(){
mix=0;//we're adding up the samples each update and it makes sense to clear them each time first.
//so this first bit is just a basic metronome so we can hear what we're doing.
......@@ -102,7 +124,7 @@ maximJs.maxiAudio.play = function(){
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
if (voice>=6) {
if (voice>=VCO_ArraySize) {
voice=0;
}
......@@ -113,7 +135,7 @@ maximJs.maxiAudio.play = function(){
}
//and this is where we build the synth
for (var i=0; i<6; i++) {
for (var i=0; i<VCO_ArraySize; i++) {
ADSRout[i]=ADSR[i].adsr(1.,ADSR[i].trigger);//our ADSR env is passed a constant signal of 1 to generate the transient.
......@@ -126,16 +148,16 @@ maximJs.maxiAudio.play = function(){
VCFout[i]=VCF[i].lores((VCO1out[i]+VCO2out[i])*0.5, 250+((pitch[i]+LFO1out[i])*1000), 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff
mix+=VCFout[i]*ADSRout[i]/6;//finally we add the ADSR as an amplitude modulator
mix+=VCFout[i]*ADSRout[i]/VCO_ArraySize;//finally we add the ADSR as an amplitude modulator
}
output[0]=mix*0.5;//left channel
output[1]=mix*0.5;//right channel
this.output[0]=mix*0.5;//left channel
this.output[1]=mix*0.5;//right channel
// This just sends note-off messages.
for (var i=0; i<6; i++) {
for (var i=0; i<VCO_ArraySize; i++) {
ADSR[i].trigger=0;
}
}
......@@ -153,30 +175,53 @@ maximJs.maxiAudio.play = function(){
This shows how to use maximilian to build a polyphonic synth.
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
var audio = new maximJs.maxiAudio();
audio.init();
// change output to an array
maximJs.maxiAudio.outputIsArray(true, 2);
audio.outputIsArray(true, 2);
//This shows how to use maximilian to build a polyphonic synth.
// Chrome doesn't like this one for some reason
var VCO_ArraySize = 6;
//These are the synthesiser bits
// maxiTools makes it quicker to fill arrays with maxim objects
var VCO1 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var VCO2 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var LFO1 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var LFO2 = maximJs. maxiTools.arrayOfObj(maximJs.maxiOsc, VCO_ArraySize);
var VCO1 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCO1.push(new maximJs.maxiOsc());
}
var VCF = maximJs. maxiTools.arrayOfObj(maximJs.maxiFilter, VCO_ArraySize);
var ADSR = maximJs. maxiTools.arrayOfObj(maximJs.maxiEnv, VCO_ArraySize);
var VCO2 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCO2.push(new maximJs.maxiOsc());
}
var LFO1 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
LFO1.push(new maximJs.maxiOsc());
}
var LFO2 = [];
for(var i = 0; i < VCO_ArraySize; ++i){
LFO2.push(new maximJs.maxiOsc());
}
var VCF = [];
for(var i = 0; i < VCO_ArraySize; ++i){
VCF.push(new maximJs.maxiFilter());
}
var ADSR = [];
for(var i = 0; i < VCO_ArraySize; ++i){
ADSR.push(new maximJs.maxiEnv());
}
//and these are some variables we can use to pass stuff around
var VCO1out = [], VCO2out = [], LFO1out = [],LFO2out = [], VCFout = [], ADSRout = [];
var pitch = [];
// fill arrays with 0s
for(var i = 0; i < VCO_ArraySize; i++){
VCO1out.push(0);
VCO2out.push(0);
......@@ -202,7 +247,7 @@ for (var i=0;i<VCO_ArraySize;i++) {
}
maximJs.maxiAudio.play = function(){
audio.play = function(){
mix=0;//we're adding up the samples each update and it makes sense to clear them each time first.
//so this first bit is just a basic metronome so we can hear what we're doing.
......@@ -211,7 +256,7 @@ maximJs.maxiAudio.play = function(){
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
if (voice>=6) {
if (voice>=VCO_ArraySize) {
voice=0;
}
......@@ -222,7 +267,7 @@ maximJs.maxiAudio.play = function(){
}
//and this is where we build the synth
for (var i=0; i<6; i++) {
for (var i=0; i<VCO_ArraySize; i++) {
ADSRout[i]=ADSR[i].adsr(1.,ADSR[i].trigger);//our ADSR env is passed a constant signal of 1 to generate the transient.
......@@ -235,18 +280,19 @@ maximJs.maxiAudio.play = function(){
VCFout[i]=VCF[i].lores((VCO1out[i]+VCO2out[i])*0.5, 250+((pitch[i]+LFO1out[i])*1000), 10);//now we stick the VCO's into the VCF, using the ADSR as the filter cutoff
mix+=VCFout[i]*ADSRout[i]/6;//finally we add the ADSR as an amplitude modulator
mix+=VCFout[i]*ADSRout[i]/VCO_ArraySize;//finally we add the ADSR as an amplitude modulator
}
output[0]=mix*0.5;//left channel
output[1]=mix*0.5;//right channel
this.output[0]=mix*0.5;//left channel
this.output[1]=mix*0.5;//right channel
// This just sends note-off messages.
for (var i=0; i<6; i++) {
for (var i=0; i<VCO_ArraySize; i++) {
ADSR[i].trigger=0;
}
}
</pre>
</body></html>
......@@ -43,8 +43,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
maximJs.maxiAudio.outputIsArray(true, 2);
var audio = new maximJs.maxiAudio();
audio.init();
audio.outputIsArray(true, 2);
//Bizarelly, this sounds a little bit like Kraftwerk's 'Metropolis', although it isn't. Funny that.
var sound = new maximJs.maxiOsc();
......@@ -77,7 +78,7 @@ var leadLineTrigger=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0
var leadLinePitch=[69,67,65,64,67,66,64,62,65,64,62,57,55,60,57];
maximJs.maxiAudio.play = function(){
audio.play = function(){
currentCount=Math.floor(timer.phasor(9));//this sets up a metronome that ticks every so often
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
......@@ -107,11 +108,9 @@ maximJs.maxiAudio.play = function(){
if(trigger!=0)trigger=0;//set the trigger to off if you want it to trigger immediately next time.
output[0]=(bassout + delayout)/2;//sum output
output[1]=(bassout + delayout)/2;
audio.output[0]=(bassout + delayout)/2;//sum output
audio.output[1]=(bassout + delayout)/2;
}
</script>
</head>
......@@ -125,11 +124,11 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
maximJs.maxiAudio.init();
maximJs.maxiAudio.outputIsArray(true, 2);
var audio = new maximJs.maxiAudio();
audio.init();
audio.outputIsArray(true, 2);
//Bizarelly, this sounds a little bit like Kraftwerk's 'Metropolis', although it isn't. Funny that.
var sound = new maximJs.maxiOsc();
var bass = new maximJs.maxiOsc();
var timer = new maximJs.maxiOsc();
......@@ -160,7 +159,7 @@ var leadLineTrigger=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0
var leadLinePitch=[69,67,65,64,67,66,64,62,65,64,62,57,55,60,57];
maximJs.maxiAudio.play = function(){
audio.play = function(){
currentCount=Math.floor(timer.phasor(9));//this sets up a metronome that ticks every so often
if (lastCount!=currentCount) {//if we have a new timer int this sample, play the sound
......@@ -190,8 +189,8 @@ maximJs.maxiAudio.play = function(){
if(trigger!=0)trigger=0;//set the trigger to off if you want it to trigger immediately next time.
output[0]=(bassout + delayout)/2;//sum output
output[1]=(bassout + delayout)/2;
audio.output[0]=(bassout + delayout)/2;//sum output
audio.output[1]=(bassout + delayout)/2;
}
</pre>
</body></html>
......@@ -44,34 +44,34 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
var audio = new maximJs.maxiAudio();
audio.init();
var beats = new maximJs.maxiSample(); //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names.
var compressor = new maximJs.maxiDyn(); //this is a compressor
var out = 0;
maximJs.maxiAudio.outputIsArray(true, 2);
audio.outputIsArray(true, 2);
compressor.setAttack(100);
compressor.setRelease(300);
compressor.setThreshold(0.25);
compressor.setRatio(5);
maximJs.maxiTools.loadSample('audio/beat2.wav', beats);
audio.loadSample('audio/beat2.wav', beats);
maximJs.maxiAudio.play = function(){
audio.play = function(){
if(beats.isReady()){
//here, we're just compressing the file in real-time
//arguments are input,ratio,threshold,attack,release
out=compressor.compress(beats.play());
// out=compressor.compress(beats.play(0.66));
}
output[0]=out;
output[1]=out;
this.output[0]=out;
this.output[1]=out;
}
......@@ -88,32 +88,35 @@ maximJs.maxiAudio.play = function(){
</p>
<pre class="prettyprint lang-js linenums:true" id="quine" style="border:4px solid #88c" >
var beats = new maximJs.maxiSample(); //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names.
var compressor = new maximJs.maxiDyn(); //this is a compressor
var out = 0;
var audio = new maximJs.maxiAudio();
audio.init();
function setup(){
OutputIsArray(true, 2);
var beats = new maximJs.maxiSample(); //We give our sample a name. It's called beats this time. We could have loads of them, but they have to have different names.
var compressor = new maximJs.maxiDyn(); //this is a compressor
var out = 0;
compressor.setAttack(100);
compressor.setRelease(300);
compressor.setThreshold(0.25);
compressor.setRatio(5);
loadSample('./beat2.wav', beats);
}
audio.outputIsArray(true, 2);
maximJs.maxiAudio.play = function(){
compressor.setAttack(100);
compressor.setRelease(300);
compressor.setThreshold(0.25);
compressor.setRatio(5);
audio.loadSample('audio/beat2.wav', beats);
audio.play = function(){
if(beats.isReady()){
//here, we're just compressing the file in real-time
//arguments are input,ratio,threshold,attack,release
out=compressor.compress(beats.play());
// out=compressor.compress(beats.play(0.66));
// out=compressor.compress(beats.play(0.66));
}
this.output[0]=out;
this.output[1]=out;
}
output[0]=out;
output[1]=out;
}
</pre>
</body></html>
......@@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<!-- Our javascript code -->
<script type="text/javascript">
maximJs.maxiAudio.init();
// maximJs.maxiAudio.utputIsArray(true, 2);
var audio = new maximJs.maxiAudio();
audio.init();
</