This is an old revision of the document!
First Steps with Konduktiva
Overview: This tutorial will act as a guide about how to get started after installating Konduktiva. See how to install Konduktiva on the Konduktiva Github page
Things To Note: Only follow this tutorial after you have correctly followed the installation instructions.
Start the nodejs REPL in a terminal if you have installed Konduktiva globally (using the -g tag). If not navigate the the directory where you have installed Konduktiva using the cd command or using the file manager navigate to the location you have installed Konduktiva and open a terminal there.:
node
Run the following line of code in the REPL which will load the Konduktiva library if you have installed it throught npm:
const K = require('konduktiva')
OR
const K = await import('konduktiva')
After this is loaded, you will need to open one instance of MIDI output. Next, setup a default/example MusicalEnvironment with
let e = K.setUpMusicalEnvironment(0)
If you log ``e``, you will see that is a MusicalEnvironment class. It has some basic configurations for the new user to get started
you change the tempo(speed) like this
//Makes music go slower e.changeTempo(80) //Makes music go faster e.changeTempo(180)
Before you can start playing music, you have to connect Konduktiva to your music synthesizer of choice. Click here to learn how to do so
Now you can start playing some beats. Ensure you music synthesizer is listening to channel 1. Try this command to allow one player to start playing.
e.play('exampleMidiPlayer1')
You should here something like this:
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:
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')
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.
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. Then, try this function:
let e = K.setUpMusicalEnvironment(2) e.play('exampleMidiPlayer1') e.play('exampleMidiPlayer2')
You should here both your music synthesizer sessions playing different things. It should sound something like this:
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:
let e = K.setUpMusicalEnvironment(4) e.play('exampleMidiPlayer1') e.play('exampleMidiPlayer2') e.play('exampleMidiPlayer3') e.play('exampleMidiPlayer4')
This might sound something like this:
You can allow multiple players to play simultaneously:
e.play('exampleMidiPlayer3') e.play('exampleMidiPlayer4') e.play('exampleMidiPlayer2')
All the exampleMidiPlayers should be playing now.
After each line you should here an extra layer of sound.
It might sound something like this:
To stop a specific session. This will stop exampleMidiPlayer3 player:
e.stop('exampleMidiPlayer3')
To stop all players:
e.stopAll()
Explanation of K.setUpMusicalEnvironment function:
Argument 0 is for the most basic. Argument 1 is for one player Argument 2 is for two players. Argument 3 is for simple musical environment Argument 4 is for 4 players Argument 5 is for a more complex/longer player Argument 6 is for a musical environment with multiple copies of the same player. Add another argument to control amount of copies. The default will be four. Here is an example:
let e = K.setUpMusicalEnvironment(6, 7) console.log(K.all(e.players))
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 example-melodies-data.js and documentation on the musicalEnvironment configuration objects can be found in the file Konduktiva-documentation.md.
Recommended reading Conceptual Overview
Click to learn about QuantizedMaps and how they are used in Konduktiva