const hr = require('harmony-ts');
var bassNotesPrim = [
'E2', 'F2', 'G2',
'A2', 'B2', 'A2',
'F2', 'G2', 'A2',
'C3', 'F2'
];
var bassNotes = bassNotesPrim.map(n => new hr.AbsoluteNote(n));
bassNotes[3]._accidental = hr.Accidental.FLAT;
bassNotes[4]._accidental = hr.Accidental.FLAT;
bassNotes[5]._accidental = hr.Accidental.FLAT;
bassNotes[8]._accidental = hr.Accidental.FLAT;
var levels = [
'V65', 'I', 'V43',
'I6', 'V42', 'I6',
'I', 'vii6', 'I6',
'V', 'I'
];
var scaleNotes = hr.Scale.NaturalMinor.notes;
var scale = [hr.Key.F, hr.Scale.Quality.MINOR];
var inRomans = levels.map(le => new hr.RomanNumeral(le, scale));
var i = 0;
var con = [];
for (i = 0; i < bassNotes.length; i++) {
con.push(new hr.IncompleteChord({voices:[undefined, undefined, undefined, bassNotes[i]], romanNumeral: inRomans[i], flags: {key: hr.Key.F}}));
}
var partWriter = new hr.PartWriter();
var results = hr.flattenResults(partWriter.voiceAll(con, scaleNotes));
var bestResult = results.next().value;
I try to make the first bass note natural F although it's Fm scale and the other flat according the scale.