Scribbletune is a Node.js module that helps you construct musical ideas with JavaScript String & Array functions and export them as MIDI files. You can also use Scribbletune in the browser!

npm install scribbletune

Let's put something together. Create a file called chords.js and paste the following in it,

const scribble = require('scribbletune');

// Create a clip that contains a musical idea
let clip = scribble.clip({
	notes: 'F#m C#m DM Bm EM AM DM C#m AM',
	pattern: '[xx][x-]'.repeat(8)

scribble.midi(clip, 'chords.mid');

Now execute that file in the terminal at the same location as you saved it,

node chords.js

This will generate a MIDI file called chords.mid in the same location as you executed this script. Here's how it sounded when I imported it into Garage Band and used the Synthesizer > EDM Chord > Sunrise Chords virtual instrument with a little reverb:

This is just a humble beginning. You can do a lot more with Scribbletune! Read the documentation or show your Star this project on Github!