Random Chords
If you randomly pick 2 or 3 notes from a scale or mode, you’ll end up creating random chords. They won’t necessarily sound good, but since we will use JavaScript for this, we can generate a bunch of chord progressions and tweak something that we like from that bunch. We will use lodash for the random picking.
Write your own script
We will create a new file called random-chords.js
and start by importing our dependencies.
const _ = require('lodash');
const scribble = require('scribbletune');
For the set of notes, we’ll start with the C major scale and a simple pattern:
const setOfNotes = scribble.scale('C3 major');
const pattern = 'x___'.repeat(4);
Now we need to get the count of x
in this pattern so that we can generate that many random chords.
const count = pattern.replace(/[^x]/g, '').length;
Next, we’ll randomly pick 3 notes from our set for each x
:
const notes = [];
for (let i = 0; i < count; i++) {
notes.push(_.sampleSize([...setOfNotes], 3));
}
And that should be good enough to produce our MIDI file:
scribble.midi(
scribble.clip({
notes,
pattern,
})
);
Finally, execute this file in your terminal with Node.js:
node random-chords.js
Ready to roll
You can use any DAW to do the rest of the steps. I use Ableton Live and a bunch of fancy third-party VSTs, hence I created a group instrument combining Jupiter 8 V3 and Hive 2. On rendering the MIDI it sounded like this: