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
quantizedmaps-tutorial [2024/08/09 00:25] steve.wangquantizedmaps-tutorial [2025/08/13 23:43] (current) steve.wang
Line 24: Line 24:
  
 console.log(e.noteMaps) console.log(e.noteMaps)
-//It is full of QuantizedMaps. We can know that because after the variable name, it will say QuantizedMap like this "p2: QuantizedMap {". We can also verify that using code: +//It is full of QuantizedMaps. We can know that because after the variable name, it will say QuantizedMap like this "default: QuantizedMap {". We can also verify that using code: 
-console.log(e.noteMaps.p2 instanceof K.QuantizedMap)+console.log(e.noteMaps.default instanceof K.QuantizedMap)
 ``` ```
  
Line 32: Line 32:
 The QuantizedMaps are all recorded in different variables in the MusicalEnvironment but they are only used when the players are told to use them. For example: The QuantizedMaps are all recorded in different variables in the MusicalEnvironment but they are only used when the players are told to use them. For example:
 ``` ```
-//The modeMap variable in e.players.exampleMidiPlayer4.noteMap is p4+//The modeMap variable in e.players.exampleMidiPlayer4.noteMap is default
 console.log(e.players.exampleMidiPlayer4.noteMap) console.log(e.players.exampleMidiPlayer4.noteMap)
 //So that means when the player is going to play something, it will look at: //So that means when the player is going to play something, it will look at:
-console.log(e.noteMaps.p4)+console.log(e.noteMaps.default)
 ``` ```
 </markdown> </markdown>
Line 50: Line 50:
 //Identify which octave map exampleMidiPlayer4 is looking at: //Identify which octave map exampleMidiPlayer4 is looking at:
 e.players.exampleMidiPlayer4.octaveMap e.players.exampleMidiPlayer4.octaveMap
 +    
 +//see what it looks like currently
 +console.log(e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].values)
 +
 //Next (the safer way): //Next (the safer way):
- e.addMap('octaveMaps',  + e.addMap('octaveMaps', 
-    e.players.exampleMidiPlayer4.octaveMap, +    e.players.exampleMidiPlayer4.octaveMap,
     e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keyspan,     e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keyspan,
-    e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keys, +    e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keys,
     [[ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ]]     [[ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ]]
 ) )
Line 70: Line 74:
 <code javascript> <code javascript>
 //Recommended safe way: //Recommended safe way:
-e.addMap('rhythmMaps',  +e.addMap('rhythmMaps', 
-    e.players.exampleMidiPlayer4.rhythmMap,  +    e.players.exampleMidiPlayer4.rhythmMap, 
-    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keyspan,  +    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keyspan, 
-    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keys, +    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keys,
     [2, 4, 6]     [2, 4, 6]
 ) )
Line 84: Line 88:
 <code javascript> <code javascript>
 //Recommended way //Recommended way
-e.addMap('noteMaps',  +e.addMap('noteMaps', 
-    e.players.exampleMidiPlayer4.noteMap,  +    e.players.exampleMidiPlayer4.noteMap, 
-    5,  +    5, 
-    [0, 1, 2, 3, 4], +    [0, 1, 2, 3, 4],
     [ [40],[50], [60], [70], [80]]     [ [40],[50], [60], [70], [80]]
 ) )
Line 103: Line 107:
 The sound output can be easily changed by simply switching the data the player looks at without creating any new data. The sound output can be easily changed by simply switching the data the player looks at without creating any new data.
 ====== Changing notes played ===== ====== Changing notes played =====
-This will cause the notes to loop between 0 to 11. +This will cause the notes to loop between 0 to 11.
 <code javascript> <code javascript>
 e.players.exampleMidiPlayer1.noteMap = 'default' e.players.exampleMidiPlayer1.noteMap = 'default'
Line 131: Line 135:
  
 [[music_generation|Click here to learn about music generation and generating melodies in Konduktiva]] [[music_generation|Click here to learn about music generation and generating melodies in Konduktiva]]
- 
  
  • quantizedmaps-tutorial.1723188313.txt.gz
  • Last modified: 2024/08/09 00:25
  • by steve.wang