ChordSegmentator divides the analysed audio data into segments characterized by different chords. More...
#include <ChordSegmentator.hxx>
Public Member Functions | |
ChordSegmentator () | |
~ChordSegmentator () | |
void | doIt (CLAM::TData ¤tTime, const std::vector< double > &correlation, const unsigned firstCandidate, const unsigned secondCandidate) |
void | doItSimple (CLAM::TData ¤tTime, const std::vector< double > &correlation, const unsigned firstCandidate, const unsigned secondCandidate) |
Simple chord segmentation method. | |
void | doItSimilarity (CLAM::TData ¤tTime, const std::vector< double > &correlation, const unsigned firstCandidate, const unsigned secondCandidate) |
Chord similarity based segmentation method. | |
void | openSegment (CLAM::TData ¤tTime, unsigned currentChord) |
void | closeSegment (CLAM::TData ¤tTime) |
void | changeChordIfSegmentTooSmall (unsigned &segment) |
void | mergeSegmentIfIdenticalChordInPreviousSegment (unsigned &segment) |
void | closeLastSegment (CLAM::TData ¤tTime) |
void | eraseAllSegments () |
void | estimateChord (const ChordCorrelator::ChordCorrelation &correlation, unsigned &estimatedChord) |
void | changeChordsForSmallSegments () |
Finds segments shorter then minSegmentLength and assigns them the same chord as the chord in either the previous or the next segment. | |
void | joinSegmentsWithIdenticalChords () |
const CLAM::DiscontinuousSegmentation & | segmentation () const |
const std::vector< unsigned > & | chordIndexes () const |
void | method (unsigned method) |
ChordSegmentator divides the analysed audio data into segments characterized by different chords.
It takes as input the chord correlation for each frame and decides whether this new data signifies a chord change in the music. If so it opens a new segment for the new chord, at the same time closing the previous segment.
Definition at line 44 of file ChordSegmentator.hxx.
Simac::ChordSegmentator::ChordSegmentator | ( | ) | [inline] |
Definition at line 60 of file ChordSegmentator.hxx.
References method().
Simac::ChordSegmentator::~ChordSegmentator | ( | ) | [inline] |
Definition at line 69 of file ChordSegmentator.hxx.
void Simac::ChordSegmentator::changeChordIfSegmentTooSmall | ( | unsigned & | segment | ) | [inline] |
Definition at line 199 of file ChordSegmentator.hxx.
References CLAM_ASSERT, CLAM::Segmentation::offsets(), and CLAM::Segmentation::onsets().
Referenced by changeChordsForSmallSegments(), and closeSegment().
void Simac::ChordSegmentator::changeChordsForSmallSegments | ( | ) | [inline] |
Finds segments shorter then minSegmentLength and assigns them the same chord as the chord in either the previous or the next segment.
Definition at line 295 of file ChordSegmentator.hxx.
References changeChordIfSegmentTooSmall(), and CLAM::Segmentation::onsets().
Referenced by closeLastSegment().
const std::vector<unsigned>& Simac::ChordSegmentator::chordIndexes | ( | ) | const [inline] |
Definition at line 307 of file ChordSegmentator.hxx.
void Simac::ChordSegmentator::closeLastSegment | ( | CLAM::TData & | currentTime | ) | [inline] |
Definition at line 234 of file ChordSegmentator.hxx.
References changeChordsForSmallSegments(), CLAM::DiscontinuousSegmentation::dragOffset(), joinSegmentsWithIdenticalChords(), and CLAM::Segmentation::maxPosition().
void Simac::ChordSegmentator::closeSegment | ( | CLAM::TData & | currentTime | ) | [inline] |
Definition at line 181 of file ChordSegmentator.hxx.
References changeChordIfSegmentTooSmall(), CLAM::DiscontinuousSegmentation::dragOffset(), and mergeSegmentIfIdenticalChordInPreviousSegment().
Referenced by doItSimilarity(), and doItSimple().
void Simac::ChordSegmentator::doIt | ( | CLAM::TData & | currentTime, | |
const std::vector< double > & | correlation, | |||
const unsigned | firstCandidate, | |||
const unsigned | secondCandidate | |||
) | [inline] |
Definition at line 71 of file ChordSegmentator.hxx.
References doItSimilarity(), doItSimple(), and CLAM::Segmentation::maxPosition().
void Simac::ChordSegmentator::doItSimilarity | ( | CLAM::TData & | currentTime, | |
const std::vector< double > & | correlation, | |||
const unsigned | firstCandidate, | |||
const unsigned | secondCandidate | |||
) | [inline] |
Chord similarity based segmentation method.
Definition at line 117 of file ChordSegmentator.hxx.
References closeSegment(), CLAM::DiscontinuousSegmentation::dragOffset(), estimateChord(), and openSegment().
Referenced by doIt().
void Simac::ChordSegmentator::doItSimple | ( | CLAM::TData & | currentTime, | |
const std::vector< double > & | correlation, | |||
const unsigned | firstCandidate, | |||
const unsigned | secondCandidate | |||
) | [inline] |
Simple chord segmentation method.
Definition at line 87 of file ChordSegmentator.hxx.
References closeSegment(), CLAM::DiscontinuousSegmentation::dragOffset(), and openSegment().
Referenced by doIt().
void Simac::ChordSegmentator::eraseAllSegments | ( | ) | [inline] |
Definition at line 253 of file ChordSegmentator.hxx.
References CLAM::Segmentation::maxPosition(), CLAM::Segmentation::onsets(), and CLAM::DiscontinuousSegmentation::remove().
void Simac::ChordSegmentator::estimateChord | ( | const ChordCorrelator::ChordCorrelation & | correlation, | |
unsigned & | estimatedChord | |||
) | [inline] |
Definition at line 263 of file ChordSegmentator.hxx.
Referenced by doItSimilarity().
void Simac::ChordSegmentator::joinSegmentsWithIdenticalChords | ( | ) | [inline] |
Definition at line 300 of file ChordSegmentator.hxx.
References mergeSegmentIfIdenticalChordInPreviousSegment(), and CLAM::Segmentation::onsets().
Referenced by closeLastSegment().
void Simac::ChordSegmentator::mergeSegmentIfIdenticalChordInPreviousSegment | ( | unsigned & | segment | ) | [inline] |
Definition at line 218 of file ChordSegmentator.hxx.
References CLAM::DiscontinuousSegmentation::dragOffset(), CLAM::Segmentation::offsets(), CLAM::Segmentation::onsets(), and CLAM::DiscontinuousSegmentation::remove().
Referenced by closeSegment(), and joinSegmentsWithIdenticalChords().
void Simac::ChordSegmentator::method | ( | unsigned | method | ) | [inline] |
Definition at line 308 of file ChordSegmentator.hxx.
References Simac::ChordCorrelator::chordPatternsSimilarity().
Referenced by ChordSegmentator(), and Simac::ChordExtractor::doIt().
void Simac::ChordSegmentator::openSegment | ( | CLAM::TData & | currentTime, | |
unsigned | currentChord | |||
) | [inline] |
Definition at line 175 of file ChordSegmentator.hxx.
References CLAM::DiscontinuousSegmentation::insert().
Referenced by doItSimilarity(), and doItSimple().
const CLAM::DiscontinuousSegmentation& Simac::ChordSegmentator::segmentation | ( | ) | const [inline] |
Definition at line 306 of file ChordSegmentator.hxx.