Skip to main content

Module aligner

Module aligner 

Source
Expand description

Two streams aligned note by note, as an edit from one to the other: music21’s alpha.analysis.aligner.

Structs§

Change
A change from the target to the source: the target’s note, the source’s, and what became of it.
ChangePlace
Where a change stands: the places music21 reads the two hashes from, and what became of the note.
StreamAligner
Two streams aligned by their notes’ hashes, the cheapest edit from one to the other: music21’s StreamAligner.

Enums§

ChangeOp
What becomes of a note from the target to the source: music21’s ChangeOps.

Functions§

change_places
The cheapest edit from the target to the source read out of a matrix already filled, each change with the places of the two hashes it is between: the by-position twin of calculateChangesList.
default_hasher
A hasher for an alignment: music21’s StreamAligner.getDefaultHasher, which hashes no offset and says what each hash was made from.
delete_cost
What it costs to take a note out that the target has not got: music21’s deleteCost, which is the same count.
fill_distance_matrix
The cheapest edit onto every opening of the two, written into a matrix already set up: music21’s populateDistanceMatrix.
hashes_equal_without_reference
Whether two hashes say the same of a note, whatever each was made from: music21’s tupleEqualityWithoutReference.
insert_cost
What it costs to put a note in that the source has not got: music21’s insertCost, which is how many values the hash says.
moves_from_location
The costs of the three moves onto a cell – up, left and diagonally – each nothing where that cell is off the matrix: music21’s getPossibleMovesFromLocation.
num_similarities
How many of the values two hashes say alike: music21’s calculateNumSimilarities.
op_from_location
The change that leads to a cell: music21’s getOpFromLocation – none where the cost standing there is the cheapest move’s, otherwise the cheapest move, up before left before diagonal.
populate_distance_matrix
A matrix set up and filled in one: music21’s setupDistanceMatrix and populateDistanceMatrix together.
setup_distance_matrix
A matrix of the right size for an alignment, every cost nought: music21’s setupDistanceMatrix.
similarity_score
How much of an edit changes nothing: music21’s similarityScore.
substitution_cost
What it costs to turn one note’s hash into another’s: music21’s substitutionCost – nothing where the two say the same, otherwise how many of the values differ.