1/* 2edo.test.mjs - tests of edo.mjs 3Copyright (C) 2025 Rob McKinnon and Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/tonal/test/tonal.test.mjs> 4This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. 5*/ 6import '../edo.mjs'; 7import { n } from '@strudel/core'; 8import { describe, it, expect } from 'vitest'; 9 10describe('edoScale', () => { 11 it('Should run tonal functions ', () => { 12 // base note A3 = 220Hz 13 let baseNote = 'A3'; 14 let root = 220; 15 let freq = 220; 16 let pattern = n('0').edoScale([baseNote, 'LLsLLLs', 2, 1]); 17 let cycle = pattern.firstCycleValues[0]; 18 expect(cycle.freq).toEqual(freq); 19 expect(cycle.edo).toEqual(12); 20 expect(cycle.degree).toEqual(1); 21 expect(parseFloat(cycle.root).toFixed(0)).toEqual(root.toFixed(0)); 22 23 // base note A4 = 440Hz 24 baseNote = 'A4'; 25 root = 440; 26 freq = 880; 27 pattern = n('7').edoScale([baseNote, 'LLsLLLs', 2, 1]); 28 cycle = pattern.firstCycleValues[0]; 29 expect(cycle.freq).toEqual(freq); 30 expect(cycle.edo).toEqual(12); 31 expect(cycle.degree).toEqual(1); 32 expect(parseFloat(cycle.root).toFixed(0)).toEqual(root.toFixed(0)); 33 }); 34});