Last active
July 18, 2019 08:41
-
-
Save walmik/08b1036b72790d1ce2e12feaa65e0fdb to your computer and use it in GitHub Desktop.
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]); | |
notes.push(chord[1]); | |
pattern = pattern + 'xx' | |
} else { | |
// use a quarter note and 2 eigth notes | |
notes.push(chord[0]); | |
notes.push(chord[1]); | |
notes.push(chord[2]); | |
pattern = pattern + 'x[xx]' | |
} | |
}); | |
const clip1 = scribble.clip({ | |
notes, | |
pattern: pattern | |
}); | |
const clip2 = scribble.clip({ | |
notes, | |
pattern: pattern, | |
subdiv: '2n' | |
}); | |
scribble.midi(clip1, 'clip1.mid'); | |
scribble.midi(clip2, 'clip2.mid'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment