This is a class used for storing all of the data that is needed for producing a performance with Konduktiva, including Players, Actions, IOI functions, RhythmMaps, and so on. You populate the MusicalEnvironment with Players, IOI functions, and action functions. The tempo exists as a property of this MusicalEnvironment.
The constructor takes no arguments. Call it to get a default MusicalEnvironment which can then be adjusted to your needs.
e = new MusicalEnvironment();
The titles of each variable in this documentation are aimed at giving as much information as possible. For example, the first title "bools: boolean[]". "bools" is the variable name and "boolean[]" tells you that the variable bools is supposed to be an array full of booleans.
Actions functions that can be used are stored here.
Chord progressions that players can use. The keys are the beats/time of when the player should change the playing chord progression.
Not filling this in deactivates this specific feature.
Control Change maps players can use. The keys are the beats/time of when to send the actual CC messages in the values.
Shows the current beats per measure. Default is 4.
An array of densityGraph names. The acutal densityGraphs are stored in the densityGraphs variable.
Returns the current tempo of the MusicalEnvironment. To change the tempo use the changeTempo method.
An object filled with densityGraphs. The actual graphs are in form of QuantizedMaps. So, it is a QuantizedMap in an object in another object.
IOI function are stored here.
Returns the lookahead time.
maskMaps are basically the booleans. The keys are the time and the values are trues or falses. If it is a true for a specific time, the action function will be called. If it is a false, action function will not be called.
Not filling this in will deactivate this specific feature.
Sets the amount of midi notes a player is allowed to play at a given beat. The keys are the beats and the values are the amount of midi notes the player is allowed to play.
The mode players should filter.
The keys and values of modeFilters should be at a given beat. The modeMaps values are strings which are names of modes. The modes currently available as of the time of writing are, ionian, dorian, phrygian, lydian, mixolydian, aeolian, locrian. To get all of the Modes available to you, run this line of code after loading Konduktiva into nodejs. Mode.all().forEach(x => console.log(x.name))
This will list all the modes the tonal library has available.
These QuantizeMaps store how long each note should play for at a given beat. They are the note spans. The keys are the beats and the values are the CONFIRMING WITH BELL ON HOLD
Stores the noteValues. The keys is the beats and the values are the notes to play.
Two options `
relativeSemitoneor
relativeScaleDegree`
. This changes how the action function uses the noteMaps
Stores the octaves the action function should use at a given beat. The keys are the beats and the values are the octaves to use.
An array full of midi outputs that can be used by easymidi. To update this list run this function `
updateMidiOutputList(e)`
. Replace `
e`
with your MusicalEnvironment variable name.
An array full of player objects. Find out more by looking at the player section.
CHECK WITH BELL
Needed to call `
rhythmPattern.add(e, playerName) for things to work correctly. Ask bell.
The root letter. By default it is 'A'c
Stores the root English letters. The keys are the beats and the values are the English letters.
Tasktimer? ASK BELL
Not filling this in deactivates this specific feature.
The chord progression a player should play at a given beat. The keys are the beats and the values are the chord progression names in form of strings. The action function will check if the chordProgression map is playing the correct chord progression according to this.c
Controls the midi velocity variable from 0-127 at a given beat. The keys are the beats and the values are the velocity.
-> Number
Returns the current beat of the MusicalEnvironment
e.currentBeat()
console.log(e.currentBeat())
Number ->
Takes a number as an argument and changes the currentTempo to that number.
e.changeTempo(tempo)
New tempo of the current MusicalEnvironment
console.log(e.changeTempo(100)) //TEMPO CHANGE! time: 5.690928572999313; beat: 8.493846618000418 console.log(e.changeTempo(120)) //TEMPO CHANGE! time: 22.66408885199949; beat: 36.78241345300153
string -> Function
Returns the action function of a specific player in this MusicalEnvironment Takes player name in form of a string as an argument.
e.getAction(player)
Name of a variable in e.players
console.log(e.getAction('kick')) //[Function (anonymous)] console.log(e.getAction('snare')) //[Function (anonymous)]
string -> Function
Returns the IOI function of a specific player in this MusicalEnvironment.
e.getIOIFunc(player)
Name of a variable in e.players
console.log(e.getIOIFunc('kick')) //[Function: defaultIOI] console.log(e.getIOIFunc('snare')) //[Function: defaultIOI]
ASK BELL string ->
Returns the IOI function of a specific player in this MusicalEnvironment. Not meant to be called by user.
e.scheduledPlayers(player)
Name of a variable in e.players
e.scheduleEvents('musicSynthesizerSession1')
Starts the scheduler for the MusicalEnvironment. It takes no arguments and returns nothing.
e.startScheduler()
e.startScheduler()
Stops the scheduler for the MusicalEnvironment. Takes no arguments and retunrs nothing.
e.stopScheduler()
e.stopScheduler()
String ->
e.play(player)
Player name
e.play('musicSynthesizerSession1')
String ->
e.stop(player)
Player name
e.stop('musicSynthesizerSession1')
->
Returns an array of all the player names.
e.allPlayers()
console.log(e.allPlayers)
-> [[String, String] ...]
Returns an array full of arrays. Each sub array contains the player name and their status. All the player names and their status also gets logged into the console.
e.allPlayerStatus()
console.log(e.allPlayerStatus()) /* [ [ 'kick', 'stopped' ], [ 'snare', 'stopped' ], [ 'perc', 'stopped' ], [ 'hat', 'stopped' ], [ 'sub', 'stopped' ], [ 'stab1', 'stopped' ], [ 'stab2', 'stopped' ], [ 'atmo', 'stopped' ], [ 'musicSynthesizerSession1', 'stopped' ] ] */
->
Returns an array of all the names of players that are currently playing.
e.playingPlayers()
console.log(e.playingPlayers()) //[]
[String] ->
Starts playing all the player names in the array.
e.playN(ps)
An array of player names.
e.playN(['musicSynthesizerSession1', 'musicSynthesizerSession2'])
[String] ->
Stops playing all the player names in the array.
e.stopN(ps)
An array of player names.
e.stopN(['musicSynthesizerSession1', 'musicSynthesizerSession2'])
->
All players start playing.
e.playAll()
e.playAll()
->
All players stop playing.
e.stopAll()
e.stopAll()
[String] ->
Stops playing all the player names in the array after checking if the players exist inside the MusicalEnvironment.
e.solo(ps)
An array of player names.
e.stopN(['musicSynthesizerSession1', 'musicSynthesizerSession2'])
String ->
Toggles the state of a specific player. If that player is playing it will be stopped. If that player is stopped, it will start playing.
e.togglePlayer(p)
Player name
e.togglePlayer('musicSynthesizerSession1')
There are different ways you can interacte and change things in the MusicalEnvironment. You can change it by doing `
e.variable = `
. This way is excellent if you are familliar with what you are doing and if you have time. When live coding we often have to act and think quickly. When doing this is is especially easy to make mistakes when making QuanitzedMaps.
This function helps add QuantizedMaps into the MusicalEnvironment with correct types. If something is wrong, this function will throw an error.
addMapToMusicalEnvironment (e, objectName, mapName, keyspan, keys, values)
MusicalEnvironment
Name of a variable in the MusicalEnvironment to add to.
Name of the new QuantizedMap.
Th keyspan of the new QuantizedMap.
The keys of the new QuantizedMap.
The values of the new QuantizedMap.
addMapToMusicalEnvironment(e, 'rhythmMaps', 'chalk', 10, [0, 1, 2, 3], [4, 5, 6, 7]) console.log(e.rhythmMaps.chalk) /* QuantizedMap { keyspan: 1, keys: [ 1 ], values: QuantizedMap { keyspan: 10, keys: [ 0, 1, 2, 3 ], values: [ 4, 5, 6, 7 ] } } */