Ejemplo n.º 1
0
#!/usr/bin/env node

var codetraxx = require('beatduino-helpers');
var exec = require('child_process').exec;

function playrrr(wav, tickCounter ){
    exec("play " + wav + " echo 0.8 0.88 " + tickCounter % 60 + " 0.4");
}

HATZ = ["wavs/WuTangDrumz/Perkussin/WU_HH_113.wav","wavs/WuTangDrumz/Perkussin/Wu_1p_108_.wav", "wavs/WuTangDrumz/Perkussin/Wu_1p_69_.wav", "wavs/WuTangDrumz/Perkussin/Wu-RZA-Hat71.wav"]

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);
  randNum = codetraxx.randyNum(5);
  if (/[13]/.test(beat) || /[34]/.test(microTick) && Math.round(Math.random()*1)) {
    exec("play " + HATZ[0]);
    //console.log("SKIP!");
  } else {
    console.log("PLAY!");
    setTimeout( function() {
      return playrrr(HATZ[1],tickCounter);
    },randNum);
  }
});
Ejemplo n.º 2
0
var baudio  = require('baudio');

var tau = Math.PI * 2;

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  //console.log("BPM: " + bpm + " BEAT: " + beat + " MICROTICK: " + microTick + " TICKCOUNTER: " + tickCounter);

  //if (/[15]/.test(beat) && /[1]/.test(microTick) && !nowplaying) {
  //if (/[15]/.test(beat) && /[1]/.test(microTick) && !nowplaying) {
  if (/[1]/.test(microTick) && !nowplaying) {
   nowplaying = 1;
   var b = baudio(function (t) {
     //console.log(t);
     vol = "0." + (Math.floor(t % 4) + 1);
     diff = bpm / 60;

     return (sin(165) + sin(165 + diff)) / 2;
     //return (sin(330) + sin(330 + diff)) / 2;

      //function sin (x) { return Math.sin(tau * multi * x); }
      function sin (x) { return Math.sin(tau * (t/2) * x); }
      function square (x) { return sin(x) > 0 ? 1 : -1; }
      function saw (x) { return 1-2*(t%(1/x))*x ;}
    });
    b.play();

  }

});
Ejemplo n.º 3
0
codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

  //if (/[15]/.test(beat) && /[14]/.test(microTick) ) {
  //if (/[157]/.test(beat) && /[13]/.test(microTick) ) {
  if (/[145]/.test(beat) && /[134]/.test(microTick) ) {
  //if (/[137]/.test(beat) && /[14]/.test(microTick) ) {
  //if (/[1]/.test(beat) && /[1]/.test(microTick) ) {
  //if (/[13]/.test(beat) && /[1]/.test(microTick) ) {
    console.log("MICROTICK IS A " + typeof microTick);
    //playrrr(KICKZ[0],tickCounter);
  }
  //if (/[35]/.test(beat) && /[13]/.test(microTick) ) {
  var randClick= randyNum(3);
  if (/[57]/.test(beat) && randClick == microTick ) {
    console.log("survived! " + randClick);
    playrrr(KICKZ[1], tickCounter);
    exec("play " + KICKZ[2] + " bass +3 allpass " + tickCounter % 37 + " 1 treble " + tickCounter % 76);
  }
  //if (/[26]/.test(beat) && /[12]/.test(microTick) ) {
  if (/[2468]/.test(beat) && /[1]/.test(microTick) ) {
    console.log("zzzzZMICROK IS A " + typeof microTick);
    playrrr(CLAP, tickCounter);
    randNum = randyNum(7);
    setTimeout( function() {
      return playrrr(SNAREZ[1], tickCounter);
    }, randNum);
  }
  if (/[24]/.test(beat) && /[1]/.test(microTick) ) {
    if (randyNum(23) > 22) {
      setTimeout( function() {
        return playrrr(SAMPLEZ,tickCounter);
      }, randNum);
    }
  }
});
Ejemplo n.º 4
0
var REVCRASH = "wavs/TrpDrumz/Crash/Rev\\ Crash\\ \\(2\\).wav";
var HAT1 = "wavs/WuTangDrumz/Perkussin/Wu-RZA-Hat1.wav";
var SNARE = "wavs/WuTangDrumz/Cynerz/Wu\\ Snarez/W1_S\\ \\(20\\).wav";

function playrrr(wav) {
	exec("play " + wav + " bass +7 echo 0.8 0.88 60 0.4");
}

