Closed akhilsadam closed 2 years ago
For the line chord = [mp.C(i['chd']) % (i['time'], i['arp']) for i in chp]
, this sets the duration and interval for the chord, so I suggest the better naming for time
and arp
should be duration
and interval
.
If you want to set the durations and intervals for each note in the chord, the value for duration and interval should both be a list, the lists contain the duration and interval for each note. If you set the value for duration and interval to be a float, which is in your case, this set all of the notes has the exactly same duration and interval to that float.
So here is an example:
{
"chd": "Cm7",
"duration": [0.5, 0.5, 0.5, 0.5],
"interval": [0.5, 0.5, 0, 0],
"start": 0,
"inst": "Acoustic Grand Piano"
}
In this example, the duration could also be just 0.5
, which is equivalent.
I hope this helps.
Thank you. My question was more related to the chord_analysis function. So for the example I gave above, I only get a single chord when I run chord_analysis, is that expected behavior?
I assumed that I was not setting the intervals correctly, but by your clarification, that should not be the problem.
Thank you for the the naming suggestions; those names are much more informative.
I see, this is not the expected behavior, since you are writing a chord progression only, so you can set the parameter is_chord
to True
in the chord_analysis
function, which will treat the input chord instance as chord only, instead of a whole piece (which means chords and melodies altogether), by default, the is_chord
parameter is set to False
, in this case, the function will firstly do a split melody and chord algorithm operation, then try to analysis the chord part. Here I have an example for you:
chord_progression1 = C('Cm7') | C('D') | C('E')
>>> chord_analysis(chord_progression1 , is_chord=True)
['Cm7', 'Dmajor', 'Emajor']
That makes sense. Thank you so much!
You are welcome.
I have a question regarding the interval description:
Starting from a JSON structure, I would like to convert to a musicpy piece and then do a chord analysis as follows :
But this returns
['Cmaj13#11 omit B, G sort as [1, 3, 2, 4, 5]']
. I noticed that Track 0 never has any 0-intervals, which I see in other songs. (output frompiece.tracks[0]
):Could you please explain what I am missing? Thank you so much!