def bass_note_tendency_score(candidate, beat): this_chord = chords.get(beat.start()) score = 0.0 candidate_is_this_chord_bass_note = pitches.same_species(candidate, this_chord.bass_note) # first bass note should definitely be the root if beat.start() == 0 and candidate_is_this_chord_bass_note: return vars.FIRST_BEAT_BASS_ROOT # If beat one, we want to hear the bass note if beat.first_beat() and candidate_is_this_chord_bass_note: score += vars.FIRST_BEAT_BASS_NOTE last_chord = chords.get(0 if beat.start() == 0 else beat.previous().start()) this_and_next_chord_are_same = chords.same(last_chord, this_chord) this_chord_root_in_bass = this_chord.root_in_bass() # Chord is the same as the last chord, and this is root note. Less important as root was likely # already established if this_and_next_chord_are_same and candidate_is_this_chord_bass_note and this_chord_root_in_bass: score += vars.BASS_ROOT_SAME_CHORD # Bass note does not equal root note, therefore it is especially important if pitches.same_species(candidate, this_chord.bass_note) and not this_chord_root_in_bass: score += vars.NON_ROOT_BASS_NOTE # new chord, we definitely want to hear the bass_note if not this_and_next_chord_are_same and candidate_is_this_chord_bass_note: score += vars.BASS_NOTE_NEW_CHORD return score
def __eq__(self, other): if not isinstance(other, self.__class__): return False elif isinstance(other, chords.Chord): return chords.same(other.root_chord, self.root_chord) return False
def __get_musicality(self): score = 0.0 this_chord = config.chord_progression[self.position] next_chord = config.chord_progression[self.position + config.resolution] score += vars.HALF_NEIGHBOR_SAME_CHORD if chords.same(this_chord, next_chord) \ else vars.HALF_NEIGHBOR_DEFAULT_MUSICALITY score += vars.FLICKER_COEF if self.causes_flickering() else 0.0 return score
def __get_musicality(self): score = 0.0 this_chord = config.chord_progression[self.position] next_chord = config.chord_progression[self.position + config.resolution] score += vars.ARPEGGIAL_SAME_CHORD if chords.same(this_chord, next_chord) \ else vars.ARPEGGIAL_NEW_CHORD score += vars.FLICKER_COEF if self.causes_flickering() else 0.0 return score