How do I enter triplets programmatically?

• Aug 21, 2010 - 08:40

Hello all,
I am trying to enter triplets programmatically. This is what the documentation (http://musescore.org/en/plugin-development/tick-length-values) says:

"Note and rest values are expressed in an internal unit (...)
triplet quaver (1/3 of crochet) 160"

So I added this code:
(...)
while (!cursor.eos()) {
var chord = new Chord ();
chord.tickLen = 160;
var note = new Note ();
note.pitch = pitch++;
chord.addNote (note);
cursor.add (chord);
cursor.next();
}

But the result is not what I expected (se attached image). What am I missing, or what am I supposed to do to be able to enter triplets from code?

Thank you,
Claudius

Attachment Size
no_triplets.jpg 11.3 KB

Comments

I think you can't enter truplets from the plugin framework. In MuseScore code, triplets is an object and this object is not exposed by the plugin framework.

I'm sorry... this may seem exceedingly dumb, but why are you trying to do this? I'm just curious what advantage it has and if it's a method I should look at trying out.

In reply to by Calem Bendell_

Hello CalemBendell,

The short version: I need it for a very specific, personal project.

The long version: I'm a contemporary music composer and a programmer at the same time; I thought it would be interesting to attempt to "teach" a machine the basic rules of musical composition, as it applies in contemporary music. While certain progress can be done without "tuplets", their lack is a great loss, as it's common in nowadays' music to have triplets, sextuplets, etc.

In reply to by Calem Bendell_

Not just yet, as the project is still in a "larval" state, but I'll start twitting about it as soon as things get organized. I'm "claudius_iacob" on Twitter and the project's code name is "stocasticvs" (that's a latin spelling).

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