using-worker-threads-with-konduktiva

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
using-worker-threads-with-konduktiva [2024/02/21 20:50] – [Explanation] steve.wangusing-worker-threads-with-konduktiva [2025/09/06 01:21] (current) steve.wang
Line 3: Line 3:
 **Overview: ** Sometimes running too many actions in the same nodejs thread can cause Konduktiva sequencing to be delayed because of the heavy load on the system and the single threaded nature of nodejs. To avoid this issue, we can create other threads and run heavy actions there. Reading the [[https://nodejs.org/api/worker_threads.html#worker-threads|documentation about nodejs workers]] for about 5 minutes or enough to understand the basic function of nodejs workers is recommended. **Overview: ** Sometimes running too many actions in the same nodejs thread can cause Konduktiva sequencing to be delayed because of the heavy load on the system and the single threaded nature of nodejs. To avoid this issue, we can create other threads and run heavy actions there. Reading the [[https://nodejs.org/api/worker_threads.html#worker-threads|documentation about nodejs workers]] for about 5 minutes or enough to understand the basic function of nodejs workers is recommended.
  
-**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.+** Available versions: **: Only in worker scheduler version (Steve experimental version)
  
 +**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>
 ===== giveWorkerWork ===== ===== giveWorkerWork =====
  
Line 43: Line 48:
 e.modeFilters.sameAsChromatic = new K.QuantizedMap(QResults.keyspan, QResults.keys, QResults.values) e.modeFilters.sameAsChromatic = new K.QuantizedMap(QResults.keyspan, QResults.keys, QResults.values)
 </code> </code>
 +===== Separate Repository =====
 +
 +Konduktiva still uses internal version
 +
 +https://www.npmjs.com/settings/mrname5/packages
 +
 +https://github.com/mrname5/gen-worker
 +
 +===== Debugging (Not implemented yet) =====
 +Second argument for changing behaviour of automatic removal of code files used by Worker. This is very useful for debugging because it allows user to see all the code Worker has access to and the operations worker can run. This can be done by pasting the code files used by Worker into Nodejs repl. Can help significantly with type issues (code to text and back to code)
 +
 +Argument accepts strings that dictate what action is taken regarding the code files Worker uses. Argument called removal.
 +
 +false: Does not remove worker code files.
 +undefined : Removes if worker exit without error but keeps if error.
 +true; Remove worker code file not matter situation.
  
  
 +[[adding-midi-file-to-musical-environment|Learn about playing midi files in Konduktiva]]
  • using-worker-threads-with-konduktiva.1708577451.txt.gz
  • Last modified: 2024/02/21 20:50
  • by steve.wang