FIXES: TODO in rotateChroma
This commit is contained in:
parent
bbb29ebd7c
commit
0fa5832b63
3 changed files with 5 additions and 5 deletions
|
|
@ -61,8 +61,7 @@ describe('tonleiter', () => {
|
|||
});
|
||||
test('rotateChroma', () => {
|
||||
expect(rotateChroma(0, 1)).toBe(1);
|
||||
expect(rotateChroma(0, -1)).toBe(-1); // this is wrong...
|
||||
//expect(rotateChroma(0, -1)).toBe(11); // <-- TODO
|
||||
expect(rotateChroma(0, -1)).toBe(11);
|
||||
expect(rotateChroma(11, 1)).toBe(0);
|
||||
expect(rotateChroma(11, 13)).toBe(0);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ export const pc2chroma = (pc) => {
|
|||
return pcs.indexOf(letter.toLowerCase()) + rest.reduce((sum, sign) => sum + accs[sign], 0);
|
||||
};
|
||||
|
||||
export const rotateChroma = (chroma, steps) => (chroma + steps) % 12;
|
||||
export const rotateChroma = (chroma, steps) => ((chroma + steps % 12) + 12) % 12;
|
||||
|
||||
|
||||
export const chroma2pc = (chroma, sharp = false) => {
|
||||
return (sharp ? sharps : flats)[chroma];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue