diff --git a/examples/codemirror-repl/main.js b/examples/codemirror-repl/main.js index ff83122f..815db187 100644 --- a/examples/codemirror-repl/main.js +++ b/examples/codemirror-repl/main.js @@ -1,6 +1,6 @@ import { StrudelMirror } from '@strudel/codemirror'; import { funk42 } from './tunes'; -import { drawPianoroll, evalScope, controls } from '@strudel/core'; +import { drawPianoroll, evalScope } from '@strudel/core'; import './style.css'; import { initAudioOnFirstClick } from '@strudel/webaudio'; import { transpiler } from '@strudel/transpiler'; @@ -25,7 +25,6 @@ const editor = new StrudelMirror({ prebake: async () => { initAudioOnFirstClick(); // needed to make the browser happy (don't await this here..) const loadModules = evalScope( - controls, import('@strudel/core'), import('@strudel/mini'), import('@strudel/tonal'), diff --git a/examples/minimal-repl/main.js b/examples/minimal-repl/main.js index 68dabe52..aa3bc7cf 100644 --- a/examples/minimal-repl/main.js +++ b/examples/minimal-repl/main.js @@ -1,5 +1,5 @@ -import { controls, repl, evalScope } from '@strudel/core'; -import { getAudioContext, webaudioOutput, initAudioOnFirstClick } from '@strudel/webaudio'; +import { repl, evalScope } from '@strudel/core'; +import { getAudioContext, webaudioOutput, initAudioOnFirstClick, registerSynthSounds } from '@strudel/webaudio'; import { transpiler } from '@strudel/transpiler'; import tune from './tune.mjs'; @@ -7,14 +7,9 @@ const ctx = getAudioContext(); const input = document.getElementById('text'); input.innerHTML = tune; initAudioOnFirstClick(); +registerSynthSounds(); -evalScope( - controls, - import('@strudel/core'), - import('@strudel/mini'), - import('@strudel/webaudio'), - import('@strudel/tonal'), -); +evalScope(import('@strudel/core'), import('@strudel/mini'), import('@strudel/webaudio'), import('@strudel/tonal')); const { evaluate } = repl({ defaultOutput: webaudioOutput, diff --git a/packages/core/animate.mjs b/packages/core/animate.mjs index e9650c02..cc7e59b2 100644 --- a/packages/core/animate.mjs +++ b/packages/core/animate.mjs @@ -1,6 +1,4 @@ -import { Pattern, getDrawContext, silence, register, pure } from './index.mjs'; -import controls from './controls.mjs'; // do not import from index.mjs as it breaks for some reason.. -const { createParams } = controls; +import { Pattern, getDrawContext, silence, register, pure, createParams } from './index.mjs'; let clearColor = '#22222210'; diff --git a/packages/core/test/controls.test.mjs b/packages/core/test/controls.test.mjs index 49aa6a4f..aa66bf98 100644 --- a/packages/core/test/controls.test.mjs +++ b/packages/core/test/controls.test.mjs @@ -4,23 +4,23 @@ Copyright (C) 2023 Strudel contributors - see . */ -import controls from '../controls.mjs'; +import { s } from '../controls.mjs'; import { mini } from '../../mini/mini.mjs'; import { describe, it, expect } from 'vitest'; describe('controls', () => { it('should support controls', () => { - expect(controls.s('bd').firstCycleValues).toEqual([{ s: 'bd' }]); + expect(s('bd').firstCycleValues).toEqual([{ s: 'bd' }]); }); it('should support compound controls', () => { - expect(controls.s(mini('bd:3')).firstCycleValues).toEqual([{ s: 'bd', n: 3 }]); - expect(controls.s(mini('bd:3 sd:4:1.4')).firstCycleValues).toEqual([ + expect(s(mini('bd:3')).firstCycleValues).toEqual([{ s: 'bd', n: 3 }]); + expect(s(mini('bd:3 sd:4:1.4')).firstCycleValues).toEqual([ { s: 'bd', n: 3 }, { s: 'sd', n: 4, gain: 1.4 }, ]); }); it('should support ignore extra elements in compound controls', () => { - expect(controls.s(mini('bd:3:0.4 sd:4:0.5:3:17')).firstCycleValues).toEqual([ + expect(s(mini('bd:3:0.4 sd:4:0.5:3:17')).firstCycleValues).toEqual([ { s: 'bd', n: 3, gain: 0.4 }, { s: 'sd', n: 4, gain: 0.5 }, ]); diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index bd0aa52b..566038fd 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -51,9 +51,8 @@ import { import { steady } from '../signal.mjs'; -import controls from '../controls.mjs'; +import { n, s } from '../controls.mjs'; -const { n, s } = controls; const st = (begin, end) => new State(ts(begin, end)); const ts = (begin, end) => new TimeSpan(Fraction(begin), Fraction(end)); const hap = (whole, part, value, context = {}) => new Hap(whole, part, value, context); diff --git a/packages/core/test/value.test.mjs b/packages/core/test/value.test.mjs index 1a209623..c5472607 100644 --- a/packages/core/test/value.test.mjs +++ b/packages/core/test/value.test.mjs @@ -6,8 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th import { describe, it, expect } from 'vitest'; import { map, valued, mul } from '../value.mjs'; -import controls from '../controls.mjs'; -const { n } = controls; +import { n } from '../controls.mjs'; describe('Value', () => { it('unionWith', () => { diff --git a/packages/repl/prebake.mjs b/packages/repl/prebake.mjs index 930f263c..4315b85c 100644 --- a/packages/repl/prebake.mjs +++ b/packages/repl/prebake.mjs @@ -1,4 +1,4 @@ -import { controls, noteToMidi, valueToMidi, Pattern, evalScope } from '@strudel/core'; +import { noteToMidi, valueToMidi, Pattern, evalScope } from '@strudel/core'; import { registerSynthSounds, registerZZFXSounds, samples } from '@strudel/webaudio'; import * as core from '@strudel/core'; @@ -17,7 +17,6 @@ export async function prebake() { // import('@strudel/serial'), // import('@strudel/csound'), // import('@strudel/osc'), - controls, // sadly, this cannot be exported from core directly (yet) ); // load samples const ds = 'https://raw.githubusercontent.com/felixroos/dough-samples/main/'; diff --git a/packages/tonal/test/tonal.test.mjs b/packages/tonal/test/tonal.test.mjs index 6dfdcfac..2b829ecb 100644 --- a/packages/tonal/test/tonal.test.mjs +++ b/packages/tonal/test/tonal.test.mjs @@ -7,10 +7,9 @@ This program is free software: you can redistribute it and/or modify it under th // import { strict as assert } from 'assert'; import '../tonal.mjs'; // need to import this to add prototypes -import { pure, controls, seq } from '@strudel/core'; +import { pure, n, seq } from '@strudel/core'; import { describe, it, expect } from 'vitest'; import { mini } from '../../mini/mini.mjs'; -const { n } = controls; describe('tonal', () => { it('Should run tonal functions ', () => { diff --git a/packages/web/web.mjs b/packages/web/web.mjs index e7164197..660acf26 100644 --- a/packages/web/web.mjs +++ b/packages/web/web.mjs @@ -5,7 +5,7 @@ export * from '@strudel/transpiler'; export * from '@strudel/mini'; export * from '@strudel/tonal'; export * from '@strudel/webaudio'; -import { Pattern, evalScope, controls } from '@strudel/core'; +import { Pattern, evalScope } from '@strudel/core'; import { initAudioOnFirstClick, registerSynthSounds, webaudioScheduler } from '@strudel/webaudio'; // import { registerSoundfonts } from '@strudel/soundfonts'; import { evaluate as _evaluate } from '@strudel/transpiler'; @@ -15,7 +15,6 @@ import { miniAllStrings } from '@strudel/mini'; export async function defaultPrebake() { const loadModules = evalScope( evalScope, - controls, import('@strudel/core'), import('@strudel/mini'), import('@strudel/tonal'), diff --git a/packages/webaudio/README.md b/packages/webaudio/README.md index 442dc4dd..d89a6d39 100644 --- a/packages/webaudio/README.md +++ b/packages/webaudio/README.md @@ -12,9 +12,8 @@ npm i @strudel/webaudio --save ## Example ```js -import { repl, controls } from "@strudel/core"; +import { repl, note } from "@strudel/core"; import { initAudioOnFirstClick, getAudioContext, webaudioOutput } from "@strudel/webaudio"; -const { note } = controls; initAudioOnFirstClick(); const ctx = getAudioContext(); diff --git a/test/runtime.mjs b/test/runtime.mjs index 6a40b09d..946c2759 100644 --- a/test/runtime.mjs +++ b/test/runtime.mjs @@ -7,7 +7,6 @@ import { evaluate } from '@strudel/transpiler'; import { evalScope } from '@strudel/core'; import * as strudel from '@strudel/core'; import * as webaudio from '@strudel/webaudio'; -import controls from '@strudel/core/controls.mjs'; // import gist from '@strudel/core/gist.js'; import { mini, m } from '@strudel/mini/mini.mjs'; // import * as voicingHelpers from '@strudel/tonal/voicings.mjs'; @@ -21,7 +20,6 @@ import '@strudel/xen/xen.mjs'; // import '@strudel/osc/osc.mjs'; // import '@strudel/webaudio/webaudio.mjs'; // import '@strudel/serial/serial.mjs'; -// import controls from '@strudel/core/controls.mjs'; import '../website/src/repl/piano'; class MockedNode { @@ -153,10 +151,9 @@ evalScope( strudel, toneHelpersMocked, uiHelpersMocked, - controls, webaudio, tonalHelpers, - /* controls, + /* toneHelpers, voicingHelpers, drawHelpers, diff --git a/website/src/repl/util.mjs b/website/src/repl/util.mjs index 08e31d42..397e2801 100644 --- a/website/src/repl/util.mjs +++ b/website/src/repl/util.mjs @@ -1,4 +1,4 @@ -import { controls, evalScope, hash2code, logger } from '@strudel/core'; +import { evalScope, hash2code, logger } from '@strudel/core'; import { settingPatterns, defaultAudioDeviceName } from '../settings.mjs'; import { getAudioContext, initializeAudioOutput, setDefaultAudioContext } from '@strudel/webaudio'; @@ -92,11 +92,7 @@ export function loadModules() { modules = modules.concat([import('@strudel/midi'), import('@strudel/osc')]); } - return evalScope( - controls, // sadly, this cannot be exported from core direclty - settingPatterns, - ...modules, - ); + return evalScope(settingPatterns, ...modules); } let lastShared;