codetraxx.subscribe('bpm', function(msg) {
	var bpm = msg.bpm,
		microTick = msg.microTick,
		tickCounter = msg.tickCounter,
		beat = msg.beat;
	console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

	playrrr(HAT1);

	if (/[1357]/.test(beat) && microTick == 1) {
		playrrr(KICK);
		if (beat == 1 && microTick == 1) {
			playrrr(REVCRASH);
		}
	} else if (beat == 5 && microTick == 2) {
		playrrr(KICK);
	} else if (beat == 4 && microTick == 1) {
		playrrr(CRASH);
	} else if (/[2468]/.test(beat) && microTick == 1) {
		playrrr(SNARE);
	}
});
Ejemplo n.º 5
0
    // var xs = [ (1200 / t), t, 240, 450, 20 ]; // works
    var xs = [ (1200 / t), donk, 240, 450, n * tau ];

    var speed = tt % 8 > 7 ? 16 : 2;
    var x = xs[Math.floor(t*speed)%xs.length]
    //var z = tt % 8 < 7 ? 1000 : 80;

    //var f = x + Math.sin(z * (t % 1));

    var noisee = 0.15 * Math.sin(tau * x * (t / bpm));
    //codetrax.publish('bzz', noisee);
    // nowplaying = 0;
    return (noisee);

});

   b.play();

};

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " BEAT: " + beat + " MICROTICK: " + microTick + " TICKCOUNTER: " + tickCounter);

  if (/[15]/.test(beat) && /[1]/.test(microTick) && !nowplaying) {
   console.log("hola");
   baudio_funct(tickCounter);
  }

});
Ejemplo n.º 6
0
#!/usr/bin/env node

var codetraxx = require('beatduino-helpers');
var nowplaying = 0;
var baudio  = require('baudio');

var tau = Math.PI * 2;

var xzzz, yzzz, zzzz, Gx, Gz;

codetraxx.subscribe( 'motion', function(msg) {
  xzzz = msg.x, yzzz = msg.y, zzzz = msg.z, Gx = msg.Gx, Gy = msg.Gy, Gz = msg.Gz;
  console.log("Dance human! : " + msg);
});

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;

  if (/[1]/.test(microTick) && !nowplaying) {
   nowplaying = 1;
   var b = baudio(function (t) {

     multi = (t * (bpm / 60));
     vol = "0." + (Math.floor(t % 4) + 1);
     diff = bpm / 60;
     //return (sin(130) + sin(130 + diff)) / 2;
     //return (sin(130) + sin(122) * diff) / 2; // SWEET SPOT
     return (sin(130) + sin(127) * diff) / 2;
     //return (sin(130) + sin(130 + diff)) * Gx / 2;
     //return (sin(130) + sin(17 * yzzz) + square(zzzz)) / 2;
Ejemplo n.º 7
0
  console.log("loser! need a program tae monitor and a time to run in seconds..");
  process.exit(1);
}

runtime = runtime * 1000;

console.log("\n\n****\nMUTHAFUCKA - THIS IS THA VOICE OF DA KINGPING - MONITORING YO SHITTY ASS " + prog + " -- KEEP IT REAL BEATCH!\n\n*******\n");


codetraxx.subscribe('bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  if (/[3]/.test(beat) && /[1]/.test(microTick) && !nowplaying) {
    nowplaying = 1;
    var server = cp.fork(prog);
    console.log(prog + ' started');

    setInterval(function(){
      server.kill();
      console.log(prog + ' stopped');
      nowplaying=0;
    },runtime);

    process.on('SIGINT', function () {
        server.kill();
        process.exit();
    });
  }
});


Ejemplo n.º 8
0
#!/usr/bin/env node

var codetraxx = require('beatduino-helpers');
var exec = require('child_process').exec;

var KICK = "wavs/TrpDrumz/Kicks/Kick_7_.wav";
var KICK2 = "wavs/WuTangDrumz/WTC_kyKX/Wu-RZA-Kick69.wav";
var KICK3 = "wavs/KickDrum0013.aif";
var SAMPLEZ = "wavs/TrpDrumz/DJDrops/DjDrop.wav";
//var SNARE = "wavs/SnareDrum0012.aif";
var SNARE = "wavs/Clap.aif";

function playrrr(wav ){
  exec("play " + wav + " bass +7 echo 0.8 0.88 60 0.4");
}

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

  if (/[56]/.test(beat) && microTick == 3 && Math.round(Math.random()*1)) {
    console.log("SNEAKY!");
    exec("play " + SAMPLEZ + " bass +3");
  }
});
Ejemplo n.º 9
0
var KICK3 = "wavs/KickDrum0013.aif";
//var SNARE = "wavs/SnareDrum0012.aif";
var SNARE = "wavs/Clap.aif";

