### Correcting falsely assigned enharmonics in sheet music

@@ -52,8 +52,837 @@
 t music%0A
+%0Aimport freqs%0Afrom music21 import *%0A%0Atable = freqs.table%0A%0Adef correct_enharm(filename): # might add more arguments for control%0A%09'''%0A%09Open and scan through music file, and replace accidentals with likeliest enharmonic equivalents.%0A%09'''%0A%09pass%0A%0Adef likeliest_enharm(n, np, nn, c, cp, cn, k):%0A%09'''%0A%09Estimate the likeliest enharmonic equivalent of the current note based on the previous and next notes, as well as%0A%09the previous, current and next chords.%0A%09'''%0A%09# P(n = e %7C np, nn, c, cp, cn, k) = Z * P(n = e %7C np, cp, c, k) * P(nn %7C n = e, c, cn, k)%0A%09n1 = enharm_eqv(n)%0A%09# problem: what if np, nn are also ambiguous? condition across enharmonics, in a function replacing tprob%0A%09if table.tprob(n1, np, cp, c, k) * table.tprob(nn, n1, c, cn, k) %3E%0A%09   table.tprob( n, np, cp, c, k) * table.tprob(nn,  n, c, cn, k):%0A%09%09return n1%0A%09return n%0A

Calculate likeliest enharmonic equivalent