Skip to content

Instantly share code, notes, and snippets.

@walmik
Last active July 18, 2019 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walmik/08b1036b72790d1ce2e12feaa65e0fdb to your computer and use it in GitHub Desktop.
Save walmik/08b1036b72790d1ce2e12feaa65e0fdb to your computer and use it in GitHub Desktop.
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