This is an old revision of the document!
Adding midi file to musical environment
Overview: A midi file can be played via Konduktiva. During this process, the midi data will also be convert in forms to normal Konduktiva information (Quantized maps etc.)
Things To Note: This tutorial assumes you have already installed Konduktiva successfully using the Konduktiva installation instructions and have read through and understood the 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.
addMidiFileToMusicalEnvironment
String → String → MusicalEnvironment →
This function will automatically create or modify the player with the same name as the midi file to be used. The number of players created will be based the amount of tracks that have MIDI on/off messages and MIDI CC messages in them.Quantized maps will be automatically created based on the Midi data. Tempo and time signature will also automatically be modified.
Syntax
addMidiFileToMusicalEnvironment(filePath, musicalKey, e)
Parameters
filePath
The path to the MIDI file (.mid) that is to be used.
musicalKey
The key of the MIDI file.
e
MusicalEnvironment to add to.
Examples
MIDI Files Used (Download)
bwv849.mid
From: https://www.midiworld.com/bach.htm Download: https://www.midiworld.com/midis/other/bach/bwv849.mid
two-bar-Cm-midi-test.mid
From: Renick Bell Download:
scarborough-fair.mid
Code
addMidiFileToMusicalEnvironment('./bwv849.mid', 'C#', e) e.play('bwv849') e.stop('bwv849') addMidiFileToMusicalEnvironment('./two-bar-Cm-midi-test.mid', 'C', e) e.play('two-bar-Cm-midi-test') e.stop('two-bar-Cm-midi-test') addMidiFileToMusicalEnvironment('./scarborough-fair.mid', 'D', e) e.play('scarborough-fair') e.stop('scarborough-fair')