function playrrr(wav ){
  exec("play " + wav + " bass +7 echo 0.8 0.88 60 0.4");
}

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

  if (/[1357]/.test(beat) && microTick == 1) {
    console.log("MICROTICK IS A " + typeof microTick);
    if (beat % 7 === 0 || beat % 3 === 0 ) {
      console.log("Modulo beatches!");
      exec("play " + KICK2 + " " + KICK3 + " bass +3");
    } else {
      playrrr(KICK);
    }
  } else if (/[2468]/.test(beat) && microTick == 1) {
    randNum = codetraxx.randyNum(10);
    setTimeout( function() {
      return playrrr(SNARE);
    },randNum);
  } else if (/[5]/.test(beat) && microTick == 3 && Math.round(Math.random()*1)) {
    console.log("SNEAKY!");
    exec("play " + KICK2 + " " + KICK3 + " bass +3");
  }
});
Ejemplo n.º 10
0
codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  //console.log("BPM: " + bpm + " BEAT: " + beat + " MICROTICK: " + microTick + " TICKCOUNTER: " + tickCounter);

  // if (/[1]/.test(beat) && /[1]/.test(microTick) && !nowplaying) {
  //if (/[1]/.test(microTick) && !nowplaying) {
  if (microTick && !nowplaying) {
   nowplaying = 1;
   var b = baudio(function (tt, tickCounter) {

     //var xs = [ 30, 60, 90, 120, 700 ];
     //var xs = [ 34747, 3/5 ];
     //var xs = [ 47, 3/5 , 0, 1477 ];
     // var xs = [ 74, 5, 7, 44   ];
     var xs = [ 71, 45, 7, 44   ];
     var z = tickCounter % 7 < 4 ? 1200 : 13;
     var x = xs[Math.floor( tt * z * tau)  % xs.length]
     // var f = x + sin(z * (t % 1));
     var multi = tt * ( bpm / 60) ;

     return (
           //sin(multi) * sin(x) *  0.3713
           sin(x) *  0.17
     );

      function sin (x) {
          return Math.sin(tau * multi * x);
      }
    });
    b.play();

  }

});
Ejemplo n.º 11
0
var baudio = require('baudio');
var codetraxx = require('beatduino-helpers');

var tau = 2 * Math.PI;

var melody = [0, 440, 880, 220, 0, 220, -220, 330].map(function(x) {
	return Math.pow(2, x)
});

var bpm = false;
var firstTick = false;

codetraxx.subscribe('bpm', function(msg) {
	if (!firstTick) {
		firstTick = msg.tickCounter;
	}

	if (msg.beat == 1 && msg.microTick == 1 && !bpm) {
		bpm = parseInt(msg.bpm);
		var b = baudio(function(t) {
		var m = melody[Math.floor(t * bpm / 60 % melody.length)];
		return sin(400 * m) * .1;

		function sin(freq) {
			return Math.sin(tau * t * freq);
		}
		});
		b.play();
	}
});
Ejemplo n.º 12
0
  exec("play " + wav + " bass +7 echo 0.8 0.88 " + tickCounter % 60 + " 0.4");
}

codetraxx.subscribe( 'bpm', function(msg) {
  var bpm = msg.bpm, microTick = msg.microTick, tickCounter = msg.tickCounter, beat = msg.beat;
  console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

  if (/[1]/.test(beat) && microTick == 3 && Math.round(Math.random()*1)) {
    console.log("MICROTICK IS A " + typeof microTick);
    playrrr(SOUNDFX1, tickCounter);
    //if (tickCounter % 7 === 0 || beat % 3 === 0 ) {
    //  console.log("Modulo beatches!");
    //} else {
    //  playrrr(SOUNDFX2);
    //}
  } else if (/[7]/.test(beat) && /[3]/.test(microTick) && Math.round(Math.random()*1) && Math.round(Math.random()*1)) {
    //randNum = codetraxx.randyNum(40);
    //var CUR_SNARE = "SNARE" + codetraxx.randyNum(3);
    //console.log("CURSNARE :" + CUR_SNARE);
    //playrrr(SOUNDFX3);
    //setTimeout( function() {
    //  return playrrr(CUR_SNARE);
    //},randNum);
    playrrr(SOUNDFX5, tickCounter);

  } else if (/[37]/.test(beat) && /[1]/.test(microTick) && Math.round(Math.random()*1)) {
    console.log("SNEAKY!");
    playrrr(SOUNDFX4, tickCounter);
  }
});
Ejemplo n.º 13
0
codetraxx.subscribe('bpm', function(msg) {
	var bpm = msg.bpm,
		microTick = msg.microTick,
		tickCounter = msg.tickCounter,
		beat = msg.beat;
	//console.log("BPM: " + bpm + " MICROTICK: " + microTick + " TICK COUNTER: " + tickCounter + " and BEAT is: " + beat);

	if (/[15]/.test(beat) && microTick == 1) {

		playrrr(KICK);
		if (beat == 1 && microTick == 1) {
			playrrr(ticktick);
		}
	} else if (beat == 5 && microTick == 2) {
		playrrr(KICK);
	}

	if (beat == 1 && /[124]/.test(microTick)) {
		playrrr(HAT1)
	}

	if (tickCounter % 64 == 0) {
		var coin = Math.floor(Math.random() * 100);
		if (coin / 2 == Math.floor(coin / 2)) {
			playrrr(tractorBeam);
		}
	}
	
	if (tickCounter % 48 == 0) {
		var coin = Math.floor(Math.random() * 100);
		if (coin / 2 == Math.floor(coin / 2)) {
			playrrr(bleepbleep);
		}
	}


});