Jazz improvisation engine for Sharp11
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
sample
.gitignore
LICENSE
README.md
index.js
package.json
test.js

README.md

sharp11-improv

Jazz improvisation engine for Sharp11. To see it in action, check out the Sharp11 web client.

API

var improv = require('sharp11-improv')

Contains an ImprovChart object, which can be created with improv.overChart()

Exported Functions

overChart .overChart(chart, settings)

Improvises over a Chart object given an optional settings object and returns an ImprovChart object. The settings object can contain any of the following properties:

  • dissonance - A number (0 to 1) or a numerical range. A higher value means the improv engine is more likely to select a less common / more dissonant scale according to scale precedence. Default value is 0.5.
  • changeDir - A number (0 to 1) or a numerical range. A higher value means the improv engine is more likely to change directions while traversing up or down a scale. The probability of changing direction is equal to the value of changeDir. Default value is 0.25.
  • jumpiness - A number (0 to 1) or a numerical range. A higher value means the improv engine is more likely to jump to a random note in the current scale. The probability of jumping is equal to the value of jumpiness. Default value is 0.25.
  • rests - A number (0 to 1) or a numerical range. A higher value means the improv engine is more likely to insert a rest (currently the same as extending the previous note). The probability of inserting a rest is equal to the value of rests. Default value is [0.35, 0].
  • rhythmicVariety - A number (0 to 1) or a numerical range. A higher value means the improv engine is more likely to use triplets or sixteenths rather than eighth notes. The probabilities of the improv engine inserting a measure of triplets or a measure of sixteenth notes are each one third the value of rhythmicVariety. Default value is [0, 0.75].
  • useSixteenths - A boolean. If false, the improv engine will not use sixteenth notes and the probability of it using triplets becomes half the value of rhythmicVariety. Default value is true.
  • onlyEighthRests - A boolean. If true, the improv engine will only put rests in measures of eighth notes and not in measures of triplets of sixteenth notes. Default value is false.
  • range - An array containing two Note objects or strings. The improv engine will only use notes within the given range (inclusive). Default value is [C4, C6].
  • sections - An array listing the sections of the Chart object to improvise over and in what order. By default, it will improvise over the original song form.
  • repeat - A number representing the number of times to repeat the form when improvising. Default value is 1.
  • cadence - A boolean. If true, the improvisation will end by returning to the first chord of the form. Default value is true.

Note: Some settings can take a numerical range instead of a number. A numerical range is given as an array containing two values. When improvising, the improv engine starts with the value set to the first element of the array and adjusts it linearly throughout the improvisation, reaching the second value by the end of the improvisation.

isImprovChart .isImprovChart(object)

Returns true if a given object is an ImprovChart.

ImprovChart Object

An ImprovChart represents an improvisation over a Chart.

chart .chart

The Chart object being improvised over.

settings .settings

An object containing all the settings used for this improvisation.

data .data

An array of objects representing the notes that have been improvised for a given chord change. Each object contains the following properties:

  • chord - A Chord object representing the chord change.
  • scale - A Scale object representing the scale that was chosen for improvising over the chord change.
  • notes - An array of beats. Each beat is an array of two (eighth), three (triplet), or four (sixteenth) notes. Notes can either be Note objects or null, representing rests.
  • duration - A Duration object representing the duration of the chord change.

notesAndDurations .notesAndDurations()

Returns an array of objects representing the notes in the improvisation. Each object has a key note that corresponds to a Note object or null for a rest, and a key duration that corresponds to a Duration object.

chordsAndDurations .chordsAndDurations()

Returns an array of objects representing the chords in the improvisation. Each object has a key chord that corresponds to a Chord object, and a key duration that corresponds to a Duration object.

midi .midi(settings)

Returns a Midi object for the improvisation with given settings.