rualark / MGen

MGen: Windows PC C++ music generation and analysis laboratory, playing into MIDI port and exporting MIDI
http://arkhipenko.weebly.com
GNU Affero General Public License v3.0
45 stars 11 forks source link

CA3: New rhythm repeat rules between voices #2595

Closed rualark closed 5 years ago

rualark commented 5 years ago

Начиная с 5 голосов можно иметь одинаковые ритмы в двух голосах. Поэтому начиная с 5 голосов можно это правило вообще не проверять. Другой вариант – для любого количества голосов нужно как минимум два разных ритма в такте между голосами.

rualark commented 5 years ago

Currently it works only for species 5 voices.

int CP2R::FailRhythmRepeat() {
    CHECK_READY(DR_fli);
    for (v = 0; v < av_cnt; ++v) {
        // Only for sp5
        if (vsp[v] != 5) continue;
        for (v2 = v + 1; v2 < av_cnt; ++v2) {
            // Only for sp5
            if (vsp[v2] != 5) continue;
            for (ms = 1; ms < mli.size() - 1; ++ms) {
                s = mli[ms];
                if (s >= ep2) break;
                ls = bli[v][s];
                //if (ms >= rh_id[v].size() || ms >= rh_id[v2].size()) continue;
                // Fire if rhythm and pauses rhythm matches and there is no whole-measure pause
                if (rh_id[v][ms] == rh_id[v2][ms] && rh_pid[v][ms] == rh_pid[v2][ms] &&
                    (fli2[v][ls] < s + npm - 1 || cc[v][s]))
                    AutoFlagL(v, 549, s, fli[v][bli[v][s + npm - 1]], v2);
            }
        }
    }
    return 0;
}
rualark commented 5 years ago

According to the new rules, if there is at least one c.f. or species 1 voice, rule does not need to be checked, because rule is not relevant for full species 1 counterpoints. Also, if there are species 5 voices, they will definitely be different in rhythm from c.f. / species 1.

Now, if there is no c.f. or species 1, at least two different rhythms should be present irrelevant of species.