first_steps

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
first_steps [2024/02/15 21:07] renickfirst_steps [2024/11/03 23:04] (current) steve.wang
Line 1: Line 1:
 ====== First Steps with Konduktiva====== ====== First Steps with Konduktiva======
-**Overview: ** This tutorial will act as a guide about how to get started after installating Konduktiva. See how to [[https://github.com/renickbell/konduktiva/blob/main/README.md#installation|install Konduktiva on the Konduktiva Github page]]+**Overview: ** This tutorial will act as a guide about how to get started after installating Konduktiva. See how to [[https://github.com/renickbell/konduktiva/blob/main/README.md|install Konduktiva on the Konduktiva Github page]]
  
 **Things To Note: ** Only follow this tutorial after you have correctly followed the installation instructions.  **Things To Note: ** Only follow this tutorial after you have correctly followed the installation instructions. 
Line 7: Line 7:
 <code bash> node</code> <code bash> node</code>
  
-Run the following line of code in the REPL which will load the Konduktiva library if you have installed it throught npm. For loading using other methods go to [[|https://github.com/renickbell/konduktiva/blob/main/README.md#running-the-code|the Running The Code part of the Konduktiva Github page]]. :+Run the following line of code in the REPL which will load the Konduktiva library if you have installed it throught npm:
 <code javascript> <code javascript>
 const K = require('konduktiva') const K = require('konduktiva')
 </code> </code>
 +
 +NOTE: await import is not supported
  
 After this is loaded, you will need to open one instance of MIDI output. Next, setup a default/example MusicalEnvironment with After this is loaded, you will need to open one instance of MIDI output. Next, setup a default/example MusicalEnvironment with
  
 <code javascript> <code javascript>
-let e = K.setUpMusicalEnvironment(0)+let e = K.setUpMusicalEnvironment(K.defaultConfigurationObject, 1,'exampleMidiPlayer')
 </code> </code>
  
Line 40: Line 42:
 e.play('exampleMidiPlayer1') e.play('exampleMidiPlayer1')
 </code> </code>
-You should here something like this: 
-{{ :setupverysimplemusicalenvironment-audio.mp3 |}} 
  
-You can also restart the node session by cressing CTRL + D in the terminal and typing node again. Then you might want to try some of these other functions: +Stop it by doing this
- +<code javascript
-<code> +e.stop('exampleMidiPlayer1')
-let e = K.setUpMusicalEnvironment(0) +
-e.play('exampleMidiPlayer1'+
-//OR +
-let e = K.setUpMusicalEnvironment(1) +
-e.play('exampleMidiPlayer1'+
-//OR +
-let e = K.setUpMusicalEnvironment(3) +
-e.play('exampleMidiPlayer1')+
 </code> </code>
-REMEMBER to restart nodejs everytime you run one of those functions. As you learn more about Konduktiva, you will learn other ways to do this so you do not have to restart node every single time. +You should here something like this:
  
-Konduktiva can send MIDI messages to more than one music synthesizer sessionTry opening another session of your music synthesizer and configure the new one to listen to channel 2. Then, try this function: +{{ :default-config-obj-audio.mp3 |}}
  
-<code> +You can also restart the node session by pressing CTRL + D in the terminal and typing node againThen you might want to try some of these other functions:
-let e = K.setUpMusicalEnvironment(2) +
-e.play('exampleMidiPlayer1'+
-e.play('exampleMidiPlayer2')+
  
-</code>+The configuration object (first argument controls the type of sound you hear. Try passing in a different configuration object and some extra configurations (last argument).
  
-You should here both your music synthesizer sessions playing different things. It should sound something like this: 
- 
-{{ :setuptwoplayermusicalenvironment-audio.mp3 |}} 
-Next open 2 more music synthesizer session. One of the new ones should be listening to channel 3. The other new one should be listening to channel 4. 4 in total and run the code below: 
-<code> 
-let e = K.setUpMusicalEnvironment(4) 
-e.play('exampleMidiPlayer1') 
-e.play('exampleMidiPlayer2') 
-e.play('exampleMidiPlayer3') 
-e.play('exampleMidiPlayer4') 
-</code> 
- 
- 
-This might sound something like this: 
-{{ :l-system-session-1-player.mp3 |}} 
- 
-You can allow multiple players to play simultaneously: 
 <code javascript> <code javascript>
-e.play('exampleMidiPlayer3'+let = K.setUpMusicalEnvironment(K.lsystemData,1,'exampleMidiPlayer', K.exampleMusicalEnvironmentsExtraConfig)
-e.play('exampleMidiPlayer4'+
-e.play('exampleMidiPlayer2')+
 </code> </code>
  
-All the exampleMidiPlayers should be playing now.+{{ :yoshimi-10_lsystem_session_2024-03-12.mp3 |}}
  
-After each line you should here an extra layer of sound.+Konduktiva can send MIDI messages to more than one music synthesizer session. Try opening another session of your music synthesizer and configure the new one to listen to channel 2. To hear a more obvious difference configure the second music synthesizer to use a different voiceThen, try this function: 
  
-It might sound something like this:+<code> 
 +let e = K.setUpMusicalEnvironment(K.defaultConfigurationObject,2,'exampleMidiPlayer')
  
-{{ :all-sessions-audio.mp3 |}}+e.play('exampleMidiPlayer1'
 +e.play('exampleMidiPlayer2')
  
-To stop a specific session. This will stop exampleMidiPlayer3 player: 
-<code javascript> 
-e.stop('exampleMidiPlayer3') 
 </code> </code>
  
Line 107: Line 76:
 </code> </code>
  
-Explanation of K.setUpMusicalEnvironment function:+You should here both your music synthesizer sessions playing the same thing but with different voicesIt should sound something like this:
  
-Argument 0 is for the most basic. +ADD AUDIO HERE
-Argument 1 is for slightly more complex than the most basic +
-Argument 2 is for two players. +
-Argument 3 is for more complex and longer single player +
-Argument 4 is for 4 players+
  
- +To here different sounds try these function callsRemember to restart nodejs and Konduktiva everytime you run one of these funcitonsAs you learn more about Konduktiva, you will learn other ways to do this so you do not have to restart node every single time
-All the variables that control the music can be set by using the beginner friendly musicalEnvironment configuration objectsExample configuration objects can be found in the file [[https://github.com/renickbell/konduktiva/blob/main/example-melodies-data.js|example-melodies-data.js]] and documentation on the musicalEnvironment configuration objects can be found in the file [[https://github.com/renickbell/konduktiva/blob/main/konduktiva-documentation.md|Konduktiva-documentation.md]]. +
- +
-Recommended reading [[https://github.com/renickbell/konduktiva/blob/main/konduktiva-documentation.md#conceptual-overviewz|Conceptual Overview]] +
- +
-====== Changing Things Played With Existing QuantizedMaps ====== +
-The sound output can be easily changed by simply switching the data the player looks at without creating any new data. +
-====== Changing notes played ===== +
-This will cause the notes to loop between 0 to 3+
 <code javascript> <code javascript>
-e.players.exampleMidiPlayer1.noteMap 'default' +let e = K.setUpMusicalEnvironment(K.circleOfFifthChords,1,'exampleMidiPlayer', K.exampleMusicalEnvironmentsExtraConfig)
-//To look at the information being used: +
-console.log(e.noteMaps.default) +
-</code> +
-====== Changing modeMap used ===== +
-This will cause the chord progression form ionianto phrygianthen to mixolydian. +
-<code javascript> +
-e.players.exampleMidiPlayer1.modeMap = 'default' +
-//To look at the information being used: +
-console.log(e.modeMaps.default) +
-</code> +
-====== Changing melody used ===== +
-This will cause the player to cycle between the notes 0 to 3. +
-<code javascript> +
-e.players.exampleMidiPlayer1.noteMap = 'default' +
-//To look at the information being used: +
-console.log(e.noteMaps.default) +
-</code>+
  
-====== Playing Chords ===== +let e K.setUpMusicalEnvironment(K.circleOfFifthMelody,1,'exampleMidiPlayer', K.exampleMusicalEnvironmentsExtraConfig)
-To play chords another action function will have to be usedTo switch action functions do this: +
-<code javascript> +
-e.players.exampleMidiPlayer1.action = 'sendChordMidiInfo'+
 </code> </code>
-Or click here to learn more about action functions. 
  
-====== Next Steps ====== +circleOfFifthChords: 
-The recommended way to change specific variables in the MusicalEnvironment is to use the addMap method because it checks for many different types of errors and common mistakes when coding quicklyHowever, if you are confident and need more speed you can choose to directly interact with the MusicalEnvironment object. Here are some examples +{{ :yoshimi-10_circleoffifthchords_session_2024-03-12.mp3 |}}
-===== Changing Octaves =====+
  
-For example, if I wanted to change the octaves of exampleMidiPlayer4 without changing timing I would do this+circleOfFifthMelody
-<code javascript> +{{ :yoshimi-10_circleoffifthmelody_session_2024-03-12.mp3 |}}
-//Identify which octave map exampleMidiPlayer4 is looking at: +
-e.players.exampleMidiPlayer4.octaveMap +
-//Next (the safer way): +
- e.addMap('octaveMaps',  +
-    e.players.exampleMidiPlayer4.octaveMap,  +
-    e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keyspan, +
-    e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].keys,  +
-    [[ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ]] +
-+
-//to see the changes: +
-console.log(e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].values)+
  
-//OR do this the less safe way but potentially faster with more control: 
-e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].values =[[ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ], [ 6 ]] 
  
-//to see the changes: +All the variables that control the music can be set by using the beginner friendly musicalEnvironment configuration objects. Example configuration objects can be found in the file [[https://github.com/renickbell/konduktiva/blob/main/example-melodies-data.js|example-melodies-data.js]] and documentation on the musicalEnvironment configuration objects can be found in the file [[https://github.com/renickbell/konduktiva/blob/main/konduktiva-documentation.md|Konduktiva-documentation.md]].
-console.log(e.octaveMaps[e.players.exampleMidiPlayer4.octaveMap].values) +
-</code> +
-===== Changing RhythmMap ===== +
-Example changing rhythmMap for exampleMidiPlayer4 without changing timing. Similar to [[http://konduktiva.org/doku.php?id=first_steps#changing_octaves|changing octave]]. +
-<code javascript> +
-//Recommended safe way: +
-e.addMap('rhythmMaps',  +
-    e.players.exampleMidiPlayer4.rhythmMap,  +
-    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keyspan,  +
-    e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].keys,  +
-    [2, 4, 6] +
-+
-//other potentially faster way: +
-e.rhythmMaps[e.players.exampleMidiPlayer4.rhythmMap].values[0].values = [2, 4, 6] +
-</code>+
  
-===== Changing Melody, Notes or Chords ==== +Recommended reading [[https://github.com/renickbell/konduktiva/blob/main/konduktiva-documentation.md#conceptual-overviewz|Conceptual Overview]]
-Example of changing notes played for exampleMidiPlayer4 Similar to [[http://konduktiva.org/doku.php?id=first_steps#changing_octaves|changing octave]].: +
-<code javascript> +
-//Recommended way +
-e.addMap('noteMaps',  +
-    e.players.exampleMidiPlayer4.noteMap,  +
-    5,  +
-    [0, 1, 2, 3, 4],  +
-    [ [40],[50], [60], [70], [80]] +
-+
-//OR +
-e.noteMaps[e.players.exampleMidiPlayer4.noteMap] = new QuantizedMap(5, [0, 1, 2, 3, 4], [ [40],[50], [60], [70], [80]]) +
-</code> +
- +
-===== Changing The MusicalEnvironment In General ===== +
- +
-To change things in the MusicalEnviornment, one should use the addMap method. The documentation is in [[https://github.com/renickbell/konduktiva/blob/main/konduktiva-documentation.md|konduktiva-documentation.md]]+
  
-Or read about the different ways to generate music [[http://konduktiva.org/doku.php?id=music_generation|here]]+[[quantizedmaps-tutorial|Click to learn about QuantizedMaps and how they are used in Konduktiva]]
  • first_steps.1708060022.txt.gz
  • Last modified: 2024/02/15 21:07
  • by renick