Closed amitgur closed 9 years ago
You should be able to do that by utilizing the TeoriaNote#enharmonics() method.
function simplifyNote(note) {
var acc = Math.abs(note.accidentalValue());
if (acc === 0) return note;
var simplestNote = note;
note.enharmonics().forEach(function(note) {
var enharmonicAcc = Math.abs(note.accidentalValue());
if (enharmonicAcc < acc) {
simplestNote = note;
acc = enharmonicAcc;
}
});
return simplestNote;
}
Somtimes musical operations on note and interval gets notes like B# or Fb. I needed to simplify that to c and e, I wrote this function. Any other way to do that ?
teoria.normalizeNote = function(n){
I guess there should be a function for the general case Gbb=F