mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-14 15:18:30 +00:00
FIXES: note2pc TODOs
This commit is contained in:
parent
a3fdfbbc16
commit
4298e582fb
@ -80,9 +80,9 @@ describe('tonleiter', () => {
|
||||
});
|
||||
test('note2pc', () => {
|
||||
expect(note2pc('C5')).toBe('C');
|
||||
// expect(note2pc('C52')).toBe('C'); // <- 2 digits fail
|
||||
expect(note2pc('C52')).toBe('C');
|
||||
expect(note2pc('Bb3')).toBe('Bb');
|
||||
//expect(note2pc('F')).toBe('F'); // <- fails
|
||||
expect(note2pc('F')).toBe('F');
|
||||
});
|
||||
test('note2oct', () => {
|
||||
expect(note2oct('C5')).toBe(5);
|
||||
|
||||
@ -27,7 +27,7 @@ export function tokenizeChord(chord) {
|
||||
}
|
||||
return match.slice(1);
|
||||
}
|
||||
export const note2pc = (note) => note.slice(0, -1);
|
||||
export const note2pc = (note) => note.match(/^[A-G][#b]?/i)[0];
|
||||
export const note2oct = (note) => Number(note.slice(-1));
|
||||
|
||||
export const note2chroma = (note) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user