|
maiacore 1.10.1
Music analisys library
|
Represents a collection of musical scores, supporting batch analysis and management. More...
#include <score_collection.h>
Public Member Functions | |
| ScoreCollection (const std::string &directoryPath={}) | |
| Constructs a ScoreCollection from a single directory path. More... | |
| ScoreCollection (const std::vector< std::string > &directoriesPaths={}) | |
| Constructs a ScoreCollection from multiple directory paths. More... | |
| std::vector< std::string > | getDirectoriesPaths () const |
| Returns the list of directory paths associated with the collection. More... | |
| void | setDirectoriesPaths (const std::vector< std::string > &directoriesPaths) |
| Sets the list of directory paths and reloads the collection. More... | |
| void | addDirectory (const std::string &directoryPath) |
| Adds a directory path to the collection (does not reload files automatically). More... | |
| void | addScore (const Score &score) |
| Adds a Score object to the collection. More... | |
| void | addScore (const std::string &filePath) |
| Loads a Score from a file path and adds it to the collection. More... | |
| void | addScore (const std::vector< std::string > &filePaths) |
| Loads multiple Scores from file paths and adds them to the collection. More... | |
| void | clear () |
| Removes all scores from the collection. | |
| int | getNumDirectories () const |
| Returns the number of directories in the collection. More... | |
| int | getNumScores () const |
| Returns the number of scores in the collection. More... | |
| std::vector< Score > & | getScores () |
| Returns a reference to the vector of Score objects (modifiable). More... | |
| const std::vector< Score > & | getScores () const |
| Returns a const reference to the vector of Score objects. More... | |
| bool | isEmpty () const |
| Returns true if the collection contains no scores. More... | |
| void | merge (const ScoreCollection &other) |
| Merges another ScoreCollection into this one, combining directories and scores. More... | |
| void | removeScore (const int scoreIdx) |
| Removes a score from the collection by its index. More... | |
| ExtendedMelodyPatternTable | findMelodyPattern (const std::vector< Note > &melodyPattern, const float totalIntervalsSimilarityThreshold=0.5f, const float totalRhythmSimilarityThreshold=0.5f, const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> &intervalsSimilarityCallback=nullptr, const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> &rhythmSimilarityCallback=nullptr, const std::function< float(const std::vector< float > &)> &totalIntervalSimilarityCallback=nullptr, const std::function< float(const std::vector< float > &)> &totalRhythmSimilarityCallback=nullptr, const std::function< float(float, float)> &totalSimilarityCallback=nullptr) const |
| Searches for a melodic pattern in all scores, returning extended results. More... | |
| std::vector< ExtendedMultiMelodyPatternTable > | findMelodyPattern (const std::vector< std::vector< Note > > &melodyPatterns, const float totalIntervalsSimilarityThreshold=0.5f, const float totalRhythmSimilarityThreshold=0.5f, const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> &intervalsSimilarityCallback=nullptr, const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> &rhythmSimilarityCallback=nullptr, const std::function< float(const std::vector< float > &)> &totalIntervalSimilarityCallback=nullptr, const std::function< float(const std::vector< float > &)> &totalRhythmSimilarityCallback=nullptr, const std::function< float(float, float)> &totalSimilarityCallback=nullptr) const |
| Searches for multiple melodic patterns in all scores, returning extended results for each pattern. More... | |
| ScoreCollection | operator+ (const ScoreCollection &other) const |
| Merges two ScoreCollections using the + operator. More... | |
Represents a collection of musical scores, supporting batch analysis and management.
The ScoreCollection class provides methods for loading, managing, and analyzing multiple Score objects. It is designed for large-scale musicological research, corpus studies, and batch processing of MusicXML files.
|
explicit |
Constructs a ScoreCollection from a single directory path.
| directoryPath | Path to a directory containing MusicXML files. |
|
explicit |
Constructs a ScoreCollection from multiple directory paths.
| directoriesPaths | Vector of directory paths. |
| void ScoreCollection::addDirectory | ( | const std::string & | directoryPath | ) |
Adds a directory path to the collection (does not reload files automatically).
| directoryPath | Directory path string. |
| void ScoreCollection::addScore | ( | const Score & | score | ) |
| void ScoreCollection::addScore | ( | const std::string & | filePath | ) |
Loads a Score from a file path and adds it to the collection.
| filePath | Path to a MusicXML file. |
| void ScoreCollection::addScore | ( | const std::vector< std::string > & | filePaths | ) |
Loads multiple Scores from file paths and adds them to the collection.
| filePaths | Vector of MusicXML file paths. |
| ExtendedMelodyPatternTable ScoreCollection::findMelodyPattern | ( | const std::vector< Note > & | melodyPattern, |
| const float | totalIntervalsSimilarityThreshold = 0.5f, |
||
| const float | totalRhythmSimilarityThreshold = 0.5f, |
||
| const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> & | intervalsSimilarityCallback = nullptr, |
||
| const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> & | rhythmSimilarityCallback = nullptr, |
||
| const std::function< float(const std::vector< float > &)> & | totalIntervalSimilarityCallback = nullptr, |
||
| const std::function< float(const std::vector< float > &)> & | totalRhythmSimilarityCallback = nullptr, |
||
| const std::function< float(float, float)> & | totalSimilarityCallback = nullptr |
||
| ) | const |
Searches for a melodic pattern in all scores, returning extended results.
Each result row includes file metadata and all fields from Score::MelodyPatternRow.
| melodyPattern | Vector of Note objects representing the pattern. |
| totalIntervalsSimilarityThreshold | Minimum interval similarity threshold. |
| totalRhythmSimilarityThreshold | Minimum rhythm similarity threshold. |
| intervalsSimilarityCallback | Custom function to calculate interval similarity. |
| rhythmSimilarityCallback | Custom function to calculate rhythm similarity. |
| totalIntervalSimilarityCallback | Function to aggregate interval similarity. |
| totalRhythmSimilarityCallback | Function to aggregate rhythm similarity. |
| totalSimilarityCallback | Function to combine total similarities. |
| std::vector< ExtendedMultiMelodyPatternTable > ScoreCollection::findMelodyPattern | ( | const std::vector< std::vector< Note > > & | melodyPatterns, |
| const float | totalIntervalsSimilarityThreshold = 0.5f, |
||
| const float | totalRhythmSimilarityThreshold = 0.5f, |
||
| const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> & | intervalsSimilarityCallback = nullptr, |
||
| const std::function< std::vector< float >(const std::vector< Note > &, const std::vector< Note > &)> & | rhythmSimilarityCallback = nullptr, |
||
| const std::function< float(const std::vector< float > &)> & | totalIntervalSimilarityCallback = nullptr, |
||
| const std::function< float(const std::vector< float > &)> & | totalRhythmSimilarityCallback = nullptr, |
||
| const std::function< float(float, float)> & | totalSimilarityCallback = nullptr |
||
| ) | const |
Searches for multiple melodic patterns in all scores, returning extended results for each pattern.
Each result row includes pattern index, file metadata, and all fields from Score::MelodyPatternRow.
| melodyPatterns | Vector of melodic patterns (each a vector of Note). |
| totalIntervalsSimilarityThreshold | Minimum interval similarity threshold. |
| totalRhythmSimilarityThreshold | Minimum rhythm similarity threshold. |
| intervalsSimilarityCallback | Custom function to calculate interval similarity. |
| rhythmSimilarityCallback | Custom function to calculate rhythm similarity. |
| totalIntervalSimilarityCallback | Function to aggregate interval similarity. |
| totalRhythmSimilarityCallback | Function to aggregate rhythm similarity. |
| totalSimilarityCallback | Function to combine total similarities. |
| std::vector< std::string > ScoreCollection::getDirectoriesPaths | ( | ) | const |
Returns the list of directory paths associated with the collection.
| int ScoreCollection::getNumDirectories | ( | ) | const |
Returns the number of directories in the collection.
| int ScoreCollection::getNumScores | ( | ) | const |
Returns the number of scores in the collection.
| std::vector< Score > & ScoreCollection::getScores | ( | ) |
| const std::vector< Score > & ScoreCollection::getScores | ( | ) | const |
| bool ScoreCollection::isEmpty | ( | ) | const |
Returns true if the collection contains no scores.
| void ScoreCollection::merge | ( | const ScoreCollection & | other | ) |
Merges another ScoreCollection into this one, combining directories and scores.
| other | Another ScoreCollection. |
|
inline |
Merges two ScoreCollections using the + operator.
| other | Another ScoreCollection. |
| void ScoreCollection::removeScore | ( | const int | scoreIdx | ) |
Removes a score from the collection by its index.
| scoreIdx | Index of the score to remove. |
| void ScoreCollection::setDirectoriesPaths | ( | const std::vector< std::string > & | directoriesPaths | ) |
Sets the list of directory paths and reloads the collection.
| directoriesPaths | Vector of directory path strings. |