mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
fix scales without c
This commit is contained in:
parent
df21c81bfa
commit
71952ca8fd
@ -21,11 +21,11 @@ export function scaleOffset(scale, offset, index = 0) {
|
||||
while (Math.abs(i) < Math.abs(offset)) {
|
||||
i += direction;
|
||||
const index = mod(i, notes.length);
|
||||
if (direction < 0 && n === 'C') {
|
||||
if (direction < 0 && n[0] === 'C') {
|
||||
o += direction;
|
||||
}
|
||||
n = notes[index];
|
||||
if (direction > 0 && n === 'C') {
|
||||
if (direction > 0 && n[0] === 'C') {
|
||||
o += direction;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,9 @@ describe('scaleTranspose', () => {
|
||||
scaleTranspose('C minor', -1, 'Bb2');
|
||||
scaleTranspose('C minor', 8, 'C4');
|
||||
scaleTranspose('C4 minor', 8, 'C5');
|
||||
scaleTranspose('C# major', 8, 'C#4');
|
||||
scaleTranspose('C# major', -1, 'B#2');
|
||||
scaleTranspose('C# major', -2, 'A#2');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user