Scribbletune is a free open source JavaScript node which is designed to help and construct musical ideas with JavaScript and export them as MIDI files. Scribbletune can also be used with Ableton and Max for Live.

Here is some sample code as an idea of what Scribbletune does

Scribbletune can be used to create random chords, generate riffs, breakbeats and even drum and bass riffs. It can also be used in conjunction with online software such as Johann which is a web application used for generating charts for guitars, piano and computer keyboards to practice scales and chords.

Scribbletune is demoed and presented at JavaScript meetups (and recently Electronic Music meetups) across the US and is a game changer for creating music.

Their website is here and as well as explaining its use also gives a link to GitHub where it can easily be downloaded.

Piece of Pokemon music created in Scribbletune