Skip to content

Instantly share code, notes, and snippets.

@walmik
Last active October 22, 2019 13:50
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/f3d2a0557810c68fa2e40ecff9f32343 to your computer and use it in GitHub Desktop.
Save walmik/f3d2a0557810c68fa2e40ecff9f32343 to your computer and use it in GitHub Desktop.
Create a commonly used dance music riff using just Scribbletune
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;
};
const pattern = getRandomPattern();
const clipA = scribble.clip({
notes: 'D2',
randomNotes: scribble.arp(
scribble.getChordsByProgression('D2 minor', 'ii iii')
),
pattern,
subdiv: '16n',
});
const clipB = scribble.clip({
notes: 'D2',
randomNotes: scribble.arp(
scribble.getChordsByProgression('D2 minor', 'iii v')
),
pattern,
subdiv: '16n',
});
scribble.midi([].concat(clipA, clipA, clipA, clipB), 'riff.mid');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment