Skip to content

Commit

Permalink
https://github.com/cuthbertLab/music21/pull/1695
Browse files Browse the repository at this point in the history
  • Loading branch information
float3 committed Mar 13, 2024
1 parent 1b9ee1e commit 7769edb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions music21-rs/src/pitch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,11 @@ fn dissonance_score(
if small_pythagorean_ratio | triad_award {
for (index, p1) in pitches.iter().enumerate() {
for p2 in pitches.iter().skip(index + 1) {
match Interval::new(p1.clone(), p2.clone()) {
let mut p1 = p1.clone();
let mut p2 = p2.clone();
p1.octave = None;
p2.octave = None;
match Interval::new(p1, p2) {
Some(interval) => intervals.push(interval),
None => return std::f64::INFINITY,
}
Expand All @@ -434,11 +438,7 @@ fn dissonance_score(
if small_pythagorean_ratio {
for interval in intervals.iter() {
match interval.interval_to_pythagorean_ratio() {
Some(ratio) => {
score_ratio += ((ratio.numerator * ratio.denominator) as f64 / ratio.f64())
.ln()
* 0.03792663444
}
Some(ratio) => score_ratio += (ratio.denominator as f64).ln() * 0.03792663444,
None => return std::f64::INFINITY,
};
}
Expand Down

0 comments on commit 7769edb

Please sign in to comment.