Skip to content

Instantly share code, notes, and snippets.

@aunyks
Created June 20, 2020 20:18
Show Gist options
  • Save aunyks/3a8ad15864f299d96651a562080a74c3 to your computer and use it in GitHub Desktop.
Save aunyks/3a8ad15864f299d96651a562080a74c3 to your computer and use it in GitHub Desktop.
A quick Node script for generating a couple MIDI files that make a tune, together.
const {
clip,
scale,
midi,
arp,
getChordsByProgression
} = require('scribbletune')
const progression = getChordsByProgression('d2 major', 'I VI ii V')
const lowerProgression = getChordsByProgression('d1 major', 'I VI ii V')
const arpNotes = arp({
chords: progression,
order: '0121'
})
const chords = clip({
notes: progression,
pattern: 'x__-x__-x__-x__'
})
const arpeggios = clip({
notes: arpNotes,
pattern: 'xxxx'.repeat(4)
})
// I kept rerunning this script to generate
// new melodic patterns and just concatenated
// each new melody together to get the melody in the final sound
const melody = clip({
notes: scale('d4 major'),
pattern: 'xxx[xx]--xx'.repeat(8),
shuffle: true,
})
midi(chords, 'chords.mid')
midi(arpeggios, 'arpeggios.mid')
midi(melody, 'melody.mid')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment