Build a function that deletes a note that is of consecutive equal note

berane9's icon

I have group of data representing 3 values: a time measure number, a note and time in ms (its value is (* 0.001)).

The active value is listed as “time measure, the note and time in ms”,

The operation needed is to eliminate one of the 2 consecutive equal notes. These repeated values are caused by Max software due to false or law alert of loudness issue (markers or partials).

The result should be to create an alert blink on one button note that have same value. This alert button will enable the user to manually decide to delete the repeated note.

The system should consider also to add new set of data (time-measure, note and time in ms) in case it was ignored by the system due to law value in loudness.

After the process of adding or deleting issue, the system should collect the 3 values in the order list: time-measure, note and time in ms. And finally, this group should be collected into the “coll” object.

10 20 37.64 12 17 37.78 16 17 37.96 11 17 38.08 10 18 38.2 10 19 38.31 31 19 38.68 11 19 38.8 10 18 38.92 58 18 39.61 10 19 39.73 47 19 40.29 11 17 40.4 10 15 40.52 14 15 40.68 11 15 40.8 10 16 40.91 16 16 41.1 10 17 41.21 11 17 41.33 10 18 41.45

Source Audio's icon

you could insert the list into textedit ,

then manually edit whatever you want and finally dump it into coll.

it is not clear if the list goes as one line into coll, or something else.

anything else is out of question because you don´t define process of

outputting/analysing that list, and why should one note be considered as unwanted

repetition. is it not allowed to repeat a note ?

in that list you posted one would remove 10 notes if a rule is

no consecutive same notes are allowed.

then - what is active value ?

how should that "system" add non existing data ?

upon what criteria ?

that´s why I suggest: do it manually in text edit.

berane9's icon

dear Source Audio,

let me take in consideration the 2nd output you suggested.

  1. if there is no need of repetition of the note, your suggestion is correct. However, here the decision is made by the machine not by an end user. So a convinient suggestion is to set a diologue table and allow the end user to decide which one to add and what to leave it as it is (repeating). Therefore, to allow a decision from the user there is a need to edit a table or a multislider or a list of a number box. The decision comes from the user: if there are lyrics of words on that note then the repetition is needed. If not there should create an option to delete the note, but not delete the time-measure of that not. So the time measure of the deleted note should be added to the time measure of the main note. I think that, may be there is a need a lookup table to decide manually.

  2. if numbers are ordered in a list or in mustislider tables, there is a need to correct also the time measure. I suggest a list of ordered numbers be set, and then the correction can be clearer to best select the individual notes as well as the time-measure units. Hope I gave more info on this issue. Thanks

berane9's icon

The 1st part of your statement is not coming on my screen according to your site.

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

I don´t know what you mean with that.

original posted list had 63 items, the last one you posted has 123 items.

original list had 10 repeated notes, last one has 20 repeated notes.

here you can see new list in full length at the left,

thinned one at the right and printed removed indexes from coll

but anyway, I am not suggesting anything here.

you as usuall talk unclear.

now you mention lyrics ???

And that´s why I can´t really help you.

Just one suggestion - if what you call

"time measure" is delta time between note start points (in whatever units,

your ones make no sense, are too short to be ms, and too long to be beats)

you should rather convert that to absolute time.

then there would be no need to correct anything if one deletes a note.

And at the end , if I understand correctly that you want to present some sort of notation to your users, having notes and lyrics, where they can edit "mistakes", then look into notation software.

not in some "Alert Buttons"

berane9's icon

here is a sample I formulated. Please, correct it with your vision, as you always creatively construct it. Thanks

eliminate-the-repeating-note.maxpat
Max Patch

berane9's icon

Hello Source Audio,

the last output you worked out is correct for the note and the ms numbers. However, it doesn't add the 1st item which is the time-measure.

The time-measure I want to add is to perlong the note for the 2 explicit units. And in this case the time measure will be multiplied by a definite coefficient. It was shrank to use small number.

You said the ms I mentioned is too litle to be accounted. However, that number will be multiplied by a 1000.

Therefore, the delition of note helps to group it in one unit and not to be replicate a note with no lyrics. The time measure will be a guidance to detect the value of 1/4 or 2/4 or 4/4 or the fraction values of time measure. And lastly the ms that is divided by a 1000 will be used to replicate the notes during activities or refining time or testing and consulting with the audio parts. Hope you got more info. Thanks

I tried the last output you sent. However, the 1st item that is the time measure of the 2 similar note is not adding.

When there are 4 or 5 list of consecutive equal number, it is better add the parts one piece at a time for there might be a lyrics in the mid part. Thanks.

NB: there is also a case I need to add 2 or 3 notes in the 3 pair of numbers. Thanks