Plugin question

• Nov 26, 2022 - 17:02

Hi guys Iam doing plugin which takes for notes or rest or mix of these a then it prints these elements randomly to next 15 measures.

It works pretty well but it doesnt print these notes/rest after one another but at the start of every new measure.
Can you please help me to fix it.

import QtQuick 2.0
import MuseScore 3.0

MuseScore {
menuPath: "Plugins.pluginName"
description: "Description goes here"
version: "1.0"
onRun: {

  function get_rand_num(min, max){

                          return Math.random() *  (max-min) + min;

  var all_notes = [];
          var cursor = curScore.newCursor();

      var first  =     cursor.element.clone();
      console.log("first",first.duration.str );;

      var second  =     cursor.element.clone();
      console.log("second",second.duration.str );;

      var third  =     cursor.element.clone();
      console.log("third",third.duration.str );;

      var fourth  =     cursor.element.clone();
      console.log("fourth",fourth.duration.str );;


     console.log("all", all_notes[0].duration.str);
      console.log("placement", cursor.tick)

 var  rand_num = Math.floor(get_rand_num(0,4))

       console.log("placement1", cursor.tick)

    console.log("placement2", cursor.tick)
   // while (cursor.prev() && (cursor.segment.type != 90)) {
                     // Nothing to do here, just continue rewinding
     //               }
     var  rand_num_1 = Math.floor(get_rand_num(0,4));
    console.log("placement3", cursor.tick)

    console.log("placement4", cursor.tick)

        console.log("hello world")
Attachment Size
Screen Shot 2022-11-26 at 18.01.47.png 69.18 KB


Do you still have an unanswered question? Please log in first to post your question.