pyampact.symbolic.harm

pyampact.symbolic.harm(piece, snap_to=None, filler='forward', output='array')[source]

Get the harmonic analysis portion of the **harm spine in a kern file if there is one and return it as an array or a time-aligned pandas Series. The prevailing key signature information is not included here from the harm spine, but that key information is available in the .keys method. This is similar to the .keys, .functions, .chords, and .cdata methods. The default is for the results to be returned as a 1-d array, but you can set output=’series’ for a pandas series instead which is helpful if you’re going to concatenate the results to a dataframe. If want to get the results of a different spine type (i.e. not one of the ones listed above), see getSpines().

If you want to align these results so that they match the columnar (time) axis of the pianoRoll, sampled, or mask results, you can pass the pianoRoll or mask that you want to align to as the snap_to parameter. Doing that makes it easier to combine these results with any of the pianoRoll, sampled, or mask tables to have both in a single table which can make data analysis easier. Passing a snap_to argument will automatically cause the return value to be a pandas series since that’s facilitates combining the two. Here’s how you would use the snap_to parameter and then combine the results with the pianoRoll to create a single table.