This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('lodash'); | |
const scribble = require('scribbletune'); | |
const setOfNotes = scribble | |
.scale('C3 lydian') | |
.concat(scribble.scale('C4 lydian')); // or simply scribble.scale('C3 major') OR manually set the notes | |
const pattern = 'x__[xx]x_x_'.repeat(8); // or a simple one 'x___'.repeat(4) | |
const count = pattern.replace(/[^x]/g, '').length; | |
const notes = []; | |
for (let i = 0; i < count; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pickOne = arr => | |
arr.length > 1 ? arr[Math.round(Math.random())] : arr[0]; | |
const dice = () => !!Math.round(Math.random()); | |
const getProgFactory = ({ T, P, D }) => { | |
return (count = 4) => { | |
const chords = []; | |
// Push root/tonic | |
chords.push(pickOne(T)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Make sure you have Node version 8+ installed locally and you have run `npm install scribbletune` before running this script | |
const scribble = require('scribbletune'); | |
const ptn = 'xxxx'.repeat(7); | |
const A = 'xxx[x[RR]]'; | |
const B = 'xx[x[RR]][x[RR]]'; | |
const C = 'x-[x[RR]]'; | |
const kick = scribble.clip({ | |
pattern: ptn + A + ptn + B + ptn + A + ptn + C, | |
notes: 'c4', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scribble = require('scribbletune'); | |
const chords = scribble.getChordsByProgression('C4 minor', 'ii III ii v'); //i III ii v | |
const notes = []; | |
let pattern = ''; | |
chords.split(' ').forEach((c, i) => { | |
const chord = scribble.chord(c); | |
if (i % 2 !== 0) { | |
// use 2 quarter notes | |
notes.push(chord[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const scribble = require('scribbletune'); | |
const getRandomPattern = function(count = 8) { | |
let str = '[x-]R'; | |
for (let i = 1; i < count; i++) { | |
str += Math.round(Math.random()) ? '[x-]R' : 'R[x-]'; | |
} | |
return str; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onload = init; | |
var context; | |
var bufferLoader; | |
function BufferLoader(context, urlList, callback) { | |
this.context = context; | |
this.urlList = urlList; | |
this.onload = callback; | |
this.bufferList = new Array(); | |
this.loadCount = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doubleCheck(arr, intgr) { | |
var bool = false; | |
arr = arr.sort(function(a,b) {return a-b;}); | |
console.log(arr); | |
while(arr.length) { | |
var num = arr.shift(); | |
for(var i=0; i<arr.length; i++) { | |
console.log('iteration' + arr[i]); | |
if(num + arr[i] === intgr) { | |
return true; |