Last active
July 19, 2019 20:22
-
-
Save walmik/8c20b24492661f8ee5c1b7d6e9434108 to your computer and use it in GitHub Desktop.
This a simple script that will create a few MIDI files with a slight variation each time you run it with nodejs on the terminal
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', | |
}); | |
scribble.midi(kick, 'kick.mid'); | |
const ch = scribble.clip({ | |
pattern: '[xR][[x[xR]]]'.repeat(16), | |
notes: 'c4', | |
sizzle: 'sin', | |
sizzleReps: 32, | |
}); | |
scribble.midi(ch, 'ch.mid'); | |
const bass = scribble.clip({ | |
notes: 'Bb2', | |
pattern: '[-xRx][-xRR][-xRx][-xxR]'.repeat(2), | |
randomNotes: scribble.scale('Bb2 minor').slice(1), | |
accent: '--x-', | |
}); | |
const bassEnd = scribble.clip({ | |
notes: 'G#2', | |
pattern: '[-xRx][-xRR][-xRx][-xxR]'.repeat(2), | |
randomNotes: scribble.scale('Bb2 harmonic minor').slice(2, 5), | |
accent: '--x-', | |
}); | |
scribble.midi(bass.concat(bassEnd), 'bass.mid'); | |
const sA = '-x-x'; | |
const sB = '-[xR]-[Rx]'; | |
const snare = scribble.clip({ | |
notes: 'c4', | |
pattern: (sA + sA + sB + sA + sA + sB + sA + sA).repeat(4), | |
}); | |
scribble.midi(snare, 'snare.mid'); | |
const oh = scribble.clip({ | |
notes: 'c4', | |
pattern: '[-x][Rx][Rx][Rx]'.repeat(8), | |
}); | |
scribble.midi(oh, 'oh.mid'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment