Skip to main content
Topic: Importing Triplets - a proposal (Read 3442 times) previous topic - next topic

Importing Triplets - a proposal

OK.
Noteworthy Composer doesn't import triplets, but I don't buy the reason "because midi-files don't indicate a triplet, but rather just a start and stop time of notes"

***WARNING!!! The following post may be long-winded, and completely useless. Do not operate heavy machinery while reading this post.***

Granted, it is a more difficult algorithm to look at a midi file and determine that a triplet is intended, but that DOESN'T mean it's impossible, and I think it MAY not be too hard to implement. (Then again, I don't know how exactly NWC performs the importing, so this could just be a waste of bandwidth....)

To convert .MID to .NWC the current system has to calculate how long a "beat" is. Since we know that midi doesn't indicate quarter notes etc., the NoteWorthy import procedure must do some calculation to determine that 1200 milleseconds is "1 quarter note" or whatnot.

Once you determine how many milleseconds a "Beat" (let's call it X) is, then any 'triplet' note would have to be some factor of X/3. So the importing procedure can determine if a single triplet note was intended.

However, this doesn't completely help us, because NWC does not deal with single triplets, but rather as a GROUP of notes that are 'triplicized' (yes, I just made up that word--so sue me)

So, in order to import a triplet from a midi file, we need to look at a GROUP of notes. One possible way to do this, would be to create a list of note durations, that begins with the first note that may be a triplet, and whose running total is some factor of the beat. Once the total is finished, we convert all the notes in the list to a triplet figure.

{E.g. 1 Quarter = 1200 ms.
First we encounter a note of duration 800 ms, so we start our list. Then we see a note of duration 800 again. (our running total of 1600 is not a factor of 1200, so we continue adding to the list) The third note has a duration of 400, and the fourth note also has a duration of 400. At this point we have 4 notes that we know add up to 2400 ms and thus fit into 2 quarter notes.

To convert this list to triplets, we could multiply the note lengths in the list by 3/2 and then put some kind of triplet tag around the notes in the list.

And so, the algorithm above would import the notes as a triplet figure containing 2 quarters followed by 2 eighths.
}

If in the middle of the list you encounter a note length that is NOT some factor of X/3 (that is a note which is not a triplet), the algorithm can abort the search, and just import the notes regularly.

Things I KNOW I haven't considered:
* Chords with varying length notes
* Triplet figures which might extend over barlines

So what's wrong with my idea (I'm sure there IS A problem, otherwise somebody else must have thought of this already!)

-Steven
p.s. If this DOESN'T prove feasible, how about adding a feature "audit triplets" which essentially searchs the staff for eighth-quarter-eighth patterns (such as NWC currently imports triplets) and runs the Recorder macro, so ingeniously written by Andrew Purdam?

p.p.s. If this IS a good idea, should I submit it to the WISH LIST?

Re: Importing Triplets - a proposal

Reply #1
>>To convert .MID to .NWC the current system has to calculate how long a "beat" is. Since we know that midi doesn't indicate quarter notes etc., the NoteWorthy import procedure must do some calculation to determine that 1200 milleseconds is "1 quarter note" or whatnot.<<

One hiccup straight away is in deciding whether a staccato quarter note is a staccato quarter note or an eighth note followed by an eighth rest. This is adjusted somewhat by the "rest granularity".

>>Once you determine how many milleseconds a "Beat" (let's call it X) is, then any 'triplet' note would have to be some factor of X/3. So the importing procedure can determine if a single triplet note was intended.<<

Maybe it would be easier to look for notes that START every X/3 (and who stop before the next one starts).

>>'triplicized' (yes, I just made up that word--so sue me)<<
I made up "tripletize" years ago. Expect a letter from my solicitor! :)

>>So, in order to import a triplet from a midi file, we need to look at a GROUP of notes. One possible way to do this, would be to create a list of note durations, that begins with the first note that may be a triplet, and whose running total is some factor of the beat. Once the total is finished, we convert all the notes in the list to a triplet figure. <<

I think that note durations would be a little difficult to use (though could provide good hints), and maybe note down times are better for determining groups. I can see that a generic approach could be use for ALL tuplets, though. And controlled by some import parameter so that rubato doesn't get misinterpreted.

>>Things I KNOW I haven't considered:
* Chords with varying length notes
* Triplet figures which might extend over barlines<<

I didn't think that triplets could extend over barlines.

>>So what's wrong with my idea (I'm sure there IS A problem, otherwise somebody else must have thought of this already!)<<

My guess is that Eric may have thought of this, but it may be further down his list of things to do.

>>p.s. If this DOESN'T prove feasible, how about adding a feature "audit triplets" which essentially searchs the staff for eighth-quarter-eighth patterns (such as NWC currently imports triplets) and runs the Recorder macro, so ingeniously written by Andrew Purdam?<<

The eighth-quarter-eighth pattern is only one of many possible interpretations. However, "Audit Triplets" is a very good idea, and possibly how Eric would do it anyway. They are just stages of the importation process, after all.

>>p.p.s. If this IS a good idea, should I submit it to the WISH LIST?<<

YES! Even if it's NOT a good idea! ;-)
I'm sure that Eric appreciates these sorts of suggestions that include possible algorithms. Whilst he may not use them, they must provide food for thought. (I HOPE he appreciates them, I used to send him dozens of these sorts of academic ideas :) 'Sfunny tho. Suggestions from programmers always make me wish we could "get at" the format or code to implement all these ideas. However, it would take a huge leap of faith for Noteworthy Artware to proceed down that path, as control becomes much more difficult. And my hat goes off to Eric and Beth for providing this forum and the newsgroup where they really assert very little control, and let the users say whatever they like. Hopping of my soap box now. - A

Re: Importing Triplets - a proposal

Reply #2
>>'triplicized' (yes, I just made up that word--so sue me)<<
>> I made up "tripletize" years ago. Expect a letter from my solicitor! :)<<

Ah, you created the word "tripletize" which I believe is intended as a verb meaning "to make into a triplet"

"triplicized" is an adjective meaning 'having been marked as a tuble of the third order'

In fact, the distinction goes even further beyond that!
I believe your word "tripletize" is derived from the Greek 'Tripleticus' who was a deity known for his enormus endowment, and from whom we have the phrase "third leg"

Meanwhile "triplicized" actually comes from the verb "riplicate" which as we all know means 'to replicate poorly' (thus the "i" instead of the "e") And many cunning linguists (or SOMETHING like that anyhow...) now believe that "triplicized" became used in musical terminology (quite recently in fact!) to mean groupings of notes indicated as triplets, since triplets can easily be described as notes that have been replicated so poorly that they have to be shorted just to squeeze them into the measure!

I hope that clarified the difference!

-Steve
PhD of blathering and double-talk

Re: Importing Triplets - a proposal

Reply #3
Interesting topic. I agree with Andrew that the criterion should be the "note on" time, rather than the absolute duration. Longer durations (even overlapping other notes) can be handled with ties, shorter ones with staccato or rests.

Perhaps it would help to have a look at how sequencers (e.g. the Cubase or Cakewalk families) handle this. In such programs, midi imports (or for that matter live performances) are stored in "raw" form, and the scoring aspect can be viewed as a sort of "post processing" that determines only how the notes are displayed. Other useful concepts are "quantise" and "snap"; quantise rounds the notes to the nearest available length (e.g. quarter, dotted 1/8, 1/8, tripletised 1/8, etc.) and "snap" rounds to the nearest available position. Again, such quantisation or snap can usually be "undone", reverting to the raw performance or midi import.

NWC seems to do this, to a degree, already -- using the note and rest resolution parameters, though I'll be the first to admit that I haven't really figured out how this works to a point where it's as intuitive and straightforward as the quantise and snap approach. I can't see that extending this to other durations (i.e. n-tuplets) would be impossible or even all that difficult... but then such things always looks easy until you actually try to do it!

Re: Importing Triplets - a proposal

Reply #4
Giving some thaught to the subject, it seems that importing triplets would be a fairly simple thing to implement. When importing a midi file, we already know how long is one quarter. When knowing that, it's simple arithmetic to determine the length oh a dotted eight or sixteenth, as a triplet would be made up of. When the import filter then finds one such note, it is a simple IF next note is of the same duration (+/- 3% for safety)AND the next note after that AND all three notes exists in the same bar,THEN we have a triplet.

By the way, what language is Noteworthy written in?

Re: Importing Triplets - a proposal

Reply #5
>>> When the import filter then finds one such note, it is a simple IF next note is of the same duration (+/- 3% for safety)AND the next note after that
AND all three notes exists in the same bar,THEN we have a triplet. <<<

It's not quite THAT simple. That would show us a pattern of 3 triplets of equal length, but that wouldn't handle all cases.

As far as Noteworthy is concerned, ANY grouping of notes that fit into 3-beats (or multiple thereof) can be made into triplets (and thus shortened to fit into 2-beats (or multiple thereof) oh I should close the other parenthesis!)

So, any algorithm to find triplets can't assume that there will only be 3-notes in a triplet group, OR that the notes will all be the same length!

The pattern: "Quarter, Quarter, Eighth, Eighth" can be tripletized; or even the 2-note pattern "dotted-quarter, dotted-quarter"

So, the difficulty is that, while the current MIDI import procedure needs only go straight through the file, any NEW program to find triplets, will have to temporarily store information about the score somewhere concerning triplets! And perhaps THAT'S the reason, it hasn't been implemented yet.