creating-players

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
creating-players [2024/02/29 01:06] – [Syntax] steve.wangcreating-players [2024/03/18 20:22] (current) – [Example] steve.wang
Line 3: Line 3:
 **Overview: ** This tutorial will teach you how to create your own players like the ones that came with the example MusicalEnvironment. **Overview: ** This tutorial will teach you how to create your own players like the ones that came with the example MusicalEnvironment.
  
-**Things To Note:** This tutorial assumes you have already installed Konduktiva successfully using the [[https://github.com/renickbell/konduktiva|Konduktiva installation]] instructions and have read through and understood the [[:first_steps|first steps tutorial]]. The tutorial also assumes that you have imported Konduktiva to the //K// variable and assigned any of the example MusicalEnvironments to the //e// variable.+**Things To Note:** This tutorial assumes you have already installed Konduktiva successfully using the [[https://github.com/renickbell/konduktiva|Konduktiva installation]] instructions and have read through and understood the [[:first_steps|first steps tutorial]]. The tutorial also assumes 2 things. One, Konduktiva has been assigned to the //K// variable. Two, user created a Musical Environment using the //setUpMusicalEnvironment// function using //K.defaultConfigurationObject// as the first argument and //'exampleMidiPlayer'// as the third argument then, assigned the output to the //e// variable. 
 +<code javascript> 
 +const K = require('konduktiva'
 +let e = K.setUpMusicalEnvironment(K.defaultConfigurationObject,4,'exampleMidiPlayer', K.exampleMusicalEnvironmentsExtraConfig) 
 +</code>
  
  
Line 115: Line 119:
 </code> </code>
  
-==== Parameters +==== Parameters ====
 === noteValueData === === noteValueData ===
 The configuration object. The configuration object.
Line 128: Line 132:
 //Create configuration object: //Create configuration object:
 let simpleMelodyData = K.R.clone(K.simpleMelodyDataTemplate) let simpleMelodyData = K.R.clone(K.simpleMelodyDataTemplate)
 +//K.simpleMelodyDataTemplate is a simple template of a configuration object
 simpleMelodyData.velocity = [100, 100, 100, 100] simpleMelodyData.velocity = [100, 100, 100, 100]
-simpleMelodyData.rhythmMap = [1, 234]+simpleMelodyData.rhythmMap = [1, 111]
 simpleMelodyData.noteValues = [[1], [2], [3], [4]] simpleMelodyData.noteValues = [[1], [2], [3], [4]]
 simpleMelodyData.rootMap = [ 'C', 'C', 'C', 'C' ] simpleMelodyData.rootMap = [ 'C', 'C', 'C', 'C' ]
  
 //Add it to MuiscalEnvironment: //Add it to MuiscalEnvironment:
-recordConfigurationDataIntoMusicalEnvironment(simpleMelodyData, 'p1', e)+K.recordConfigurationDataIntoMusicalEnvironment(simpleMelodyData, 'p1', e)
 </code> </code>
  
Line 147: Line 152:
 <code javascript> <code javascript>
 K.assignPlayerForMusicSynthesizerMidiOutput (e, defaultName, playerName, playerData) K.assignPlayerForMusicSynthesizerMidiOutput (e, defaultName, playerName, playerData)
 +</code>
  
 ==== Parameters ==== ==== Parameters ====
Line 162: Line 168:
 //Create configuration object: //Create configuration object:
 let simpleMelodyData = K.R.clone(K.simpleMelodyDataTemplate) let simpleMelodyData = K.R.clone(K.simpleMelodyDataTemplate)
 +//K.simpleMelodyDataTemplate is a simple template of a configuration object
 simpleMelodyData.velocity = [100, 100, 100, 100] simpleMelodyData.velocity = [100, 100, 100, 100]
-simpleMelodyData.rhythmMap = [1, 234]+simpleMelodyData.rhythmMap = [1, 111]
 simpleMelodyData.noteValues = [[1], [2], [3], [4]] simpleMelodyData.noteValues = [[1], [2], [3], [4]]
 simpleMelodyData.rootMap = [ 'C', 'C', 'C', 'C' ] simpleMelodyData.rootMap = [ 'C', 'C', 'C', 'C' ]
Line 173: Line 180:
 New example starts here: New example starts here:
 <code javascript> <code javascript>
 +//make or modify player to use info:
 +K.assignPlayerForMusicSynthesizerMidiOutput(e, 'p1','exampleMidiPlayer1')
 +//configure legatoMap:
 +e.players.exampleMidiPlayer1.legatoMap = 'default'
 +
 +//signal to player to start playing:
 +e.play('exampleMidiPlayer1')
 +</code>
 +
 +===== configObjCreation =====
 +Number -> [Number] -> [Number] -> [String] -> [[Number]] -> [Number] -> [Number] -> Object
 +
 +A useful tool for creating very basic configuration objects.
 +
 +==== Syntax ====
 +<code javascript>
 +K.configObjCreation (total, keys, octave, root, note, noteDuration, velocity)
 +</code>
 +
 +==== Paramters ====
 +=== total ===
 +They keyspan of the QuantizedMaps. Also the total variable in the configuration object.
 +=== keys ====
 +The keys of the QuantizedMaps.
 +=== octave ===
 +The value of the octave maps
 +=== root ===
 +The value of the root maps.
 +=== note ===
 +The value of the note maps.
 +=== noteDuration ===
 +The value of the noteDuration maps.
 +=== velocity===
 +The value of the velocity maps.
 +
 +==== Example ====
 +<code javascript>
 +let basicConfig = K.configObjCreation(4, [0, 1, 2, 3], [3, 3, 3, 3], ['C', 'C', 'C', 'C'], [[3], [4], [5], [6]], [2, 2, 2, 2], [100, 100, 100, 100])
 </code> </code>
  • creating-players.1709197609.txt.gz
  • Last modified: 2024/02/29 01:06
  • by steve.wang