Accessing a Chord Symbol text for a Fret diagram
Hi,
What are the steps to access a Chord Symbol attached to a Fret Diagram ?
Accessing a regular Chord Symbol is done through the annotations at a segment.
But in the case of a Fret Diagram with a Chord Symbol, the Chord Symbol is not defined as an annotation.
While the Fret Diagram itself is defined as an annotation.
I cannot find how to access the Chord Symbol text from that Fret Diagram element.
Anyone knows how to achieve this ?
Comments
You need to select one or more chord symbols not through the blue rectangle (if you look carefully this way it is not highlighted), but as individual elements. At this point it is accessible as an element of type "Harmony", and has the fret diagram as its "parent".
In reply to You need to select one or… by ILPEPITO
My point is from the opposite perspective.
Given that my plugin is analyzing a score, segment by segment (so independently of the user's selection) how can I retrieve the Chord Symbol attached at a Fret Diagram.
Retrieving a standalone Chord Symbol is easy. At a given segment, look for any an annotation of type HARMONY.
Retrieving the Fret Diagram is easy. At a given segment, look for any an annotation of type FRET_DIAGRAM.
But at that segment, there is no annotation of type HARMONY. Because that Chord Symbol is not attached to the segment, but to the Fret Diagram.
My question is, how can I, once I've retrieved a Fret Diagram on the form of an annotation of type FRET_DIAGRAM, find the associated Chord Symbol text ?
In reply to My point is from the… by parkingb
Everything you say is perfectly true, in the case of FRET_DIAGRAM+HARMONY, HARMONY is attached to FRET_DIAGRAM and not to the segment. If the FRET_DIAGRAM element contains information about HARMONY, just as CHORD contains information about NOTE, and in turn NOTE contains information about STEM, DOT, BEAM (I think I'm telling you things you know), and so on, there would be no problem. The fact is that FRET_DIAGRAM does not contain any information about HARMONY, so for the segment it actually does not exist.
The only way, for me, is to write (and this can certainly be done) a routine which, after having stored all the HARMONY elements in an ARRAY, proceeds to remove all the FRET_DIAGRAM elements and rewrite only the HARMONY elements.
Good luck.
In reply to Everything you say is… by ILPEPITO
> The only way, for me, is to write (and this can certainly be done) a routine which, after having stored all the HARMONY elements in an ARRAY, proceeds to remove all the FRET_DIAGRAM elements and rewrite only the HARMONY elements.
I'm not sure to follow you :-/ I don't need to delete anything :-/ I just need to access the info...
> the fact is that FRET_DIAGRAM does not contain any information about HARMONY, so for the segment it actually does not exist.
That's also my conclusion. And given that my plugin processes is segment-based, it sucks...
In reply to > The only way, for me, is… by parkingb
I don't think there's any point in getting discouraged. If one path doesn't work, another is sought.
I don't know what the final purpose of your plugin is, but if the purpose is only to analyze chords I don't see why not use the first tip I provided, which is to select all the chord symbols (attached or not to a FRET_DIAGRAM) via the function provided by the software itself, and then run the plugin that I have provided as an example.
The idea of deleting the FRET_DIAGRAM to rewrite only the HARMONY, which are not associated with the FRET_DIAGRAM and are accessible as "annotations", can be carried out on a copy of the score.
A third way is to save the score in mscx format, which is formatted text, and which contains complete information on all the elements present, and analyze it as a text file using a musescore plugin or software created with the language you prefer.
In reply to I don't think there's any… by ILPEPITO
The context is the one of my Solo Analyser plugin, where the user can select a portion of a score and have the plugin analyzing how it relates to the relevant chords. The fact is the the chord symbols might not belong to the user selection. They might be defined before the selection, or on staff above the selection or below.
E.g. Let's take a jazz score where the the chords are defined on the top staff (e.g. the lead instrument), and the user would like to analyze only the bass line according to those chords Then, the user selects only the measure sto analyze on the bass staff. So, no harmony are selected. For its analyze, the plugin will identify which chord symbol to use at each segment of the selected measure (depending on various options) .
The only way would be to save/store the user selection somehow, force a selection of the entire score, look for any element of HARMONY type,
In reply to The context is the one of my… by parkingb
Well, it's not clear to me what you want to do from a musical point of view (the important thing is that it's clear to you), but I think I understand the philosophy of your project.
The solution you propose might be right, but it seems a bit complicated to me.
Based on my personal experience, it seems simpler to me:
1) create a 'map' of the measures (in one or more ARRAY) of the entire score through the use of 'cursor.measure.firstSegment.tick' or 'cursor.measure.lastSegment.tick' (which contain the start position and end of each measure), and 'cursor.measure.prevMeasure.firstSegment.tick' or 'cursor.measure.nextMeasure.firstSegment.tick' (which allow you to go back or forward between measures). Considering the C time, the first measure will have an interval in ticks from 0 to 1920, the second from 1920 to 3840 and so on. The first measure will contain elements from tick 0 to tick 1919, the second from tick 1920 to tick 3839, etc. In this way you will be able to refer the group of notes selected in any part of the score to the chord symbols within a very specific interval.
2) store (in one or more ARRAY) all the chord symbols by selecting them with the method I prefer, or using the 'annotations' but with the problem of not being able to access those associated with the FRET_DIAGRAM. Each chord symbol will be stored with its relative 'cursor.tick' position, so as to be able to know which chords are present in the portion of notes subsequently selected.
3) Once all this has been done, it will be possible to select any portion of the score and find the chord symbols relating to it (with cursor.tick).
One final consideration: the only useful information about the HARMONY element is its 'text', which contains the key note and the type of chord, nothing else. It seems obvious to me that it will be necessary to build a sort of encyclopedia of chords depending on your musical needs.
A lot of work awaits you.
In reply to Well, it's not clear to me… by ILPEPITO
> 2) store (in one or more ARRAY) all the chord symbols by selecting them with the method I prefer, or using the 'annotations' but with the problem of not being able to access those associated with the FRET_DIAGRAM. Each chord symbol will be stored with its relative 'cursor.tick' position, so as to be able to know which chords are present in the portion of notes subsequently selected.
I'm already doing all of this but I'm stuck with "or using the 'annotations' but with the problem of not being able to access those associated with the FRET_DIAGRAM" which is actually the purpose of my question.
All the rest is working 100%.
In reply to > 2) store (in one or more… by parkingb
In fact, I told you that that's not my favorite method... have you managed to make progress? If not, I can send you an example with the implementation of everything I suggested.
In reply to In fact, I told you that… by ILPEPITO
Hi, Sorry for my late reply. I stopped working on this idea. I worked on other plugins of mine.
Your suggestion is very clear to be to me and I have no difficulty reproducing it. It is just that I don't see it fitting well in my current plugin architecture.
In reply to Hi, Sorry for my late reply… by parkingb
Ok, it happens that you discover that the interface made available by the Musescore developers for plugin creators is insufficient for the purpose.