Compare commits

...

1394 Commits

Author SHA1 Message Date
Felix Roos 90a58858ca Publish
- @strudel/codemirror@0.8.4
 - @strudel.cycles/core@0.8.2
 - @strudel.cycles/csound@0.8.0
 - @strudel.cycles/eval@0.8.0
 - @strudel.cycles/midi@0.8.0
 - @strudel.cycles/mini@0.8.2
 - @strudel.cycles/osc@0.8.0
 - @strudel.cycles/react@0.8.0
 - @strudel.cycles/serial@0.8.0
 - @strudel.cycles/soundfonts@0.8.2
 - @strudel.cycles/tonal@0.8.2
 - @strudel.cycles/tone@0.8.0
 - @strudel.cycles/transpiler@0.8.2
 - @strudel/web@0.8.3
 - @strudel.cycles/webaudio@0.8.2
 - @strudel.cycles/webdirt@0.8.0
 - @strudel.cycles/xen@0.8.0
2023-06-30 08:17:19 +02:00
Felix Roos 8149b85a55 Merge pull request #627 from tidalcycles/fix-clock-drift
fix: midi clock drift
2023-06-30 08:14:40 +02:00
Felix Roos e79b6c514a Merge pull request #621 from tidalcycles/tauri-fs
desktop: play samples from disk
2023-06-29 22:02:27 +02:00
Felix Roos aaa894d74b Merge pull request #620 from tidalcycles/loopAt
cps dependent functions
2023-06-29 21:59:42 +02:00
Felix Roos b55721f16f fix: midi clock drift 2023-06-29 21:58:15 +02:00
Felix Roos b39d948d71 fix: build 2023-06-29 12:32:59 +02:00
Felix Roos 0fee279e3d rename fay to fit 2023-06-29 12:05:31 +02:00
Felix Roos c7d8a9cb82 fix: playFile import 2023-06-29 12:05:09 +02:00
Felix Roos b50075f102 feat: can now load disk samples via samples
+ encapsulate file logic from FilesTab
2023-06-29 10:47:20 +02:00
Felix Roos fb3ca9f960 feat: register fn for sample prefix handling 2023-06-29 10:46:32 +02:00
Felix Roos 058b971870 can now play samples from file system
- ui still wip
2023-06-29 02:02:00 +02:00
Felix Roos 610ea414c1 expose tauri fs api 2023-06-29 02:01:22 +02:00
Felix Roos cc6997baec - encapsulate sample map handling
- add resolveUrl param
2023-06-29 02:00:59 +02:00
Felix Roos d126c28b85 fix: loopAt with cps 1 for fallback 2023-06-28 22:25:49 +02:00
Felix Roos c1649b9dc0 - fix: loopAt for non default cps value
- add fay to repitch samples to fit hap duration
- add setcpm function
2023-06-28 22:13:05 +02:00
Felix Roos b0a8d12112 Merge pull request #520 from paikwiki/patch-1
Fix typo on packages.mdx
2023-06-26 22:45:04 +02:00
Felix Roos b5160d38cb another dummy commit 2023-06-26 22:43:14 +02:00
Felix Roos 360e9b5936 dummy commit 2023-06-26 22:41:47 +02:00
Felix Roos 85a6cd828e Merge pull request #606 from tidalcycles/setting-patterning
patterning ui settings
2023-06-26 22:35:02 +02:00
Felix Roos e698f19a64 Merge pull request #614 from tidalcycles/spirals
add spiral viz
2023-06-26 22:32:46 +02:00
Felix Roos 83c1b580dd Merge pull request #613 from vasilymilovidov/tauri
tauri test
2023-06-26 22:17:46 +02:00
vvm 9273e1f8ed fix tauri icons 2023-06-26 13:13:22 +04:00
vvm 5287825279 tauri workflow fixes 2023-06-26 11:27:21 +04:00
vvm 5567959afd add tauri github workflow 2023-06-26 01:58:16 +04:00
Felix Roos eaab36b051 add spiral viz 2023-06-25 14:23:18 +02:00
vvm 9a4f3af580 add README 2023-06-24 02:34:02 +04:00
vvm b83664dfce add build optimizations 2023-06-24 02:32:57 +04:00
vvm 349f7ae965 init 2023-06-23 21:14:55 +04:00
vvm 6f41716ab5 init 2023-06-23 21:06:10 +04:00
Felix Roos abeb62dea8 Merge pull request #612 from tidalcycles/fix-links
fix: doc links
2023-06-23 09:59:43 +02:00
Felix Roos 7cfed80443 Merge pull request #598 from tidalcycles/clip-support-floats
clip now works like legato in tidal
2023-06-23 09:55:18 +02:00
Felix Roos 36aa7d9b25 Merge pull request #607 from tidalcycles/doc-fixes
tonal fixes
2023-06-18 10:36:17 +02:00
Felix Roos 2a449ad3c0 rename tonal api -> tonal functions 2023-06-18 10:32:51 +02:00
Felix Roos a71c5957cc fix: better fix 2023-06-16 14:23:39 +02:00
Felix Roos eef6c7d55e quick fix: typo 2023-06-16 14:20:49 +02:00
Felix Roos 3872322da1 allow patterning theme + font settings 2023-06-16 13:45:13 +02:00
Felix Roos f1e850a62a fix: doc links 2023-06-16 09:20:29 +02:00
Felix Roos 8d9278419d fix: flatten scale lists 2023-06-15 20:19:31 +02:00
Felix Roos 0862827a51 Merge pull request #581 from roipoussiere/line_wrap
editor: enable line wrapping
2023-06-15 12:51:40 +02:00
Roipoussiere f37a220a05 add checkbox in settings to enable line wrapping 2023-06-15 11:52:29 +02:00
Felix Roos aa51c2b6dd Merge remote-tracking branch 'upstream/main' into line_wrap 2023-06-15 10:59:52 +02:00
Felix Roos 92da70a7ae Merge remote-tracking branch 'origin/main' into clip-support-floats 2023-06-15 10:46:10 +02:00
Felix Roos a55862fc25 Merge pull request #602 from tidalcycles/ratio-function
add ratio function
2023-06-15 10:22:46 +02:00
Felix Roos 09b14a5702 add ratio function 2023-06-14 23:19:04 +02:00
Felix Roos 260b831815 refactor: legato -> clip 2023-06-14 00:22:55 +02:00
Felix Roos 665cf6ac65 Merge pull request #588 from roipoussiere/enable_autocomplete
enable auto-completion
2023-06-12 23:24:28 +02:00
Felix Roos 5e90021698 update snapshot 2023-06-12 23:12:40 +02:00
Felix Roos 16aeb7e12c docs: update clip entry 2023-06-12 23:11:07 +02:00
Felix Roos b4cbec173b only accept undefined for clip 2023-06-12 22:58:25 +02:00
Felix Roos 8c9e06c329 - clip now works like legato in tidal
- supports floats
- hap.duration now respects clip value
- hap.endClipped is now end*clip
- visualizations show clipped length
- clip(0) will now be silence
2023-06-12 22:39:32 +02:00
Felix Roos e4a35fdd72 Merge pull request #597 from tidalcycles/cursor-fix
improve cursor
2023-06-11 22:04:17 +02:00
Felix Roos 370d82e66c + disable cursor blink
+ make cursor thicker
2023-06-11 20:21:11 +02:00
Felix Roos 876e851517 Merge pull request #570 from dariacotocu/branch-daria
Solmization added
2023-06-11 20:00:45 +02:00
Felix Roos 190fe37a9f move solmization logic from midi2note to sol2note 2023-06-11 19:55:24 +02:00
Felix Roos 623661f8d2 Merge remote-tracking branch 'upstream/main' into branch-daria 2023-06-11 19:54:55 +02:00
Felix Roos f31bc3f8c5 Merge pull request #591 from tidalcycles/fix-fast0
fix: division by zero
2023-06-11 19:45:00 +02:00
Felix Roos 12fc48544c Merge pull request #596 from tidalcycles/fix-option-dot
Fix option dot
2023-06-11 19:44:40 +02:00
Felix Roos 3b4e44a9fd fix: main repl option-dot on mac 2023-06-11 13:55:11 +02:00
Felix Roos 7850fb727e fix: allow f for flat notes like tidal 2023-06-11 13:23:45 +02:00
Felix Roos 9b3122837e fix: division by zero 2023-06-11 13:15:52 +02:00
Felix Roos d4c59cc73b fix:typo + remove notes 2023-06-11 11:21:19 +02:00
Felix Roos fe36bf54b2 Merge commit '4d8308a763a632cc4dd93ed2a2ab129eb957af72' 2023-06-09 21:39:14 +02:00
Felix Roos 4d8308a763 fix: link goes to wrong language 2023-06-09 21:33:32 +02:00
Felix Roos 11f26c1e2c Merge pull request #587 from tidalcycles/workshop-new
New Workshop
2023-06-09 21:02:11 +02:00
Felix Roos e10104d401 bring de improvements to en workshop 2023-06-09 20:59:40 +02:00
Roipoussiere 5e09c3c318 add autocompletion extension from useMemo 2023-06-09 18:28:16 +02:00
Felix Roos 576b88221d Merge remote-tracking branch 'origin/main' into workshop-new 2023-06-09 18:00:16 +02:00
Felix Roos 7dc2a0091b more detail 2023-06-09 17:59:08 +02:00
Felix Roos 89a4a85589 more friendly heading 2023-06-09 17:58:05 +02:00
Felix Roos a3baf07a5c Merge pull request #580 from roipoussiere/music_metadata
Music metadata
2023-06-09 17:31:58 +02:00
Roipoussiere 8e6909478c autocompletion: lint 2023-06-09 16:42:31 +02:00
Roipoussiere 2d2d0cabb3 Add option in settings to enable autocompletion 2023-06-09 16:38:48 +02:00
Roipoussiere 6f04a1b8fa autocomplete: add vanilla js completion 2023-06-09 14:52:07 +02:00
Roipoussiere a9ad3a56ad autocomplete: avoid tabs overlapping 2023-06-09 14:30:20 +02:00
Roipoussiere 3069b14e9c enable autocompletion 2023-06-09 13:41:40 +02:00
Felix Roos ae868c6372 hide gutter in mini repl 2023-06-09 00:46:04 +02:00
Felix Roos c287ff554c optimize sounds chapter after teach test 2023-06-09 00:26:40 +02:00
Felix Roos 3ccbd35fad add label support to pianoroll 2023-06-09 00:25:54 +02:00
Felix Roos 51cc69208f fix: repl link to docs was old 2023-06-09 00:25:14 +02:00
Felix Roos 1fec2f7a46 fix: build 2023-06-08 21:31:32 +02:00
Felix Roos ffffdd2d7d fix: format 2023-06-08 20:55:26 +02:00
Felix Roos f8c3e3d5aa add missing sounds by hand 2023-06-08 20:43:45 +02:00
Felix Roos eccce6fa84 remove dirt samples
+ load a small selection for workshop instead
2023-06-08 17:48:54 +02:00
Felix Roos 44be6cee2c Merge pull request #585 from srenatus/typo
learn/tonal: fix typo in "scaleTran[s]pose"
2023-06-08 09:33:34 +02:00
Stephan Renatus 799afd511a learn/tonal: fix typo in "scaleTran[s]pose" 2023-06-08 08:17:38 +02:00
Felix Roos 37c4541468 translate link 2023-06-07 21:50:26 +02:00
Felix Roos 119a66acd0 - translate getting-started
- fix de links
- link english docs / german workshop
2023-06-07 21:49:57 +02:00
Felix Roos 105193a452 replace tutorial with workshop
+ move parts of tutorial to more
+ move more before Pattern Functions
2023-06-07 21:22:01 +02:00
Felix Roos 02d793e9e0 Merge remote-tracking branch 'origin/main' into workshop-new 2023-06-07 20:19:34 +02:00
Felix Roos 90647a8ba8 Merge pull request #582 from roipoussiere/line_numbers
repl: add option to display line numbers
2023-06-07 20:19:11 +02:00
Felix Roos 06950a6bd8 translate rest of workshop to german 2023-06-07 16:50:54 +02:00
Roipoussiere 0c2147d9c5 repl: add option to display line numbers 2023-06-07 15:34:57 +02:00
Roipoussiere 51e8174689 metadata: add quotes syntax for titles 2023-06-07 12:26:23 +02:00
Roipoussiere 185318a70c metadata: fix typos 2023-06-07 11:02:38 +02:00
Felix Roos a88759ba94 translate notes chapter 2023-06-06 22:43:51 +02:00
Roipoussiere 96ac054392 metadata: improve doc 2023-06-06 21:34:53 +02:00
Roipoussiere bd7f4dd73f metadata: add tests 2023-06-06 21:34:53 +02:00
Roipoussiere 2e22152089 metadata: allow several values and one-liners 2023-06-06 21:34:53 +02:00
Roipoussiere 98a89aea11 lint: metadata parsing 2023-06-06 21:34:53 +02:00
Roipoussiere 372e33c066 doc: add section about metadata 2023-06-06 21:34:53 +02:00
Roipoussiere 52641db590 load titles from metadata in examples page 2023-06-06 21:34:53 +02:00
Roipoussiere f9ad5f0d01 add tunes metadata 2023-06-06 21:34:53 +02:00
Roipoussiere 3db1c7a521 swatch: look for song titles in code metadata 2023-06-06 21:34:53 +02:00
Roipoussiere b6d1f96930 editor: enable line wrapping 2023-06-06 13:29:55 +02:00
Felix Roos 61a9b01062 started german translation of workshop 2023-06-05 23:48:04 +02:00
Felix Roos f0faf5b42e Merge remote-tracking branch 'origin/main' into workshop-new 2023-06-05 22:48:50 +02:00
Felix Roos 11733d5e05 Merge pull request #563 from tidalcycles/vanilla-highlighting
Vanilla JS Refactoring
2023-06-05 21:35:49 +02:00
Felix Roos c4a38d9008 + pattern effects chapter
+ recap page
+ only load mini repls when visible
2023-05-30 06:16:02 +02:00
Felix Roos 0edd7e14b7 add compound adsr + ds controls 2023-05-29 12:39:36 +02:00
Felix Roos 8b7bb7b6ae add adsr section to effects chapter 2023-05-29 12:39:17 +02:00
Felix Roos 39d5955e58 add function recap to sounds chapter 2023-05-29 12:39:05 +02:00
Felix Roos 536327f403 effects chapter mostly finished 2023-05-29 02:18:36 +02:00
Felix Roos 8679dc63be pianoroll: also reflect gain in transparency 2023-05-29 02:18:27 +02:00
Felix Roos 1e9979ae18 start fleshing out effects chapter 2023-05-28 12:42:24 +02:00
Felix Roos d2dffe3186 MiniRepl: consume font settings 2023-05-28 12:42:15 +02:00
Felix Roos 9971867e2f clamp function 2023-05-28 12:41:53 +02:00
Felix Roos 8c93e578a0 clamp delayfeedback 2023-05-28 12:41:46 +02:00
Felix Roos 1ba5d2e1ca finish notes chapter 2023-05-27 21:52:44 +02:00
Felix Roos ed792fc0d4 continue notes chapter 2023-05-27 16:29:05 +02:00
Felix Roos 4e575c44b3 begin first notes page 2023-05-27 13:31:18 +02:00
Felix Roos fc06181217 - add claviature flag to minirepl
- bring back option+dot on macos
- consume more editor settings in minirepl
2023-05-27 13:30:57 +02:00
Felix Roos 0d6fcf78d8 hide mini repl headers + improve workshop 2023-05-26 16:05:53 +02:00
Felix Roos 82225f0b81 started workshop pages 2023-05-26 14:12:53 +02:00
Felix Roos 2177e13b49 Merge branch 'vanilla-highlighting' into workshop 2023-05-25 21:38:34 +02:00
Daria Cotocu b63f4eb503 Update solmization.test.js 2023-05-24 18:58:11 +01:00
Daria Cotocu cd7bc09f9c Update solmization.test.js 2023-05-24 18:43:24 +01:00
Daria Cotocu ccf775e976 Format code 2023-05-24 17:57:05 +01:00
Daria Cotocu 811346e83d Solmization added 2023-05-24 17:24:34 +01:00
Felix Roos d3240a75d0 fix: dupe style.css to Repl.css
for some reason they were missing after update
+ darken line backgrounds
+ change preview port to keep workbox out of dev server
2023-05-12 11:56:50 +02:00
Felix Roos d93e396ce5 fix: nano-repl 2023-05-12 10:21:05 +02:00
Felix Roos d74cc234c4 fix: thinner outline for highlights with .color 2023-05-12 10:06:55 +02:00
Felix Roos 0fda83d8de bump soundfonts 2023-05-12 10:00:55 +02:00
Felix Roos a1ec8545fb format 2023-05-10 13:03:06 +02:00
Felix Roos 087f574355 update web readme + add more html examples 2023-05-10 12:49:45 +02:00
Felix Roos 1de784b817 add headless-serverless-buildless example 2023-05-10 12:20:27 +02:00
Felix Roos db79c05d9a bump web pkg dependencies 2023-05-10 12:11:51 +02:00
Felix Roos 1fdb1f0da6 bump webaudio package 2023-05-10 12:09:20 +02:00
Felix Roos e2bfaa6233 remove soundfonts from web package for now 2023-05-10 12:06:16 +02:00
Felix Roos 6089849d35 rename init to initStrudel + add to window 2023-05-10 11:53:26 +02:00
Felix Roos 6e02bf59e9 Revert "refactor: remove old draw logic"
This reverts commit 95719654f3.
2023-05-10 11:44:55 +02:00
Felix Roos 12228c56d9 improve api for web package 2023-05-07 22:36:26 +02:00
Felix Roos 3b631cb6af add @strudel/web umbrella package + example 2023-05-07 11:56:35 +02:00
Felix Roos b27a58df7e bump more packages to 0.8.0 2023-05-05 23:58:47 +02:00
Felix Roos 308f139193 bump codemirror again to get new core version 2023-05-05 23:52:55 +02:00
Felix Roos 692fc4e11d revert rename core package 2023-05-05 23:52:04 +02:00
Felix Roos b52f65c4d7 rename core package + bump to 0.8.0 2023-05-05 23:50:06 +02:00
Felix Roos 299275e368 lockfile 2023-05-05 23:47:15 +02:00
Felix Roos bb71c519db bump codemirror package 2023-05-05 23:46:42 +02:00
Felix Roos 9ec7109dc8 + simplify vanilla setup drastically
+ move repl + drawer boilerplate inside StrudelMirror
2023-05-05 23:43:07 +02:00
Felix Roos 5b67fccb1b vanilla-repl-cm6: draw first frame 2023-05-05 16:17:22 +02:00
Felix Roos 9807c4b7a1 move Framer + Drawer to core
... from vite-vanilla-repl-cm6
2023-05-05 16:06:11 +02:00
Felix Roos 9039600f6d bump codemirror to 0.8.1 2023-05-05 15:31:19 +02:00
Felix Roos b5b0156e08 fix: codemirror reeval 2023-05-05 15:31:04 +02:00
Felix Roos 352e647d37 add build script for codemirror package 2023-05-05 15:15:45 +02:00
Felix Roos e6b66f2525 lockfile 2023-05-05 15:14:46 +02:00
Felix Roos f5075906e2 add codemirror package
+ use it in vite-vanilla-repl-cm6
2023-05-05 15:13:17 +02:00
Felix Roos a6f57bced8 prettier 2023-05-05 12:00:13 +02:00
Felix Roos d35bf9591c vanilla-repl-cm6: better theme 2023-05-05 11:54:09 +02:00
Felix Roos d96f3f9dd4 vanilla-repl-cm6: style + codesplitting 2023-05-05 11:09:44 +02:00
Felix Roos 1f4c2f8c5a draw scheduler in vanilla js 2023-05-05 10:52:21 +02:00
Felix Roos 95719654f3 refactor: remove old draw logic
+ pianoroll now uses .onPaint
2023-05-05 09:52:07 +02:00
Felix Roos 4b921c47f5 vanilla-repl-cm6: add flash effect 2023-05-05 09:11:40 +02:00
Felix Roos f069f53fae vanilla-repl-cm6: add keybindings 2023-05-05 09:06:27 +02:00
Felix Roos 1494cc38fc add vite-vanilla-repl-cm6 2023-05-05 08:55:43 +02:00
Felix Roos a035412956 Merge pull request #559 from tidalcycles/patchday
Patchday
2023-05-05 08:34:36 +02:00
Felix Roos 08662ea831 Merge pull request #557 from tidalcycles/some-voicings
add basic triads and guidetone voicings
2023-05-02 21:48:32 +02:00
Felix Roos d97103268b add basic triads and guidetone voicings 2023-05-02 21:40:20 +02:00
Felix Roos a959e2e34d update remaining packages 2023-04-30 08:30:29 +02:00
Felix Roos 602bfbdd79 update a bunch of minor versions 2023-04-30 08:20:51 +02:00
Felix Roos 0785bdd37a update lerna 2023-04-30 08:04:56 +02:00
Felix Roos 8b62b6e1b1 update codemirror + tailwindcss 2023-04-30 08:02:06 +02:00
Felix Roos d1c8ebd15b remove c8 2023-04-30 07:55:23 +02:00
Felix Roos 13088e4001 - remove gh-pages
- update peggy
- rebuild parser
2023-04-30 07:48:08 +02:00
Felix Roos 5c6fa1c82b update vite to v4 2023-04-29 08:10:12 +02:00
Felix Roos fd81867e7b fix: controls import broke on ssr 2023-04-29 07:45:21 +02:00
Felix Roos 78293e64dd lockfile 2023-04-29 07:45:09 +02:00
Felix Roos 930fc10aec bump some minor versions 2023-04-29 07:45:04 +02:00
Felix Roos 0b2a4fda44 update supabase-js 2023-04-29 07:24:03 +02:00
Felix Roos efdce6d4cd update astro 2023-04-29 06:55:34 +02:00
Felix Roos c0b0ea4493 remove preact 2023-04-29 06:25:19 +02:00
Felix Roos 0fcec0a0ca upgrade jsdoc 2023-04-28 13:05:50 +02:00
Felix Roos c0701d8a35 Merge remote-tracking branch 'origin/main' into patchday 2023-04-28 12:50:20 +02:00
Felix Roos ae51092044 Merge pull request #556 from tidalcycles/fix-prebake
fix: make soundfonts import dynamic
2023-04-28 12:46:56 +02:00
Felix Roos b7fcccb8db fix: make soundfonts import dynamic
- it broke the whole docs page
2023-04-28 12:42:07 +02:00
Felix Roos b21a52f5f3 update @vite-pwa/astro 2023-04-28 12:23:10 +02:00
Felix Roos 2bdcfe13e6 update @vitest/ui 2023-04-28 12:20:35 +02:00
Felix Roos 12a97ec429 update nanostores 2023-04-28 12:18:45 +02:00
Felix Roos 99298ce9f2 update vite-plugin-pwa 2023-04-28 12:14:07 +02:00
Felix Roos a0ed25d373 use vitests@^0.28.0 in packages 2023-04-28 12:12:05 +02:00
Felix Roos dc6c29c668 update vitest to ^0.28.0 2023-04-28 12:08:48 +02:00
Felix Roos 3a85f28b5c install with pnpm 8.3.1 2023-04-28 10:33:47 +02:00
Felix Roos 95c44b1ce2 Merge pull request #553 from tidalcycles/highlighting-colors
fix: colorable highlighting
2023-04-22 15:43:22 +02:00
Felix Roos b88e0ecb78 fix: colorable highlighting 2023-04-22 15:25:00 +02:00
Felix Roos c26f6b72d9 Merge pull request #550 from tidalcycles/fix-soundfont-loading
fix: load soundfonts in prebake
2023-04-06 00:11:02 +02:00
Felix Roos 6cd3cc96a3 fix: do not prebake in tests
+ pull piano function to separate file for tests
2023-04-06 00:08:23 +02:00
Felix Roos c138cf0b76 fix: load soundfonts in prebake 2023-04-06 00:00:49 +02:00
Felix Roos 8edb086178 Merge pull request #548 from tidalcycles/stop-pause
fix: reset time on stop
2023-03-29 22:23:07 +02:00
Felix Roos 0f74b5a4b1 Merge pull request #547 from tidalcycles/fix-mini-whitespace
fix: allow whitespace at the end of a mini pattern
2023-03-29 22:16:37 +02:00
Felix Roos 6de2feff05 fix: reset time on stop 2023-03-29 22:05:13 +02:00
Felix Roos a9811ee955 fix: allow whitespace at the end of a mini pattern
- fixes #546
2023-03-29 21:57:55 +02:00
Felix Roos 98b6c11a82 Merge pull request #544 from tidalcycles/fonts
add firacode font
2023-03-24 22:10:55 +01:00
Felix Roos 3df2929d12 dummy commit (github cert error :-/) 2023-03-24 22:06:40 +01:00
Felix Roos 30d1f423cb fix: remove loading state on eval error 2023-03-24 21:50:50 +01:00
Felix Roos e0c5566f35 add 2 FiraCode fonts 2023-03-24 21:23:37 +01:00
Felix Roos c5a2ae47d7 Merge pull request #542 from tidalcycles/loading-animation
feat: add loader bar to animate loading state
2023-03-24 12:54:20 +01:00
Felix Roos 17654b885b feat: add loader bar to animate loading state 2023-03-24 12:41:00 +01:00
Felix Roos acaf0ca0af Merge pull request #539 from tidalcycles/setcps-reset-only-on-shuffle
do not reset cps before eval #517
2023-03-23 22:39:26 +01:00
Felix Roos 6a201be1fd Merge remote-tracking branch 'origin/main' into setcps-reset-only-on-shuffle 2023-03-23 22:35:57 +01:00
Felix Roos 8617b9164e do not reset cps before eval #517 2023-03-23 22:34:25 +01:00
Felix Roos 991e5f1b3c Merge pull request #538 from tidalcycles/improve-loading
improve initial loading + wait before eval
2023-03-23 22:27:31 +01:00
Felix Roos 55c533c947 improve initial loading + wait before eval 2023-03-23 21:56:20 +01:00
Felix Roos d17543d5d9 Merge pull request #537 from tidalcycles/fix-keypress-period
fix period key for dvorak + remove duplicated code
2023-03-23 21:40:19 +01:00
Felix Roos 73169563c4 fix period key for dvorak + remove duplicated code 2023-03-23 21:37:38 +01:00
Felix Roos d351cb9f7f Merge pull request #535 from tidalcycles/update-lerna
Update lerna
2023-03-23 11:44:56 +01:00
Felix Roos 251be60630 update package publishing guide 2023-03-23 11:39:33 +01:00
Felix Roos 18d7222804 Publish
- @strudel.cycles/core@0.7.2
 - @strudel.cycles/csound@0.7.1
 - @strudel.cycles/eval@0.7.1
 - @strudel.cycles/midi@0.7.1
 - @strudel.cycles/mini@0.7.2
 - @strudel.cycles/osc@0.7.1
 - @strudel.cycles/react@0.7.1
 - @strudel.cycles/serial@0.7.1
 - @strudel.cycles/soundfonts@0.7.1
 - @strudel.cycles/tonal@0.7.1
 - @strudel.cycles/tone@0.7.1
 - @strudel.cycles/transpiler@0.7.1
 - @strudel.cycles/webaudio@0.7.1
 - @strudel.cycles/webdirt@0.7.1
 - @strudel.cycles/xen@0.7.1
2023-03-23 11:34:07 +01:00
Felix Roos ff1c37d361 bump core + mini to 0.7.1 2023-03-23 11:26:23 +01:00
Felix Roos 3abe6db3de Publish
- @strudel.cycles/core@0.7.0
 - @strudel.cycles/csound@0.7.0
 - @strudel.cycles/eval@0.7.0
 - @strudel.cycles/midi@0.7.0
 - @strudel.cycles/mini@0.7.0
 - @strudel.cycles/osc@0.7.0
 - @strudel.cycles/react@0.7.0
 - @strudel.cycles/serial@0.7.0
 - @strudel.cycles/soundfonts@0.7.0
 - @strudel.cycles/tonal@0.7.0
 - @strudel.cycles/tone@0.7.0
 - @strudel.cycles/transpiler@0.7.0
 - @strudel.cycles/webaudio@0.7.0
 - @strudel.cycles/webdirt@0.7.0
 - @strudel.cycles/xen@0.7.0
2023-03-23 11:21:02 +01:00
Felix Roos b9ca9d3b06 update lerna 2023-03-23 11:17:21 +01:00
Felix Roos 9bbc04843d Merge pull request #534 from tidalcycles/soundfont-freq-support
feat: add freq support to gm soundfonts
2023-03-23 10:21:55 +01:00
Felix Roos ddf61a6438 Merge pull request #531 from ijc8/main
Maintain random seed state in parser, not globally
2023-03-23 10:18:58 +01:00
Felix Roos ba35a81e9b - feat: add freq support to gm soundfonts
- refactor: toMidi -> noteToMidi
- refactor: fromMidi -> midiToFreq
2023-03-23 10:18:24 +01:00
Felix Roos 13133583ca Merge pull request #527 from bwagner/main
FIXES: alias pm for polymeter
2023-03-21 22:35:17 +01:00
Felix Roos e91b981740 Merge pull request #529 from revolunet/patch-1
fix(footer): fix link to tidalcycles
2023-03-21 22:29:06 +01:00
Bernhard Wagner 1458ee64ec FIXES: alias pm for polymeter 2023-03-21 21:20:57 +01:00
Ian Clester 4e2a5e1663 Add pairwise independence test, tweak randOffset 2023-03-20 22:27:35 -04:00
Ian Clester c98b0e9687 Format code with prettier 2023-03-20 19:19:42 -04:00
Ian Clester 4e25990de9 Uncomment test for random choice operator (|) 2023-03-20 17:46:57 -04:00
Ian Clester 4b51f1a3fc Sync up ? with degrade() 2023-03-20 15:26:27 -04:00
Ian Clester 5490b01004 Maintain random seed state in parser, not globally 2023-03-20 14:59:43 -04:00
Julien Bouquillon 43176e1f1d fix(footer): fix link to tidalcycles 2023-03-20 01:38:21 +01:00
Bernhard Wagner fffd3c07ca FIXES: alias pm for polymeter
(return statement was missing)
2023-03-18 22:12:12 +01:00
Felix Roos 952bd38e70 Merge pull request #525 from bwagner/patch-4
Update intro.mdx
2023-03-18 20:25:21 +01:00
Felix Roos 8589f5cc89 Merge pull request #524 from bwagner/patch-3
Update samples.mdx
2023-03-18 20:24:38 +01:00
Bernhard Wagner ec594d52f8 Update intro.mdx
shortly -> concisely
2023-03-18 19:31:57 +01:00
Bernhard Wagner 848cbf9c60 Update samples.mdx
fixes few typos and the former `samples` tab is now `sounds`
2023-03-18 15:37:59 +01:00
Felix Roos e02be7dd9a Merge pull request #521 from tidalcycles/fix-envelope
fix: envelopes in chrome
2023-03-17 09:03:10 +01:00
Felix Roos 33d35e47a6 fix: envelope in chrome 2023-03-17 08:56:05 +01:00
Felix Roos 18d62b32c2 Merge pull request #516 from tidalcycles/source-nodes
registerSound API + improved sounds tab + regroup soundfonts
2023-03-16 16:13:30 +01:00
Felix Roos 58ed51b49c snapshot 2023-03-16 15:49:56 +01:00
Felix Roos 9f9fe529e4 fix only tune that uses soundfonts 2023-03-16 15:49:08 +01:00
Felix Roos aad721890a pass duration to source callback 2023-03-16 15:48:59 +01:00
Felix Roos e63a5d10c8 regroup sounds
- extra tab for drum-machines
- combine synths and soundfonts
2023-03-16 15:21:16 +01:00
Felix Roos 15681262de use only _ for easier copying via double click 2023-03-16 15:19:38 +01:00
Felix Roos b5d3aa81f9 format 2023-03-16 12:25:08 +01:00
Felix Roos a688061616 group soundfonts into readable names 2023-03-16 12:23:58 +01:00
Felix Roos f788d347ec add envelope to soundfonts 2023-03-15 23:02:05 +01:00
Felix Roos a33ce67dd4 fix: endless preview 2023-03-15 23:01:56 +01:00
Felix Roos 8a22c5627a fix: cut glitches due to envelope release trouble 2023-03-15 22:42:03 +01:00
Felix Roos 7b529a30f4 style sounds tab 2023-03-14 22:54:12 +01:00
Felix Roos 4910b34f26 Merge pull request #518 from tidalcycles/fonts
add 2 illegible fonts
2023-03-14 21:54:52 +01:00
paikwiki 74ad521fc9 Fix typo on packages.mdx
I found a broken link.

Because it omits protocol, page move to wrong page(https://strudel.tidalcycles.org/github.com/tidalcycles/strudel)

I add protocol(https://) on that link.
2023-03-14 13:01:40 +09:00
Felix Roos 6a73b43e3a add 2 illegible fonts 2023-03-12 21:16:46 +01:00
Felix Roos b59b26460d soundfont list curation part 2 2023-03-12 20:48:29 +01:00
Felix Roos aa324ae25d start curating the soundfont list 2023-03-10 11:33:55 +01:00
Felix Roos ff412f6396 level down soundfonts
+ do not load in prebake (breaks static rendering)
+ instead load on import
2023-03-09 23:19:19 +01:00
Felix Roos ac148b2f32 register soundfonts as sounds too 2023-03-09 22:48:40 +01:00
Felix Roos 6f5d096e6d rename setSound to registerSound 2023-03-09 21:32:40 +01:00
Felix Roos ff1e6714c6 document setSound api 2023-03-09 21:27:24 +01:00
Felix Roos 41d82eaadf add cleanup to sound tab 2023-03-09 10:53:35 +01:00
Felix Roos be6b011204 proper audio node cleanup
+ cleanup onTriggerSample
2023-03-09 10:46:45 +01:00
Felix Roos 65e48c05f0 sounds onset and offset can be triggered independently
+ sounds tab now supports mousedown / mouseup to listen
2023-03-09 08:35:20 +01:00
Felix Roos cee08ea67d sounds list can now filter out defaults 2023-03-08 00:33:21 +01:00
Felix Roos 35ef26c013 can now pass meta data to setSound
+ added types for synth and sample
+ list sample count for samples in sounds tab (as before)
2023-03-07 21:43:01 +01:00
Felix Roos b08a0b8102 use nanostore for soundmap
+ rename tab samples to sounds
+ listed sounds are now reactive
2023-03-06 23:11:09 +01:00
Felix Roos 220342154b Merge pull request #474 from bwagner/main
Update README.md
2023-03-06 22:55:00 +01:00
Bernhard Wagner ef7182cd76 Merge branch 'tidalcycles:main' into main 2023-03-06 20:15:16 +01:00
Felix Roos 6059c69995 first draft of soundMap to register keys for s
+ refactor sampler to use it
+ refactor synth to use it
+ add 'source' control
+ wip: samples tab
+ wip: webadirt ?
+ wip: soundfonts
2023-03-05 23:27:37 +01:00
Felix Roos 892d8ba152 Merge pull request #508 from tidalcycles/arrange
add arrange function
2023-03-05 14:52:30 +01:00
Felix Roos da11069f75 Merge pull request #514 from tidalcycles/react-update
update react to 18
2023-03-05 14:29:08 +01:00
Alex McLean bf72908dc9 Support list syntax in mininotation (#512)
fixes #504

* support list syntax in mininotation
* support compound controls
* remove redundant : splitting of s/n and note/n from webaudio
* patternable scale names
2023-03-04 18:06:18 +00:00
Felix Roos 81ab5c78e2 update react to 18 2023-03-03 20:38:20 +01:00
Felix Roos de503c7d63 add snapshot 2023-03-03 20:30:35 +01:00
Felix Roos 487ccb90a1 add arrange function 2023-03-03 20:17:23 +01:00
Felix Roos 4bfeaa47bf Merge pull request #502 from tidalcycles/scale-space-alternative
can now use : as a replacement for space in scales
2023-03-03 12:40:23 +01:00
Felix Roos 9a4d8036a6 add test 2023-03-03 12:38:11 +01:00
Felix Roos a50bd6375d use : instead of _ 2023-03-03 12:37:25 +01:00
Felix Roos 14508e91a9 can now use _ as a replacement for space in scales 2023-03-02 20:39:06 +01:00
Alex McLean 2d5064bd5b Reinstate slice and splice (#500)
Reinstate slice/splice, fixing up "unit" param using new global cps
2023-03-02 14:44:41 +00:00
Felix Roos fdc4819e39 Merge pull request #501 from tidalcycles/nano-repl-highlighting-fix
fix: nano-repl highlighting
2023-03-02 14:49:30 +01:00
Felix Roos efddbb616b fix: nano-repl highlighting 2023-03-02 14:47:15 +01:00
Alex McLean db4d0f26a8 Add control aliases (#497)
* add and simplify control aliases, fixes #496
* roomsize now alias of room
* simplify webaudio param handling
---------

Co-authored-by: Felix Roos <flix91@gmail.com>
2023-03-02 13:17:12 +00:00
Felix Roos 06cffbc31b add readme to nano repl 2023-03-01 12:57:33 +01:00
Felix Roos 3cfb0f4c76 Merge pull request #493 from tidalcycles/cps
implement cps in scheduler
2023-03-01 09:27:26 +01:00
Felix Roos 436ba067bc reset cps before eval 2023-03-01 09:23:01 +01:00
Felix Roos f8724bf47e comment out cps ui 2023-03-01 00:05:23 +01:00
Felix Roos 1f7e293204 add setcps to global scope 2023-02-28 23:56:11 +01:00
Felix Roos 86d2652258 pass cps to hap trigger 2023-02-28 23:54:56 +01:00
Felix Roos f5c0cc2e2d no need to warn if evalScope is called more often 2023-02-28 23:54:40 +01:00
Felix Roos 4463d4a417 Update README.md 2023-02-28 23:25:40 +01:00
Felix Roos df35a5c9b1 Merge pull request #491 from tidalcycles/refactor-react
react style fixes
2023-02-28 23:06:29 +01:00
Felix Roos dda93b3c13 Update @strudel.cycles/react to 0.6.4 2023-02-28 23:02:52 +01:00
Felix Roos 5de40b6bf5 fix disabled button take 2 2023-02-28 23:02:28 +01:00
Felix Roos dcbe799d25 Merge pull request #490 from tidalcycles/refactor-react
refactor react package
2023-02-28 22:57:19 +01:00
Felix Roos a5641aef03 Update @strudel.cycles/react to 0.6.3 2023-02-28 22:52:57 +01:00
Felix Roos 668f97a4c8 refactor react package for publishing 2023-02-28 22:48:50 +01:00
Felix Roos e9d577496b fix disabled button 2023-02-28 22:48:06 +01:00
Felix Roos 66fba947ac Update @strudel.cycles/react to 0.6.2 2023-02-28 22:40:52 +01:00
Felix Roos 18c7e02609 fix: minirepl styles for package 2023-02-28 22:40:18 +01:00
Felix Roos 7e1351507a add variables to react tailwind config 2023-02-28 22:17:24 +01:00
Felix Roos 032acbd27c comment out autocomplete 2023-02-28 22:11:17 +01:00
Felix Roos 8b51f0fbd2 Update @strudel.cycles/react to 0.6.1 2023-02-28 21:57:03 +01:00
Felix Roos ead5942ef0 implement cps + add baasic tempo control ui 2023-02-28 13:00:35 +01:00
Felix Roos cfe369d9fe Merge pull request #488 from tidalcycles/algolia
add algolia creds + optimize sidebar for crawling
2023-02-27 23:47:34 +01:00
Felix Roos 2750a3c130 fix pseudo relative links 2023-02-27 22:59:50 +01:00
Felix Roos a7f6d6ecac add algolia config 2023-02-27 22:59:38 +01:00
Felix Roos 3680282450 Merge pull request #485 from tidalcycles/app-height-fix
fix app height
2023-02-27 19:28:09 +01:00
Felix Roos 3b3435c999 change 1px 2023-02-27 19:24:49 +01:00
Felix Roos e2ae6278c2 Merge pull request #484 from tidalcycles/revert-wip-390
Revert "Another attempt at composable functions - WIP (#390)"
2023-02-27 16:04:20 +01:00
Alex McLean 37d6723e3c Update mini-notation.mdx (#365)
`x!n` is no longer an alias for `[x*n]@n` and the behaviour is a bit different. Probably best to remove this line in case it confuses someone?
2023-02-27 14:45:19 +00:00
Felix Roos 961bbf6f55 Revert "Another attempt at composable functions - WIP (#390)"
This reverts commit cbae355896.
2023-02-27 15:20:49 +01:00
Felix Roos fc71d349ed Merge pull request #482 from tidalcycles/docs
docs: packages + offline
2023-02-27 12:52:09 +01:00
Felix Roos 97c8ab0f71 fix format 2023-02-27 12:49:23 +01:00
Felix Roos 28534ea547 add screenshots 2023-02-27 12:47:38 +01:00
Felix Roos 1a75b79a33 better offline docs
fixes https://github.com/tidalcycles/strudel/issues/424
2023-02-27 12:34:17 +01:00
Felix Roos 75dfb0af35 add dependencygraph 2023-02-27 11:12:21 +01:00
Felix Roos 073fa09648 packages doc 2023-02-27 11:10:47 +01:00
Felix Roos 3015e7b203 Merge pull request #480 from tidalcycles/fix-array-args
Fix array args
2023-02-25 14:26:49 +01:00
Felix Roos 7ac0cdc0f9 fix: lint error 2023-02-25 14:18:23 +01:00
Felix Roos 49234183a3 Merge remote-tracking branch 'origin/main' into fix-array-args 2023-02-25 14:13:55 +01:00
Felix Roos ed7763df92 fix: reify after sequence to preserve array
ref https://github.com/tidalcycles/strudel/issues/383#issuecomment-1399514090
2023-02-25 14:13:39 +01:00
Felix Roos b818a02f76 Merge pull request #478 from tidalcycles/midi-fleshout
midi cc support
2023-02-25 12:33:22 +01:00
Felix Roos 886f8449fd add midichan + docs 2023-02-25 12:23:01 +01:00
Felix Roos 5de6643604 midi: support ccn and ccv 2023-02-24 10:15:21 +01:00
Felix Roos 6283273d81 add helper hap.ensureObjectValue 2023-02-24 10:15:06 +01:00
Bernhard Wagner 5506d18bc5 Update README.md
npm -> pnpm
2023-02-23 18:28:11 +01:00
Felix Roos c8f8f02a46 Merge pull request #473 from tidalcycles/fix-hashes
fix: hash links
2023-02-23 00:11:04 +01:00
Felix Roos 4c5d6f1d6c fix: hash links 2023-02-23 00:04:53 +01:00
Felix Roos f349e36345 Merge pull request #467 from tidalcycles/vim-mode
settings tab with vim / emacs modes + additional themes and fonts
2023-02-22 22:54:39 +01:00
Felix Roos 1574c4ab13 Merge pull request #471 from bwagner/patch-1
Update input-output.mdx
2023-02-22 22:53:22 +01:00
Felix Roos 0dc9bc3ab6 Merge pull request #464 from bwagner/main
FIXES: freqs instead of pitches
2023-02-22 22:52:49 +01:00
Felix Roos 0006d57a4a move isZen to nanostore
+ correctly parse non strings in store
2023-02-22 22:47:33 +01:00
Felix Roos 70f7e73b9a store footer tab + latest code in nanostore 2023-02-22 22:23:54 +01:00
Felix Roos b67b049802 refactor settings to nanostores 2023-02-22 22:04:39 +01:00
Felix Roos ff99dbcd22 customizable font family 2023-02-22 20:28:22 +01:00
Felix Roos 0198697737 Merge pull request #472 from tidalcycles/osc-fix
fix: osc should not return a promise
2023-02-22 20:01:00 +01:00
Felix Roos a742a71f67 fix: osc should not return a promise 2023-02-22 19:50:37 +01:00
Felix Roos 8f6c1531fa more contrast for blackscreen theme 2023-02-22 19:45:06 +01:00
Bernhard Wagner d9f56f11cb Merge pull request #1 from tidalcycles/main
a
2023-02-22 17:15:00 +01:00
Bernhard Wagner 7ff877464f Update input-output.mdx
npm -> pnpm
2023-02-22 17:06:15 +01:00
Alex McLean 7c367eb1e8 slice and splice (#466)
Implements `slice` and `splice` from tidal, intended for beat slicing
2023-02-22 11:51:31 +00:00
Felix Roos 20848aac09 fix store import 2023-02-19 23:28:46 +01:00
Felix Roos 7716574076 use terminal font for console + samples 2023-02-19 23:28:33 +01:00
Felix Roos 89cd0c769b fix bluescreen line bg 2023-02-19 23:27:56 +01:00
Felix Roos a21b3d788f add settings reset button 2023-02-19 22:32:28 +01:00
Felix Roos 7994ba8b38 get rid of all hard coded colors 2023-02-19 22:18:32 +01:00
Felix Roos 81b4cb2f16 more themes + fonts 2023-02-19 22:18:12 +01:00
Felix Roos 14af1df6a3 define font + fix app height 2023-02-19 20:04:30 +01:00
Felix Roos ac3bd7d7db rename algoboy theme + add font 2023-02-19 20:04:19 +01:00
Felix Roos 632e8e9634 use css var for highlighting color 2023-02-19 20:03:12 +01:00
Felix Roos 1e3f09f69b add some custom themes 2023-02-19 18:53:35 +01:00
Felix Roos f3f18ffca7 fix app height for ios 2023-02-19 13:50:08 +01:00
Felix Roos ceb3aa0627 add emacs mode + fontSize slider 2023-02-19 13:49:55 +01:00
Felix Roos 014555fe5d add vim toggle to settings
+ added persistent global state store
+ refactored themes to use the new store
2023-02-19 01:51:31 +01:00
Alex McLean fdb76867a7 weave and weaveWith (#465)
Added weave and weaveWith from tidal
2023-02-18 00:00:18 +00:00
Felix Roos 57157fde9c Merge branch 'main' into docs 2023-02-17 21:53:02 +01:00
Felix Roos 4a3540cf2b encapsulate footer components 2023-02-17 21:48:45 +01:00
Felix Roos 540bd938f2 remove unused Footer
+ fix AvatarList (still unused)
2023-02-17 21:48:34 +01:00
Bernhard Wagner c6fbebd996 FIXES: freqs instead of pitches 2023-02-17 19:05:09 +01:00
Felix Roos 18d3a7e23a add vim extension (hard coded) 2023-02-17 10:41:49 +01:00
Alex McLean cbae355896 Another attempt at composable functions - WIP (#390)
Summary of changes:

- Made unary functions composable, including controls. So e.g. s("bd sd").every(3,fast(2).iter(4).n(4)) works the same as s("bd sd").every(3,x => x.fast(2).iter(4).n(4))
- Made operators/alignments composable too, so s("bd sd").every(3, set.squeeze.n(3, 4)) works
- Patterns are not treated as functions, so s("bd sd").every(3, n(5)) is an annoying runtime error. s("bd sd").every(3, set.n(5)) does work though.

Other minor changes:

- standardised alignment 'squeezeOut' as lowercase 'squeezeout'
- made firstCycleValues turn haps sorted in order of 'part'
2023-02-16 23:15:21 +00:00
Felix Roos 924e8a764a Merge pull request #461 from bwagner/main
FIXES: Warning about jsxBracketSameLine deprecation
2023-02-16 20:38:45 +01:00
Bernhard Wagner 40e629cb0e ADDS: Continuation to Testing 2023-02-16 15:24:44 +01:00
Bernhard Wagner 99ec261f79 ADDS: Continuation to Docs 2023-02-16 15:23:34 +01:00
Bernhard Wagner 9daea5bbc2 ADDS: Continuation to REPL 2023-02-16 15:22:35 +01:00
Bernhard Wagner 4704c03d48 ADDS: Continuation to Strudel vs Tidal 2023-02-16 15:21:25 +01:00
Bernhard Wagner 9dbf52bedb ADDS: Continuation to Pattern Alignment 2023-02-16 15:20:26 +01:00
Bernhard Wagner cfd04ab7fa ADDS: Continuation to Patterns 2023-02-16 15:19:14 +01:00
Bernhard Wagner 33dbf75e3b ADDS: Continuation to Offline 2023-02-16 15:18:32 +01:00
Bernhard Wagner 8ffaeeb171 ADDS: Continuation to MIDI and OSC 2023-02-16 15:16:51 +01:00
Bernhard Wagner 451828e5d4 ADDS: Continuation to Tonal Modifiers 2023-02-16 15:15:54 +01:00
Bernhard Wagner 176877f2b8 ADDS: Continuation to Accumulation Modifiers 2023-02-16 15:14:38 +01:00
Bernhard Wagner 61b0d08b5f ADDS: Continuation to Conditional Modifiers 2023-02-16 15:12:37 +01:00
Bernhard Wagner f50a6ce1ae ADDS: Continuation to Signals 2023-02-16 15:11:28 +01:00
Bernhard Wagner 8549d6ea8b ADDS: Continuation to Control Parameters 2023-02-16 15:09:37 +01:00
Bernhard Wagner 90a90a87a5 ADDS: Continuation to Time Modifiers 2023-02-16 15:08:45 +01:00
Bernhard Wagner 760bdea521 ADDS: Continuation to Pattern Constructors 2023-02-16 15:07:03 +01:00
Bernhard Wagner 0fd783e83f ADDS: Continuation to Functional JavaScript API 2023-02-16 15:03:58 +01:00
Bernhard Wagner 42caa9058b ADDS: Continuation to Synths 2023-02-16 15:00:17 +01:00
Bernhard Wagner 9ab315ac2c ADDS: Continuation to Samples 2023-02-16 14:58:02 +01:00
Bernhard Wagner a08ad07537 ADDS: Continuation to Csound 2023-02-16 14:55:01 +01:00
Bernhard Wagner c6ce763f7c FIXES: Warning about jsxBracketSameLine deprecation 2023-02-16 14:46:33 +01:00
Felix Roos 70d1eb17a7 Merge branch 'main' into vim-mode 2023-02-16 11:41:01 +01:00
Felix Roos 0393205eda Merge pull request #438 from bwagner/patch-8
Update synths.mdx
2023-02-14 22:11:02 +01:00
Bernhard Wagner 5c05a5a63e Update synths.mdx
in future -> in the future
ADDS: Continuation to Audio Effects.
2023-02-14 22:08:40 +01:00
Felix Roos b01d9f849b Merge pull request #437 from bwagner/patch-5
Update mini-notation.mdx
2023-02-14 19:54:41 +01:00
Felix Roos 0ab904275c Merge pull request #436 from bwagner/patch-4
Update code.mdx
2023-02-14 19:54:24 +01:00
Bernhard Wagner 5f82a86801 Update mini-notation.mdx
descreases -> decreases
twice a cycle -> twice per cycle
2023-02-14 19:40:03 +01:00
Bernhard Wagner 13a5d8de86 Update code.mdx
The code example says "sine", but the description says "sawtooth".
2023-02-14 19:08:47 +01:00
Felix Roos f024b71808 Update CONTRIBUTING.md
add more infos on code style, eslint and tests
2023-02-14 18:16:39 +01:00
Felix Roos cd35a17904 Merge pull request #433 from tidalcycles/fix-anchors
Fix anchors
2023-02-13 00:43:29 +01:00
Felix Roos be3f68ed06 fix comment 2023-02-13 00:42:16 +01:00
Felix Roos 64b8fd9584 fix: right sidebar anchors earlier 2023-02-13 00:41:42 +01:00
Felix Roos b001d1d0f1 update lockfile 2023-02-13 00:37:20 +01:00
Felix Roos 64ad75c79e fix: anchor links
fixes https://github.com/tidalcycles/strudel/issues/432
+ fix style regression in mini repl
2023-02-13 00:35:40 +01:00
Felix Roos 12eb361d69 remove slash before anchor link 2023-02-12 20:13:59 +01:00
Felix Roos dd51bd0a2f Merge pull request #427 from tidalcycles/docs
autocomplete preparations
2023-02-11 21:02:11 +01:00
Felix Roos 0fb478a7c8 no autocomplete until upstream merge 2023-02-11 20:55:35 +01:00
Felix Roos 9694ecf55b autocomplete dark / light 2023-02-11 13:02:04 +01:00
Felix Roos fe80478b8a Merge remote-tracking branch 'origin/main' into docs 2023-02-10 23:18:04 +01:00
Felix Roos a253c26bee Merge pull request #431 from tidalcycles/themes
Themes
2023-02-10 23:14:47 +01:00
Felix Roos a500f983f5 Merge branch 'main' into themes 2023-02-10 22:59:52 +01:00
Felix Roos 3579b6f8f3 dynamic highlight color
+ refactor hooks
2023-02-10 22:52:34 +01:00
Felix Roos 14cb954213 themed minirepl
+ add strudelTheme
+ add lineBackground with opacity
+ add some missing light flags
+ add fallback css variables for non js context
2023-02-10 21:42:27 +01:00
Felix Roos 6170eef441 format 2023-02-10 20:09:23 +01:00
Felix Roos ddb9af4d57 themify rest of layout (except minirepls) 2023-02-10 20:07:36 +01:00
Felix Roos 6db2c0bf93 only invert prose for dark themes 2023-02-10 18:34:02 +01:00
Felix Roos 46f70e6a5e persisted theme + add all settings 2023-02-10 12:54:15 +01:00
Felix Roos 0b994a1b0f switchable css variables for theming 2023-02-10 11:32:36 +01:00
Felix Roos 0326244956 update themes 2023-02-10 09:25:58 +01:00
Felix Roos ea1b2252fc remove unused descriptions
+ fix some titles
+ comment out unfinished packages page
+ start offline page
2023-02-09 21:42:48 +01:00
Felix Roos 0da25ea7cc Merge pull request #429 from tidalcycles/minirepl-keyboard-support
minirepl: add keyboard shortcuts
2023-02-09 19:22:56 +01:00
Felix Roos 3209afa4ff minirepl: add keyboard shortcuts 2023-02-09 19:20:44 +01:00
Felix Roos 33e2631e5d update snapshot 2023-02-09 18:48:34 +01:00
Felix Roos f02a41b675 fix param description 2023-02-09 18:44:41 +01:00
Felix Roos f497d7b212 reactify autocomplete info 2023-02-09 18:37:29 +01:00
Felix Roos 0f18f5eb81 remove logs 2023-02-09 14:16:37 +01:00
Felix Roos 8da81104aa doc: note 2023-02-09 12:42:37 +01:00
Felix Roos 97cbdc6b0f use jsdoc in autocomplete, still not context aware
+ add noAutocomplete flags
+ add superdirtOnly flags
2023-02-09 12:19:38 +01:00
Felix Roos 7f53f4e36b Merge branch 'main' into docs 2023-02-09 08:57:20 +01:00
Felix Roos c350f262e6 Merge pull request #425 from tidalcycles/pwa
add cdn.freesound to cache list
2023-02-09 08:56:42 +01:00
Felix Roos 3e727893bf basic theme picker 2023-02-08 23:43:02 +01:00
Felix Roos 2a2c7437e4 add cdn.freesound to cache list 2023-02-08 21:18:03 +01:00
Felix Roos 4f0885d3af Merge branch 'main' into themes 2023-02-08 20:49:20 +01:00
Felix Roos 5656cd2fc6 Merge pull request #421 from tidalcycles/pwa
add more offline caching
2023-02-08 20:36:00 +01:00
Felix Roos b6e42876ad fix cache rule + disable service worker in dev 2023-02-08 20:32:03 +01:00
Felix Roos 3671344867 add freesound + shabda to offline cache rule 2023-02-08 20:26:44 +01:00
Felix Roos 30b149053c basic theme switcher 2023-02-08 18:54:34 +01:00
Felix Roos cdd40df9d3 disable sw in dev 2023-02-08 18:54:19 +01:00
Felix Roos 9d661808ba Merge pull request #419 from tidalcycles/pwa
add caching strategy for missing file types + cache all samples loaded from github
2023-02-07 22:08:01 +01:00
Felix Roos 6a5d849b3c add caching strategy for missing file types
+ cache all samples loaded from github
2023-02-07 21:50:08 +01:00
Felix Roos 25bbd73a90 Merge pull request #417 from tidalcycles/pwa
PWA with offline support
2023-02-06 23:29:56 +01:00
Felix Roos 3d27a5f8c7 format 2023-02-06 21:06:33 +01:00
Felix Roos 44ef372399 update og meta data 2023-02-06 21:05:28 +01:00
Felix Roos fd09dff381 basic pwa setup 2023-02-06 20:57:34 +01:00
Felix Roos 10580a0bec change rocket to strudel 2023-02-06 20:21:09 +01:00
Felix Roos f3f87b0a46 dont lint json 2023-02-06 20:20:45 +01:00
Felix Roos ac606bcf71 Update README.md 2023-02-05 23:16:38 +01:00
alex bb50df07e7 iclc reviews 2023-02-05 21:01:02 +00:00
Felix Roos f7ac033e1c Merge pull request #411 from tidalcycles/docs
improve samples doc
2023-02-05 17:27:32 +01:00
Felix Roos a1043352c1 Merge pull request #413 from tidalcycles/remove-google
google gtfo
2023-02-05 17:27:09 +01:00
Felix Roos e15fecf6cf google gtfo 2023-02-05 17:19:32 +01:00
Felix Roos 3e99f345ef better headings 2023-02-05 16:40:29 +01:00
Felix Roos 0a77770ef3 remove double directive 2023-02-05 16:37:00 +01:00
Felix Roos 379b8392dd add snapshot 2023-02-05 16:32:51 +01:00
Felix Roos 0fdae70461 improve samples doc 2023-02-05 16:28:43 +01:00
Felix Roos 087423c754 Merge pull request #409 from tidalcycles/docs
improve effects doc
2023-02-05 16:27:59 +01:00
Felix Roos ce64c98fb7 add adsr image link 2023-02-05 15:08:17 +01:00
Felix Roos e11a8a9dbb Merge pull request #410 from bwagner/patch-3
Update effects.mdx
2023-02-05 14:56:03 +01:00
Bernhard Wagner ef4a68a24d Update effects.mdx
Wether -> Whether
2023-02-05 14:54:27 +01:00
Felix Roos 0ec65c85d3 fix examples + snapshots 2023-02-05 14:52:01 +01:00
Felix Roos 74326f226d format 2023-02-05 14:42:08 +01:00
Felix Roos 554e0d7a39 remove envelope section from synths page 2023-02-05 14:38:47 +01:00
Felix Roos 1b99ac92dd categorize effects + add envelope doc
+ use short, more logical filter params as default
2023-02-05 14:34:59 +01:00
Felix Roos ff0b77908a Merge branch 'main' into docs 2023-02-05 14:34:16 +01:00
Felix Roos 83d19638ba Merge pull request #407 from tidalcycles/shabda-doc
add shabda doc
2023-02-03 19:54:47 +01:00
Felix Roos a7d484b1a8 add shabda doc 2023-02-03 19:53:01 +01:00
Felix Roos d87beb37b8 Merge pull request #405 from tidalcycles/fix-share-on-subpath
fix: share url on subpath
2023-02-02 21:45:56 +01:00
Felix Roos dcdb383960 fix: share url on subpath
fixes https://github.com/tidalcycles/strudel/issues/389
2023-02-02 21:43:24 +01:00
Felix Roos 478a7e95ea Merge pull request #404 from tidalcycles/csound-update
update csound + fix sound output
2023-02-02 21:35:45 +01:00
Felix Roos f7b3b582cc update csound + fix sound output
see https://github.com/csound/csound/issues/1690#issuecomment-1414301145
2023-02-02 21:31:44 +01:00
Felix Roos d1719dc277 Merge pull request #403 from tidalcycles/downgrade-csound
pin @csound/browser to 6.18.3 + bump
2023-02-02 19:53:36 +01:00
Felix Roos 9d8c812aa3 pin @csound/browser to 6.18.3 + bump 2023-02-02 19:51:16 +01:00
Felix Roos 2e390acce9 hotfix: deploy workflow install command 2023-02-01 23:04:13 +01:00
Felix Roos e04797d891 Merge pull request #400 from tidalcycles/awaitable-audio-init
release webaudio
2023-02-01 22:47:26 +01:00
Felix Roos fb6195b081 bump webaudio 2023-02-01 22:45:53 +01:00
Felix Roos c6491a3ccd Merge pull request #399 from tidalcycles/awaitable-audio-init
can now await initAudio + initAudioOnFirstClick
2023-02-01 22:45:16 +01:00
Felix Roos 014ae2107e can now await initAudio + initAudioOnFirstClick 2023-02-01 22:42:25 +01:00
Felix Roos 1457eb9d19 Merge pull request #398 from tidalcycles/fix-minirepl-styles
fix: minirepl styles
2023-02-01 22:32:18 +01:00
Felix Roos 6f5f8cc7d8 fix: minirepl styles 2023-02-01 22:30:24 +01:00
Felix Roos 9ec3fee455 Merge pull request #396 from tidalcycles/pnpm
proper builds + use pnpm workspaces
2023-02-01 22:17:18 +01:00
Felix Roos 2d52168c26 trash obsolete package-lock files 2023-02-01 20:43:16 +01:00
Felix Roos aa5dd7920f organize tasks 2023-02-01 20:38:56 +01:00
Felix Roos d60956e82a update contribution guide to pnpm
+ update root tasks
2023-02-01 20:33:13 +01:00
Alex McLean 91fd3fb5ca add missing snapshots 2023-02-01 15:51:42 +00:00
Alex McLean 46f3b662a7 add pattern methods hurry, press and pressBy (#397) 2023-02-01 15:49:55 +00:00
Felix Roos 54a61dcdae overhaul the remaining readmes 2023-02-01 16:29:18 +01:00
Felix Roos b58f5232c7 add nano-repl as workspace 2023-02-01 16:09:50 +01:00
Felix Roos 9a5bda862c update examples 2023-02-01 16:09:33 +01:00
Felix Roos 7f67adb639 bump eval 2023-02-01 15:49:05 +01:00
Felix Roos 48fd943622 fix: eval dependency + add deprecation note 2023-02-01 15:40:57 +01:00
Felix Roos 08350d00be remove sc prefix to fix build 2023-02-01 15:35:21 +01:00
Felix Roos 84bf4a2686 add pretest 2023-01-30 22:53:53 +01:00
Felix Roos 2823456e96 update lockfile 2023-01-30 22:50:44 +01:00
Felix Roos a373629fc2 fix: gh actions use pnpm 2023-01-30 22:48:24 +01:00
Felix Roos 0aa2f72a3a update core examples 2023-01-29 23:27:35 +01:00
Felix Roos c032f6dde1 add prepublishOnly everywhere 2023-01-29 00:14:07 +01:00
Felix Roos f448d8f334 rename website package 2023-01-29 00:08:29 +01:00
Felix Roos a5d4a43753 xen build 2023-01-28 23:19:33 +01:00
Felix Roos 52e01321ec webdirt build 2023-01-28 23:18:25 +01:00
Felix Roos 19692e0122 webaudio build 2023-01-28 23:14:56 +01:00
Felix Roos cd1da3cb81 transpiler build 2023-01-28 23:12:00 +01:00
Felix Roos ffaa8f4ab3 tone build 2023-01-28 23:09:25 +01:00
Felix Roos f3da9d680d bump 2023-01-28 23:07:55 +01:00
Felix Roos 6118bd24f2 tonal build 2023-01-28 23:06:59 +01:00
Felix Roos fddbb2e2ac soundfonts build 2023-01-28 23:04:30 +01:00
Felix Roos cb7156b091 serial build 2023-01-28 23:01:20 +01:00
Felix Roos b5914a3f12 react build 2023-01-28 22:58:40 +01:00
Felix Roos 348d576ff3 remove dist folder 2023-01-28 22:49:13 +01:00
Felix Roos 7507654749 osc build 2023-01-28 22:40:10 +01:00
Felix Roos c25aad0c4a midi build 2023-01-28 22:35:08 +01:00
Felix Roos 4aa32415cd eval build 2023-01-28 22:32:48 +01:00
Felix Roos cde23bbf98 csound build 2023-01-28 22:27:18 +01:00
Felix Roos 555fe0b629 bump mini 2023-01-28 22:16:33 +01:00
Felix Roos be44c28fd3 add mini build 2023-01-28 22:16:04 +01:00
Felix Roos 657091307e remove unused deps 2023-01-28 22:12:11 +01:00
Felix Roos 458dc6e07d add core build 2023-01-28 22:05:11 +01:00
Felix Roos cfaecf9fcb migrate lerna to pnpm
https://lerna.js.org/docs/recipes/using-pnpm-with-lerna
2023-01-28 22:01:35 +01:00
Felix Roos 902f722d4c add import linting + fix checks 2023-01-28 21:00:42 +01:00
Felix Roos ea2d8b2773 use workspace protocol everywhere 2023-01-28 20:37:56 +01:00
Felix Roos b319754dc3 fix website build 2023-01-28 20:31:23 +01:00
Felix Roos 35f2040717 use pnpm workspaces 2023-01-28 20:14:26 +01:00
Felix Roos 4121fc926e write more about packages / monorepo setup 2023-01-28 17:59:59 +01:00
Felix Roos fd9ab987e6 Merge branch 'main' into docs 2023-01-28 14:23:01 +01:00
Felix Roos 6c3a235b08 Merge pull request #379 from urswilke/add-tidal-drum-patterns-to-examples
Add tidal-drum-patterns to examples
2023-01-27 14:40:40 +01:00
Felix Roos 07cb861385 Merge pull request #388 from tidalcycles/ribbon
add ribbon + test + docs
2023-01-27 14:39:56 +01:00
Alex McLean 217e348fc3 Notes are not essential :) (#393)
* Notes are not essential :)

* Update notes.mdx
2023-01-27 11:10:37 +00:00
Felix Roos ad917afba4 Merge pull request #391 from tidalcycles/docs
document csound
2023-01-21 17:18:12 +01:00
Felix Roos 9539c6d317 fix: left sidebar scroll 2023-01-21 17:14:18 +01:00
Felix Roos e946e1e01e add csound docs 2023-01-21 17:05:57 +01:00
Felix Roos fea1e71a99 Merge remote-tracking branch 'origin/main' into docs 2023-01-21 15:57:54 +01:00
Felix Roos 9731eb8c5b add ribbon + test + docs 2023-01-19 12:25:12 +01:00
Felix Roos e058ae54ef Merge pull request #387 from tidalcycles/rename-a-to-angle
Rename a to angle
2023-01-19 12:04:50 +01:00
Felix Roos ba6714f384 add draw examples 2023-01-19 12:00:00 +01:00
Felix Roos 0a0a761e23 rename a to angle 2023-01-19 11:59:43 +01:00
Felix Roos 88e8368022 Merge pull request #386 from tidalcycles/run
add run + test + docs
2023-01-19 11:49:38 +01:00
Felix Roos 468ccc6288 add run + test + docs 2023-01-19 11:47:11 +01:00
Felix Roos 77e0237148 Merge pull request #385 from tidalcycles/docs-use-note-instead-of-n
docs: use note instead of n to mitigate confusion
2023-01-19 11:32:55 +01:00
Felix Roos ffdfb07f72 docs: use note instead of n to mitigate confusion 2023-01-19 11:27:54 +01:00
Felix Roos 203ed88024 Merge pull request #384 from tidalcycles/update-my-patterns-readme
update my-patterns instructions
2023-01-18 17:10:08 +01:00
Felix Roos 9923bcd16f update my-patterns instructions 2023-01-18 17:01:27 +01:00
urswilke 0179ec051f Revert "run: npm test"
This reverts commit 00709539e9bdfbc1404e984f28453f0a54b5638e.
2023-01-16 23:19:46 +01:00
urswilke 05b6353355 move drum patterns in a new file 2023-01-16 23:11:17 +01:00
urswilke 47c6ed8829 Revert "import patterns created by new method in:"
This reverts commit b266e975755e035b85c0869a30219c80a84db856.
2023-01-16 23:06:43 +01:00
urswilke ff9ebd64e3 run: npm test 2023-01-16 22:41:12 +01:00
urswilke cd2b098b81 import patterns created by new method in:
https://github.com/urswilke/read_beats/commit/ecd8c03b5e29544819831459f4b4ac48d954640f
2023-01-16 22:41:12 +01:00
Felix Roos 7000a4cead Merge pull request #377 from tidalcycles/draw-fixes
Draw fixes
2023-01-15 23:19:42 +01:00
Felix Roos 5aa983b45b do less work when not drawing 2023-01-15 23:11:49 +01:00
Felix Roos 800989419b catch all query errors by default 2023-01-15 22:50:56 +01:00
Felix Roos 362679954a Merge pull request #372 from tidalcycles/local-draw
improve new draw logic
2023-01-14 11:07:07 +01:00
Felix Roos 2732d64beb fix: another dependency array 2023-01-14 10:58:30 +01:00
Felix Roos 88684d6d9e fix dependency array 2023-01-14 10:48:52 +01:00
Felix Roos 9afddf0850 fix sentence 2023-01-14 01:30:56 +01:00
Felix Roos a2d7d6e81f fix: mini repl could eval before modules are ready 2023-01-14 01:27:22 +01:00
Felix Roos 49bcb5e19f fix minor bugs 2023-01-13 16:35:24 +01:00
Felix Roos 3744ea6218 fix: warnings 2023-01-13 15:17:23 +01:00
Felix Roos b2c6d87633 MiniRepl: add punchcard flag for implicit vis
+ reintroduce editPattern
+ add punchcards to mini-notation.mdx
2023-01-13 15:13:39 +01:00
Felix Roos e4f538b674 fix option handling 2023-01-13 13:00:11 +01:00
Felix Roos ea0e0b4396 reset canvas when pattern changes
+ rename noteroll -> punchcard
2023-01-13 12:57:35 +01:00
Felix Roos 1ac784dc7a localize draw logic 2023-01-13 12:03:34 +01:00
Felix Roos d980c9ca4c Merge branch 'main' into docs 2023-01-13 01:52:36 +01:00
Felix Roos 6a2a60df0d hotfix: tests 2023-01-12 17:43:20 +01:00
Felix Roos ee9b89b6d5 add more synonyms 2023-01-12 17:40:58 +01:00
Felix Roos 68cc109933 burn down that undocumented list 2023-01-12 17:25:01 +01:00
Felix Roos 1015bb0fdc Merge pull request #369 from tidalcycles/docs
document more functions + change arp join
2023-01-12 14:40:58 +01:00
Felix Roos 7da94dd109 reformat headings
+ add another note about single quotes
2023-01-12 14:22:41 +01:00
Felix Roos 171808cf2c add note about single quote strings 2023-01-12 14:19:18 +01:00
Felix Roos 78d14cdfea automatically print synonyms in doc 2023-01-12 13:10:22 +01:00
Felix Roos 19982a2ffb remove unused package 2023-01-12 13:00:22 +01:00
Felix Roos 79904560fc fix: snapshot 2023-01-12 12:48:05 +01:00
Felix Roos 28aee1c58d fix polymeter doc 2023-01-12 12:43:41 +01:00
Felix Roos d4512f360b fix: double slash 2023-01-12 12:40:20 +01:00
Felix Roos 48d0ffe868 add script that finds all undocumented exports 2023-01-12 12:35:04 +01:00
Felix Roos 62af12f3b9 remove experimental class properties 2023-01-12 12:32:27 +01:00
Felix Roos efa4bfef2f fix snapshot 2023-01-12 02:23:06 +01:00
Felix Roos fc3ead4c01 Merge branch 'main' into docs 2023-01-12 02:20:16 +01:00
Felix Roos ca9c813b40 format 2023-01-12 02:18:09 +01:00
Felix Roos e3b0f47c40 hide internals for now 2023-01-12 02:15:42 +01:00
Felix Roos bf13e42092 update snap 2023-01-12 01:57:14 +01:00
Felix Roos 4345fda9bc more doc 2023-01-12 01:56:46 +01:00
Felix Roos 4059e9faa9 more doc 2023-01-12 00:10:58 +01:00
Felix Roos 95fcce1bcf fix: snapshot 2023-01-11 23:38:40 +01:00
Felix Roos 86cde9716a arpWith example 2023-01-11 23:37:59 +01:00
Felix Roos 6e315a50ed breaking: arp use innerJoin instead of squeezeJoin 2023-01-11 23:28:17 +01:00
Felix Roos 500c0b6534 doc: arp + arpWith 2023-01-11 23:26:03 +01:00
Felix Roos db75dca118 doc: split accumulation and conditions 2023-01-11 23:05:17 +01:00
Felix Roos d5f37e2cbe add internals doc 2023-01-11 22:48:47 +01:00
Felix Roos a120a9895b fix: right sidebar width 2023-01-11 22:48:33 +01:00
Felix Roos e9c1db020f hotfix: remove mocked .out 2023-01-11 22:11:22 +01:00
alex 08cd319a0b Revert "Merge branch 'main' into main"
This reverts commit 896ec69329, reversing
changes made to 32e64bbb6e.
2023-01-10 19:45:23 +00:00
Alex McLean 896ec69329 Merge branch 'main' into main 2023-01-10 18:23:45 +00:00
Alex McLean 32e64bbb6e Typo 2023-01-09 23:49:16 +00:00
Felix Roos 0974540e5f fix: typo 2023-01-10 00:21:54 +01:00
Felix Roos e06963e616 Merge pull request #364 from urswilke/patch-2
add https to url
2023-01-10 00:03:46 +01:00
Felix Roos a675815529 hotfix: preview command + build peg without logs 2023-01-09 23:55:45 +01:00
alex 3d48135b32 09 2023-01-09 22:47:25 +00:00
urswilke 8f09e7f097 add https to url 2023-01-09 23:44:49 +01:00
Felix Roos e8b09f1124 Merge pull request #360 from tidalcycles/docs
doc structuring
2023-01-09 23:37:34 +01:00
Felix Roos 57ba353594 snaps 2023-01-09 23:31:30 +01:00
Felix Roos b695e090cd docs: control params 2023-01-09 23:27:30 +01:00
Felix Roos 69ecb7b54f support logs in mini repl
+ pass hap to logger
+ add editPattern hook to repl + useStrudel
+ do not throw when webaudio gets plain values
2023-01-09 23:26:20 +01:00
Alex McLean f57fe182ed Support for multiple mininotation operators WIP (#350)
* support for multiple operators
* fix false test failures by sorting by part
* snapshot
2023-01-09 22:23:27 +00:00
Felix Roos 10ee11c886 docs: improve time modifiers page
+ polymeter + euclidRot
+ rename Factories to Pattern Constructors
2023-01-09 20:39:00 +01:00
Alex McLean 45842b1f05 Fix .out(), renaming webaudio's out() to webaudio() (#361)
* breaking test for out()

* rename webaudio's out() to webaudio(), fixes #359
2023-01-08 23:40:15 +00:00
Felix Roos 9ca5f9ad48 some corrections
+ n should not be recommended for notes as it does not work for samples
2023-01-09 00:19:29 +01:00
Felix Roos bb00036a30 further sidebar reorganizing 2023-01-09 00:17:57 +01:00
Felix Roos 4a2a540500 Update README.md 2023-01-08 23:55:07 +01:00
Felix Roos 09217216dc format 2023-01-08 23:48:32 +01:00
Felix Roos 22a64c4931 update snapshots 2023-01-08 23:46:39 +01:00
Felix Roos 93f520b941 Merge remote-tracking branch 'origin/main' into docs 2023-01-08 23:44:27 +01:00
alex c84714dc3a 08 2023-01-08 13:25:22 +00:00
alex a7aa09a13e 07 2023-01-07 23:15:50 +00:00
alex efa1cdfcb2 07 2023-01-07 23:12:19 +00:00
Felix Roos 70695daae8 remove quotes around inline code snippets 2023-01-07 22:12:53 +01:00
Felix Roos 62fdba0600 pull apart functional docs 2023-01-07 22:12:35 +01:00
Felix Roos 5733e00908 add hideDescription flag to JsDoc 2023-01-07 22:11:47 +01:00
alex e56abaefd7 06 2023-01-07 00:02:39 +00:00
Felix Roos c71e893e8e Merge pull request #356 from tidalcycles/docs
docs: tidal comparison + add global fx + add missing sampler fx
2023-01-06 22:02:31 +01:00
Felix Roos 3992356517 casing 2023-01-06 21:58:35 +01:00
Felix Roos dbb84ef129 write more tidal comparison 2023-01-06 21:56:17 +01:00
Felix Roos 8781fa2e33 add filter synonyms 2023-01-06 21:37:31 +01:00
Felix Roos 605a1365d3 update snapshots 2023-01-06 21:15:32 +01:00
Felix Roos ebb1bbc966 improve effects doc 2023-01-06 21:14:19 +01:00
Felix Roos d4518f7a6e began tidal comparison page 2023-01-06 12:50:35 +01:00
Alex McLean 68c9008019 Fix Bjorklund (#343)
* port Rohan Drape's Bjorklund implementation, add Toussaint's tests
* fix euclidLegato, simplifying a bit now that bjork results should always begin with an 'on'
* migrate euclid numbers in tunes
- 3,4 +1
- 5,8 -1
- 6,8 +3

Co-authored-by: Felix Roos <flix91@gmail.com>
2023-01-06 11:31:32 +00:00
Felix Roos cafde1e910 Merge branch 'main' into docs 2023-01-06 11:49:49 +01:00
alex 41f5f3fe6e 05 2023-01-05 23:58:48 +00:00
alex cf12ecfa34 04 2023-01-04 23:36:40 +00:00
Felix Roos 4fa668927f Merge pull request #345 from tidalcycles/fix-prebake-base-path
Fix prebake base path
2023-01-04 20:29:35 +01:00
Felix Roos 24d2b5b4bd Merge pull request #347 from tidalcycles/fix-midi
fixes #346
2023-01-04 19:55:48 +01:00
Felix Roos 4da2e003e1 fixes #346 2023-01-04 19:52:51 +01:00
Felix Roos 205debde9c more links to fix 2023-01-03 23:40:40 +01:00
Felix Roos ba6c7b0901 fix examples route 2023-01-03 23:32:37 +01:00
Felix Roos 8e5d02fd25 do not include url in base pth 2023-01-03 23:32:28 +01:00
Felix Roos 11d3251c67 add base path + use relative links 2023-01-03 23:02:41 +01:00
alex 9ec5787b4d 03 2023-01-03 21:26:56 +00:00
Felix Roos 027c669ad7 make prebake relative to BASE_URL 2023-01-03 22:17:44 +01:00
Alex McLean 405c12ba3f deploy on push 2023-01-03 10:47:20 +00:00
Alex McLean 64fd53a8e5 tweak 2023-01-03 10:43:54 +00:00
alex 069d63e3cf 02 2023-01-02 23:33:48 +00:00
Alex McLean 66049e0e25 Merge pull request #2 from tidalcycles/main
downstream
2023-01-02 21:07:18 +00:00
Alex McLean db7ef01dbb Patternify euclid, fast, slow and polymeter step parameters in mininotation (#341)
* patternify the mininotation bjorklund, and fast (*) slow (/) and pattern step (%) parameters
* simplify replicate (!), should be closer to tidal now
* highlight atoms rather than elements
* tests
2023-01-02 20:28:07 +00:00
Felix Roos 1a6b649fd6 Merge pull request #340 from tidalcycles/animate
more animate functions + mini repl fix
2023-01-02 00:30:16 +01:00
Felix Roos 548619775e rename .. 2023-01-02 00:28:38 +01:00
Felix Roos 4b79a75f39 fix: mini repls were broken 2023-01-02 00:24:33 +01:00
Felix Roos 28912fff97 animate: rescale + move + zoom 2023-01-01 18:47:45 +01:00
alex 98a83ddcc0 01c 2023-01-01 17:22:16 +00:00
alex e9d965ce7a 01b 2023-01-01 14:22:19 +00:00
alex b7624813cc custom domain 2023-01-01 11:49:20 +00:00
Alex McLean 734e451bd9 Merge pull request #1 from tidalcycles/main
pull from upstream
2023-01-01 11:42:58 +00:00
Alex McLean 7a96436085 move /my-patterns to /swatch (#338) 2023-01-01 11:34:11 +00:00
Felix Roos 670af8fb1b Merge pull request #337 from tidalcycles/animate
animation options
2023-01-01 12:22:55 +01:00
Felix Roos 0abd062e5c fix: smear 0 special case 2023-01-01 12:18:46 +01:00
Felix Roos 1286468d5a animation options
+ do not sync by default
2023-01-01 12:11:39 +01:00
alex 0f3da5be4a 01 2023-01-01 10:05:58 +00:00
Alex McLean 9170269e06 Update README.md 2023-01-01 00:34:53 +00:00
Alex McLean 8bb460701f Tidy parser, implement polymeters (#336)
* rename parser stuff to be more explicit and fit with tidal concepts. qualify all strudel function calls
* Add {,}%n polymeter support, with a few tests
2022-12-31 21:42:49 +00:00
Felix Roos c0a7173ca4 Merge pull request #335 from tidalcycles/animate
animate mvp
2022-12-31 16:51:53 +01:00
Felix Roos 949e15d8c6 controllable smear + sync flag 2022-12-31 16:41:13 +01:00
Felix Roos 0caedeb481 animate mvp 2022-12-31 16:23:45 +01:00
Felix Roos 83ca8d95be Merge pull request #334 from tidalcycles/docs
testing + docs docs
2022-12-30 20:16:09 +01:00
Felix Roos 8483868783 docs: testing + docs 2022-12-30 19:54:02 +01:00
Felix Roos 6961388545 Merge branch 'main' into docs 2022-12-30 17:43:54 +01:00
Felix Roos 8ef1ae5202 Merge pull request #333 from tidalcycles/embed-route
Embed mode improvements
2022-12-29 21:11:15 +01:00
Felix Roos 26b8f93cea roll back hh rhythm 2022-12-29 21:08:11 +01:00
Felix Roos a576523976 simplify meltingsubmarine tune 2022-12-29 21:02:04 +01:00
Felix Roos cf21c4085b simplify embedded mode 2022-12-29 21:01:28 +01:00
Felix Roos 204f655d6d Merge pull request #332 from tidalcycles/fix-mini-multiply-floats
fix: can now multiply floats in mini notation
2022-12-29 14:06:19 +01:00
Felix Roos fb14865785 fix: can now multiply floats in mini notation
- fixes #314
2022-12-29 14:02:50 +01:00
Felix Roos 5cd052cc59 Merge pull request #331 from tidalcycles/my-patterns
improve displaying 's' in pianoroll
2022-12-29 13:50:07 +01:00
Felix Roos af49c4117c add color to some tunes 2022-12-29 13:25:20 +01:00
Felix Roos dd736130a0 improve pianoroll value mapping 2022-12-29 13:03:28 +01:00
Felix Roos cee8bda676 Merge pull request #330 from tidalcycles/my-patterns
my-patterns: fix paths + update readme
2022-12-28 17:35:35 +01:00
Felix Roos 6420a72ceb fix paths + update readme 2022-12-28 17:33:14 +01:00
Felix Roos 380e7c7899 Merge pull request #329 from tidalcycles/my-patterns
my-patterns build + deploy
2022-12-28 17:11:40 +01:00
Felix Roos 16b4058a8b fix build + simplify logic + add deploy note 2022-12-28 17:09:18 +01:00
Felix Roos e3fba0257f Merge pull request #328 from tidalcycles/my-patterns
add my-patterns
2022-12-28 15:43:31 +01:00
Felix Roos cb8b65f6f3 add my-patterns 2022-12-28 15:39:42 +01:00
Felix Roos 3944a8ed54 Merge pull request #327 from tidalcycles/docs
add examples route
2022-12-28 14:47:13 +01:00
Felix Roos 2ceafe6379 Merge pull request #326 from tidalcycles/eval-fix-node
fix: workaround Object.assign globalThis
2022-12-28 14:44:30 +01:00
Felix Roos 9f058bd88a add examples page with prerendered swatches 2022-12-28 14:40:53 +01:00
Felix Roos 1dd0ff13d8 Merge remote-tracking branch 'origin/eval-fix-node' into docs 2022-12-28 14:02:55 +01:00
Felix Roos 6061f10230 fix: workaround Object.assign globalThis
- see comment
2022-12-28 13:57:27 +01:00
Felix Roos ea59fafb52 Merge pull request #324 from tidalcycles/docs
mini repl improvements
2022-12-26 23:29:47 +01:00
Felix Roos 2ff71126de add withCanvas 2022-12-26 23:25:57 +01:00
Felix Roos 6d522e1743 Merge remote-tracking branch 'origin/main' into docs 2022-12-26 23:13:51 +01:00
Felix Roos b37f3c819d remove color magic for now 2022-12-26 23:12:16 +01:00
Felix Roos 1b41994e5f codeformat 2022-12-26 23:01:18 +01:00
Felix Roos 4fd4b0d713 Merge pull request #323 from tidalcycles/notes-without-octave
support notes without octave
2022-12-26 23:00:34 +01:00
Felix Roos 7b43ed702e only start animation loop when canvas is visible
+ add some placeholder files
2022-12-26 22:59:41 +01:00
Felix Roos 56cd77942b remove old graphic 2022-12-26 22:50:10 +01:00
Felix Roos 37dc723b4b react package build... 2022-12-26 22:44:23 +01:00
Felix Roos d7ea37c917 add technical manual to docs 2022-12-26 22:43:02 +01:00
Felix Roos c1d2bf9b9f fix anchor links 2022-12-26 22:16:46 +01:00
Felix Roos 36f837730a better color support 2022-12-26 22:13:41 +01:00
Felix Roos b8f0a1dd82 fix format 2022-12-26 21:04:15 +01:00
Felix Roos 2d1b62a978 begin reimplementing draw logic for parallel use 2022-12-26 20:58:57 +01:00
Felix Roos 0792d0d59d add scheduler.now to get phase starting from 0 2022-12-26 20:55:21 +01:00
Felix Roos 8c6da1a658 Merge branch 'main' into docs 2022-12-26 13:31:06 +01:00
Felix Roos 26be10f937 hotfix: css + sn -> sd 2022-12-26 12:43:08 +01:00
Felix Roos ef4d9a13ed Merge pull request #320 from jarmitage/main
tutorial updates
2022-12-26 12:37:36 +01:00
Jack Armitage 320d987ede wut 2022-12-26 11:32:55 +00:00
Jack Armitage 51a4c4d13b codeformat 2022-12-26 11:30:01 +00:00
Felix Roos aaf3ae5f9c microrhythm experiment 2022-12-26 11:25:27 +01:00
Jack Armitage 858f4f74b3 tutorial updates 2022-12-25 16:21:18 +00:00
Felix Roos 3feed90039 translate parts of tidal "How-tos" 2022-12-24 00:14:26 +01:00
Felix Roos b46330fc7a proper setup minirepl 2022-12-24 00:12:54 +01:00
Felix Roos 5ca7ce1f75 Merge commit 'd1d9b37ec764dd7377754d88e72996ef887beb82' into docs 2022-12-23 23:06:54 +01:00
Felix Roos d1d9b37ec7 supper notes without octave 2022-12-23 23:01:07 +01:00
Felix Roos 823115c4ec Merge pull request #318 from tidalcycles/reference-tab-sort
Reference tab sort
2022-12-23 18:26:30 +01:00
Felix Roos 8fe3fda27f update snapshots 2022-12-23 18:24:40 +01:00
Felix Roos 63fffd7493 docs: envelope functions 2022-12-23 17:57:01 +01:00
Felix Roos 243a350e2b fix: #317 2022-12-23 17:32:25 +01:00
Felix Roos 8c09e7ba36 hotfix: go to repl link 2022-12-23 01:05:17 +01:00
Felix Roos d89502f91f hotfix: make sure jsdoc is built before build 2022-12-23 01:01:45 +01:00
Felix Roos 847602f933 hotfix: add missing npm ci 2022-12-23 00:58:48 +01:00
Felix Roos 8fcf8fe39c Revert "hotfix: build task for ci"
This reverts commit d59eec9296.
2022-12-23 00:57:59 +01:00
Felix Roos d59eec9296 hotfix: build task for ci 2022-12-23 00:54:43 +01:00
Felix Roos b9122ebc34 Merge pull request #315 from tidalcycles/astro-build
Astro build
2022-12-23 00:49:56 +01:00
Felix Roos 38e066ee49 fix import 2022-12-23 00:47:33 +01:00
Felix Roos 232a04a1a2 docs: mobile nav 2022-12-23 00:41:47 +01:00
Felix Roos dcb145635c add tutorial redirect
+ place learn link last in repl header
+ fix all old links to /tutorial
2022-12-22 23:47:11 +01:00
Felix Roos c9b73c68a6 fix pretest task 2022-12-22 23:32:19 +01:00
Felix Roos 08f7925ea9 delete now obsolete repl + tutorial folders 2022-12-22 23:28:34 +01:00
Felix Roos ed79ec7940 copy potentially useful files from old tutorial 2022-12-22 23:22:48 +01:00
Felix Roos 869a44dd04 autolink headings 2022-12-22 23:19:38 +01:00
Felix Roos 6a9e9ebc4c responsiveness 2022-12-22 23:07:14 +01:00
Felix Roos f18a2a11fa make repl and doc styles more similar 2022-12-22 22:49:41 +01:00
Felix Roos 9aaaa755c7 fix import + update build task 2022-12-22 17:23:35 +01:00
Felix Roos 818cd9044b integrate repl into astro website
+ update build and setup tasks + workflow
+ move repl test folder to root
+ move docs and repl to website/src
2022-12-22 17:20:51 +01:00
Felix Roos 006ca12b6d rename folder 2022-12-22 15:36:24 +01:00
Felix Roos b5f9ab7c20 slight layout fixes 2022-12-20 22:47:49 +01:00
Felix Roos 0981f95f16 style left sidebar 2022-12-20 22:26:12 +01:00
Felix Roos f64ef32eaa more styling 2022-12-20 22:19:30 +01:00
Felix Roos 7a19659c9e remove theme.css + cooler bg 2022-12-20 21:57:41 +01:00
Felix Roos b1202fcd55 split tutorial into multiple pages
+ improve layout a bit
2022-12-20 21:38:08 +01:00
Felix Roos b8f991eddb simplify writing mdx files 2022-12-20 20:42:42 +01:00
Felix Roos d0013f55a2 format 2022-12-20 19:50:32 +01:00
Felix Roos 7efaff4f6f basic style for toc + further cleanup 2022-12-20 19:47:28 +01:00
Felix Roos bc7a84e462 basic astro docs 2022-12-19 23:23:31 +01:00
Felix Roos 61657bd1b1 Merge pull request #307 from tidalcycles/obj-support-scale
object support for .scale
2022-12-19 21:02:37 +01:00
Felix Roos fc63f4f89c Merge pull request #312 from tidalcycles/jsdoc-component
Jsdoc component
2022-12-19 21:02:21 +01:00
Felix Roos 2c44c252d7 fixed namespaced anchor links 2022-12-19 20:59:47 +01:00
Felix Roos 613fc6e3ef fix anchor icon color 2022-12-19 20:57:42 +01:00
Felix Roos 0a9604d10e throw out nunjucks 2022-12-19 20:48:57 +01:00
Felix Roos 1cabedc65e Merge pull request #311 from tidalcycles/fix-clipboard
fix: copy share link to clipboard was broken for some browers
2022-12-19 20:31:46 +01:00
Felix Roos 4e5a0d9e02 fix: #309 2022-12-19 20:30:01 +01:00
Alex McLean bf373d894d ICLC2023 paper (#306)
Paper submission for the international conference on live coding
2022-12-19 11:11:24 +00:00
Felix Roos e6bbad84c1 Merge pull request #308 from tidalcycles/pianoroll-freq-support
support freq in pianoroll
2022-12-15 21:23:22 +01:00
Felix Roos 4de477d46c support freq in pianoroll 2022-12-15 21:21:20 +01:00
Felix Roos 264cab3c9b add scale test 2022-12-15 20:35:10 +01:00
Felix Roos 7f9ef59bea Merge branch 'main' into obj-support-scale 2022-12-15 17:49:24 +01:00
Felix Roos 8ebbef4cbb fix core deps after release trouble 2022-12-13 22:46:35 +01:00
Felix Roos 0c98a84242 bump root to 0.5.0 2022-12-13 22:38:58 +01:00
Felix Roos 2bbdd21b2f Publish
- @strudel.cycles/csound@0.5.1
 - @strudel.cycles/eval@0.5.0
 - @strudel.cycles/midi@0.5.0
 - @strudel.cycles/mini@0.5.0
 - @strudel.cycles/react@0.5.0
 - @strudel.cycles/soundfonts@0.5.0
 - @strudel.cycles/tonal@0.5.0
 - @strudel.cycles/tone@0.5.0
 - @strudel.cycles/transpiler@0.5.0
 - @strudel.cycles/webaudio@0.5.0
 - @strudel.cycles/webdirt@0.5.0
 - @strudel.cycles/xen@0.5.0
2022-12-13 22:38:08 +01:00
Felix Roos 794cfe949b bump already published packages 2022-12-13 22:36:13 +01:00
Felix Roos 6a5010a2d6 bump csound 2022-12-13 22:28:16 +01:00
Felix Roos 61559fee9d Revert "Publish"
This reverts commit 2118a20408.
2022-12-13 22:24:12 +01:00
Felix Roos 2118a20408 Publish
- @strudel.cycles/core@0.5.0
 - @strudel.cycles/csound@0.4.0
 - @strudel.cycles/eval@0.5.0
 - @strudel.cycles/midi@0.5.0
 - @strudel.cycles/mini@0.5.0
 - @strudel.cycles/osc@0.4.0
 - @strudel.cycles/react@0.5.0
 - @strudel.cycles/serial@0.3.0
 - @strudel.cycles/soundfonts@0.5.0
 - @strudel.cycles/tonal@0.5.0
 - @strudel.cycles/tone@0.5.0
 - @strudel.cycles/transpiler@0.5.0
 - @strudel.cycles/webaudio@0.5.0
 - @strudel.cycles/webdirt@0.5.0
 - @strudel.cycles/xen@0.5.0
2022-12-13 22:22:27 +01:00
Felix Roos b0bc20cb83 hotfix: code format
- PR was issued before prettier check, now ci fails
2022-12-13 22:10:09 +01:00
Felix Roos 2cd77b075b Merge pull request #303 from gogins/main
Updated csoundm to use the register facility .
2022-12-13 22:07:27 +01:00
Felix Roos 03450c6085 Merge pull request #305 from tidalcycles/estlint-prettier-check
add lint + prettier check before test
2022-12-13 21:57:03 +01:00
Felix Roos 5d3c522da2 run prettier + lint separately (improves output) 2022-12-13 21:53:45 +01:00
Felix Roos bf1ba6efc0 code format 2022-12-13 21:32:03 +01:00
Felix Roos 67ad82d52e add lint + prettier check before test 2022-12-13 21:27:16 +01:00
Felix Roos f437d976f8 Merge pull request #301 from tidalcycles/support-freq-in-sampler
add freq support to sampler
2022-12-13 21:21:43 +01:00
gogins c94443faaa Updated csoundm to use . 2022-12-12 20:54:03 -05:00
Felix Roos c6d57f6a56 fix non note samples 2022-12-12 20:53:11 +01:00
Felix Roos 09b06da403 fix error message 2022-12-12 20:45:15 +01:00
Felix Roos df73ce8a60 add freq support to sampler 2022-12-12 20:41:09 +01:00
Felix Roos 8b22c2e04f Merge pull request #300 from tidalcycles/fix-trim
fix whitespace trimming
2022-12-12 00:48:41 +01:00
Felix Roos b4f4d6cea2 fix whitespace trimming 2022-12-12 00:45:47 +01:00
Felix Roos cdf7b2acf1 Merge branch 'main' of https://github.com/tidalcycles/strudel 2022-12-12 00:23:22 +01:00
Felix Roos 94651731a5 hotfix: uncomment essential line :) 2022-12-12 00:23:03 +01:00
Alex McLean 56424d29a3 .defragmentHaps() (#299) 2022-12-11 23:21:53 +00:00
Felix Roos c5083b2aef Merge pull request #298 from tidalcycles/dont-highlight-whitespace
remove whitespace from highlighted region
2022-12-11 23:17:48 +01:00
Felix Roos 1b06795ffe remove whitespace from highlighted region 2022-12-11 23:14:47 +01:00
Felix Roos 6679cd60ce scale now supports running on object values with n 2022-12-11 22:45:36 +01:00
Felix Roos 843a3c16ba Merge pull request #297 from tidalcycles/package-update
update vitest
2022-12-11 22:03:26 +01:00
Felix Roos df40204a57 update vitest 2022-12-11 21:58:58 +01:00
Felix Roos 210910eb6e hotfix: lastOf was undefined 2022-12-11 21:56:05 +01:00
Felix Roos ef427758da Merge pull request #287 from tidalcycles/numeral-union
can now add bare numbers to numeral object props
2022-12-11 21:44:16 +01:00
Felix Roos def6bbf683 add test 2022-12-11 21:43:05 +01:00
Felix Roos 5f37a4a21c Merge pull request #295 from tidalcycles/refactor-bootstrap
Move stuff to new register function
2022-12-11 21:27:58 +01:00
Felix Roos dc869987f9 Merge pull request #296 from tidalcycles/prettier-task
add prettier task
2022-12-11 20:07:12 +01:00
Felix Roos b98d2201e5 add prettier task 2022-12-11 19:37:36 +01:00
Felix Roos 8dd6440bb8 update snapshots 2022-12-11 13:46:22 +01:00
Felix Roos a2d83c48eb comment out pipe operator test 2022-12-11 13:28:54 +01:00
Felix Roos a0ae8f4a07 "fix" voice leading 2022-12-11 13:28:24 +01:00
Felix Roos 719dcbcd4d fix some tests 2022-12-11 12:06:00 +01:00
Felix Roos caa207e868 dont use random seedState for now 2022-12-11 11:55:14 +01:00
Felix Roos 306004ecd2 make mini "?" behave like .degradeBy + add comment 2022-12-11 00:13:30 +01:00
Felix Roos bcac3c5b84 fix typo 2022-12-11 00:08:13 +01:00
Felix Roos ccc90108df snapshots 2022-12-10 22:59:39 +01:00
Felix Roos b9781915a4 remove bootstrap + Pattern.patternify 2022-12-10 22:58:07 +01:00
Felix Roos 1890e65b75 refactor speak 2022-12-10 22:56:08 +01:00
Felix Roos 2f4da3ed52 refactor csound 2022-12-10 22:47:24 +01:00
Felix Roos 27a6ac0c0b refactor xen and tone packages 2022-12-10 22:39:51 +01:00
Felix Roos b81a66f07e refactor uses of voicings
+ fix usages of scaleTranspose
2022-12-10 21:47:58 +01:00
Felix Roos bc43fc9585 refactor tonal functions to 'register' 2022-12-10 21:34:38 +01:00
Felix Roos 4f7c013c78 refactor most signal functions 2022-12-10 21:03:36 +01:00
Felix Roos 09b15a07c6 use register for degradeBy / undegradeBy 2022-12-10 19:25:51 +01:00
Alex McLean 4340f024d3 Reorganise pattern.mjs with a 'toplevel first' regime (#286)
'toplevel first' regime
* loopAt has its optional cps parameter removed, with loopAtCps added for supporting that usage.
* rename bitlevel operations e.g. _and -> band

Co-authored-by: Felix Roos <flix91@gmail.com>
2022-12-10 14:39:03 +00:00
Alex McLean 98e9780819 Fancy hap show, include part in snapshots (#291)
* fix _mod import

* prettier hap show, use both whole and parts in snapshots, rebuild snapshots
2022-12-10 10:56:16 +00:00
Felix Roos a45d63595f delete bare value before numeral union 2022-12-09 11:00:28 +01:00
Felix Roos 5fbd1453b4 can now add bare numbers to numeral object props 2022-12-09 10:40:31 +01:00
Alex McLean f827201ee0 Switch 'operators' from .whatHow to .what.how, and make sure there are toplevel curried functions for all of them. Rename util.mod to util._mod, to make room for toplevel 'operator' of that name. (#285) 2022-12-07 19:07:55 +00:00
Felix Roos 485a96962a Merge pull request #281 from tidalcycles/arp
implement collect + arp function
2022-12-04 12:51:01 +01:00
Felix Roos 98a104f731 update snapshot 2022-12-04 11:58:19 +01:00
Felix Roos ff987f14d7 add arp example tune 2022-12-04 11:57:40 +01:00
Felix Roos 4dd08268dc implement collect + arp function 2022-12-04 11:38:11 +01:00
Felix Roos c18a13d4fc Merge pull request #278 from tidalcycles/do-not-recompile-orc
do not recompile orc
2022-12-02 13:38:27 +01:00
Felix Roos 7a79995727 do not recompile orc 2022-12-02 13:34:05 +01:00
Felix Roos 01eca562c5 Merge pull request #275 from tidalcycles/csound
add basic csound output
2022-12-02 12:49:26 +01:00
Felix Roos f491d0c0c4 fix loadOrc in tests 2022-12-02 12:22:32 +01:00
Felix Roos edf2287e13 Merge remote-tracking branch 'origin/main' into csound 2022-12-02 12:20:12 +01:00
Felix Roos fcaab633c1 Merge pull request #277 from tidalcycles/tune-licenses
add licenses / credits to all tunes + remove some
2022-12-02 12:18:41 +01:00
Felix Roos 33b6579b5d update snapshots 2022-12-02 12:17:15 +01:00
Felix Roos 72a8e4bc22 add licenses / credits to all tunes + remove some 2022-12-02 12:11:28 +01:00
Felix Roos c67b02b7b0 update tunes 2022-12-02 12:09:58 +01:00
Felix Roos 486cd00384 added loadOrc + removed livecode.orc by default 2022-12-02 12:09:21 +01:00
Alex McLean caea7bb39d Support sending CRC16 bytes with serial messages (#276)
Optionally add a crc16 checksum.
Optionally support sending names in name/value pairs as single characters
2022-12-02 10:45:01 +00:00
Felix Roos e8fb7ee683 now passing controls as string keymap 2022-12-02 11:38:47 +01:00
Felix Roos e4ee4211c8 delete strudel unrealted example 2022-12-01 15:10:22 +01:00
Felix Roos 3fa3ebee14 Merge remote-tracking branch 'origin/main' into csound 2022-12-01 15:05:23 +01:00
Felix Roos 8e531f400e allow defining csound on the window 2022-12-01 15:00:16 +01:00
Felix Roos 5727c0dc8a clean up tunes + also load presets.orc 2022-12-01 14:56:50 +01:00
Felix Roos f599088cdf cleanup 2022-12-01 14:44:53 +01:00
Felix Roos d78da55f54 lazy init + add livecode.org 2022-12-01 14:36:00 +01:00
Felix Roos 9052ff71e6 get rid of csound warning on reevaluation:
- only compile on init, use evalCode after
- pull presets into csd file
- use custom logging
2022-12-01 12:34:26 +01:00
Felix Roos 713da887ca Merge branch 'tonal-update' into csound 2022-12-01 12:32:05 +01:00
Felix Roos ad5950697e Merge pull request #273 from tidalcycles/fix-tutorial-bugs
release version bumps
2022-11-29 23:41:39 +01:00
Felix Roos 85d0d06cab Merge branch 'main' into fix-tutorial-bugs 2022-11-29 23:37:35 +01:00
Felix Roos be6ec558e3 Merge pull request #271 from tidalcycles/eslint
add eslint
2022-11-29 23:34:50 +01:00
Felix Roos dd2f60810a Merge pull request #272 from tidalcycles/tonal-update
tonal update with fixed memory leak
2022-11-29 23:34:26 +01:00
Felix Roos 6c0b86d8f4 update tonal, fixes #269 2022-11-29 23:31:23 +01:00
Felix Roos 517ada6dbf tiny time improvement 2022-11-29 23:02:09 +01:00
Felix Roos 0a098e3008 mock csound 2022-11-29 22:04:46 +01:00
Felix Roos c40078ffc9 improve csound bindings:
- better timing
- can now pass instrument to .csound(...)
- can now write instruments with csound(...)
2022-11-29 21:59:22 +01:00
Felix Roos 729e0afdbe fix typo 2022-11-29 00:10:21 +01:00
Felix Roos eab86840d3 baasic csound output 2022-11-29 00:05:51 +01:00
Felix Roos 43aa2247f1 baasic csound output 2022-11-29 00:05:36 +01:00
Felix Roos afe17a507e update tonal: not working... 2022-11-28 23:00:15 +01:00
Felix Roos e621020474 continue tutorial 2022-11-28 21:33:17 +01:00
Felix Roos ac2aa7f288 add csound minimal example 2022-11-28 20:48:52 +01:00
Felix Roos 805bd7e930 simplify without-audio example 2022-11-24 20:56:09 +01:00
Felix Roos f9bf2122b7 add without-audio example 2022-11-24 20:13:54 +01:00
Felix Roos 4e3e533e13 repl: optional eval callbacks 2022-11-24 20:13:04 +01:00
Felix Roos 611c429912 lint before test 2022-11-24 15:31:47 +01:00
Felix Roos e2898ee5bf add eslint + fix lint errors 2022-11-24 15:30:11 +01:00
Alex McLean e1a532500e Tidying up core (#256)
* remove _ prefixes except for functions to be patternified
* categorise pattern methods
* experimental support for `.add.squeeze` and friends as alternative to `.addSqueeze`
* `every` is now an alias for `firstOf` with additional `lastOf` (which every will become an alias for next)
2022-11-22 08:51:25 +00:00
Felix Roos 4cf412b93d Merge pull request #266 from tidalcycles/faster-fast
fix performance bottleneck
2022-11-21 22:15:48 +01:00
Felix Roos 54c9c434e0 fix examples snapshot 2022-11-21 22:09:26 +01:00
Felix Roos de19f3e5fe fix tune snapshots 2022-11-21 22:08:17 +01:00
Felix Roos 8304993481 fix: #194 2022-11-21 21:59:08 +01:00
Felix Roos 4c838aeaca hotfix: weird audion bug 2022-11-17 11:13:49 +01:00
Felix Roos 4ec1145dce Publish
- @strudel.cycles/core@0.4.1
 - @strudel.cycles/eval@0.4.1
 - @strudel.cycles/midi@0.4.1
 - @strudel.cycles/mini@0.4.1
 - @strudel.cycles/osc@0.3.1
 - @strudel.cycles/react@0.4.2
 - @strudel.cycles/soundfonts@0.4.2
 - @strudel.cycles/tonal@0.4.1
 - @strudel.cycles/tone@0.4.1
 - @strudel.cycles/transpiler@0.4.1
 - @strudel.cycles/webaudio@0.4.2
 - @strudel.cycles/webdirt@0.4.1
 - @strudel.cycles/xen@0.4.1
2022-11-17 11:09:54 +01:00
Felix Roos 547d925065 Merge pull request #263 from tidalcycles/fix-tutorial-bugs
fix tutorial bugs
2022-11-17 11:08:37 +01:00
Felix Roos 874633051b fix: snapshot 2022-11-17 10:56:46 +01:00
Felix Roos 2293f1ba15 fix: worklets now work in the tutorial again 2022-11-17 10:52:07 +01:00
Felix Roos 483c3f61b5 midi now works in the tutorial 2022-11-17 10:49:44 +01:00
Felix Roos 83263968f2 fix: rootNotes example 2022-11-17 10:41:32 +01:00
Felix Roos f279c61792 fix: each example 2022-11-17 10:19:04 +01:00
Felix Roos 9717c696d8 add s for sharp (fixes notes example) 2022-11-17 10:16:29 +01:00
Felix Roos 94a594c777 fix sample examples 2022-11-17 10:15:59 +01:00
Felix Roos f1ae8a17cf fix: could play multiple mini repl at once 2022-11-17 10:07:19 +01:00
Felix Roos add9c43827 Merge pull request #254 from tidalcycles/binaries
Binaries
2022-11-16 13:15:28 +01:00
Felix Roos d3f6a5c296 package-lock 2022-11-16 13:13:50 +01:00
Felix Roos 4aea78b7c0 Merge branch 'main' into binaries 2022-11-16 13:13:11 +01:00
Felix Roos 4313fe670d hotfix: fix share #261 2022-11-13 21:32:46 +01:00
Felix Roos 2e8a1b67ea hotfix: fix prebuild 2022-11-13 20:53:28 +01:00
Felix Roos e73044c533 Publish
- @strudel.cycles/react@0.4.1
 - @strudel.cycles/soundfonts@0.4.1
 - @strudel.cycles/webaudio@0.4.1
2022-11-13 20:48:52 +01:00
Felix Roos 418f09e364 hotfix: remove webaudio build for now 2022-11-13 20:48:32 +01:00
Felix Roos 08f207a396 package-lock 2022-11-13 20:44:05 +01:00
Felix Roos 4f57060708 Publish
- @strudel.cycles/core@0.4.0
 - @strudel.cycles/eval@0.4.0
 - @strudel.cycles/midi@0.4.0
 - @strudel.cycles/mini@0.4.0
 - @strudel.cycles/osc@0.3.0
 - @strudel.cycles/react@0.4.0
 - @strudel.cycles/serial@0.2.0
 - @strudel.cycles/soundfonts@0.4.0
 - @strudel.cycles/tonal@0.4.0
 - @strudel.cycles/tone@0.4.0
 - @strudel.cycles/transpiler@0.4.0
 - @strudel.cycles/webaudio@0.4.0
 - @strudel.cycles/webdirt@0.4.0
 - @strudel.cycles/xen@0.4.0
2022-11-13 20:43:00 +01:00
Felix Roos 1507724ecd hotfix: webaudio main file 2022-11-13 20:42:17 +01:00
Felix Roos 4bc2f64b24 Merge pull request #255 from tidalcycles/repl-refactoring
Repl refactoring
2022-11-13 20:20:32 +01:00
Felix Roos 839ba31dfb remove refactoring notes 2022-11-13 18:49:16 +01:00
Felix Roos 2341452d91 fix: highlighting error 2022-11-13 18:44:00 +01:00
Felix Roos 7ab263b514 floating error message 2022-11-13 17:11:14 +01:00
Felix Roos 45b5b5960f remove hideHeader function 2022-11-13 16:54:45 +01:00
Felix Roos 1b8ec1f01c secret zen mode 2022-11-13 15:47:11 +01:00
Felix Roos c92cb1c096 better draw cleanup + began reference tab 2022-11-13 14:50:48 +01:00
Felix Roos 8f31fbe275 proper draw cleanup 2022-11-13 13:58:36 +01:00
Felix Roos aa76419eda fix activeFooter state 2022-11-13 12:25:30 +01:00
Felix Roos 21503c0c38 separate header + footer components 2022-11-13 12:12:19 +01:00
Felix Roos d957b19f55 fix first highlights 2022-11-13 02:00:09 +01:00
Felix Roos 122c4242ce use new transpiler in test runtime 2022-11-13 01:43:54 +01:00
Felix Roos e769ed2fd8 move draw stuff from tone to core + fix getPhase 2022-11-13 01:42:00 +01:00
Felix Roos c722904831 prevent flicker 2022-11-13 00:30:48 +01:00
Felix Roos c93faa9564 show intro only when coming to root url 2022-11-13 00:30:18 +01:00
Felix Roos ce6495a46d unfriend intro readers 2022-11-12 23:38:02 +01:00
Felix Roos 04f2b905af basic intro tab 2022-11-12 21:28:07 +01:00
Felix Roos b668a2c0d2 refactor onTrigger 2022-11-12 20:17:57 +01:00
Felix Roos 5fc8f10602 basic samples tab 2022-11-12 20:17:01 +01:00
Felix Roos a27f399a9e tabbed footer 2022-11-12 17:50:10 +01:00
Felix Roos ff5d14fb63 can now have multiple triggers
+ Pattern.log now makes sense
2022-11-12 16:52:00 +01:00
Felix Roos 27fb2d2d5b remove onLog callbacks 2022-11-12 12:07:02 +01:00
Felix Roos 0b9d59bf0e logger works now outside of react
+ dynamic sample loading logs
+ remove old sampler code
2022-11-12 11:50:39 +01:00
Felix Roos 23e059a065 scheduler error handling + style 2022-11-11 23:35:46 +01:00
Felix Roos 45c7b29a96 big style update + new log system 2022-11-11 22:46:20 +01:00
Felix Roos 3e6c3fda60 update todos 2022-11-10 22:30:12 +01:00
Felix Roos 1a1363ef77 scheduler error handling 2022-11-10 22:25:58 +01:00
Felix Roos b5c51e231b lazy midi init + remove useWebMidi hook 2022-11-10 22:25:28 +01:00
Felix Roos 22711dd7be remove log 2022-11-10 22:05:08 +01:00
Felix Roos 1ba4d3d5d1 only connect via osc when .osc is called 2022-11-10 22:04:22 +01:00
Felix Roos 823ab73585 cleaner error when midi is unsupported 2022-11-10 22:04:02 +01:00
Felix Roos 66c444efac add sourcemaps 2022-11-10 22:03:34 +01:00
Felix Roos b688b8921a init audio on first click to remove warning 2022-11-10 22:03:23 +01:00
Felix Roos 00550ddab5 pass all params to onTrigger 2022-11-10 22:02:08 +01:00
Felix Roos 42fedec088 fix logger 2022-11-10 22:01:55 +01:00
Felix Roos ff3bc0e8c2 fix core log 2022-11-10 22:01:49 +01:00
Felix Roos dde7dff870 fix: hash urls 2022-11-10 21:11:25 +01:00
Felix Roos 25ffc9cf96 add logger 2022-11-10 21:10:33 +01:00
Felix Roos eca92cf5b5 fix: web midi 2022-11-10 18:12:38 +01:00
Felix Roos 372bdf8be7 fix: highlighting sync 2022-11-10 17:15:10 +01:00
Felix Roos c7c90b0647 fix mini repl + improve repl api 2022-11-10 16:36:51 +01:00
Felix Roos 14c2da4fa2 started refac repl to new scheduler + transpiler 2022-11-10 12:07:36 +01:00
Felix Roos 64275cfd22 revert server changes 2022-11-10 10:12:52 +01:00
Felix Roos f0b099d9f7 Merge remote-tracking branch 'origin/main' into binaries 2022-11-10 10:11:47 +01:00
Felix Roos c99d957bc8 Merge pull request #250 from tidalcycles/webaudio-build
Webaudio build
2022-11-08 23:35:10 +01:00
Felix Roos 51b14d55ec fix webaudio main file + add buildless repl 2022-11-08 23:29:27 +01:00
Felix Roos f92d9994df Publish
- @strudel.cycles/soundfonts@0.3.3
 - @strudel.cycles/webaudio@0.3.3
2022-11-08 23:17:43 +01:00
Felix Roos 431e1b87bd add webaudio cjs + esm build task 2022-11-08 23:16:24 +01:00
Felix Roos 3ec2fc6030 Publish
- @strudel.cycles/midi@0.3.3
 - @strudel.cycles/mini@0.3.3
 - @strudel.cycles/react@0.3.3
 - @strudel.cycles/tonal@0.3.3
 - @strudel.cycles/tone@0.3.3
2022-11-08 22:52:46 +01:00
Felix Roos 99f416bf6b hotfix: fix chord-voicings dependency 2022-11-08 22:51:28 +01:00
Felix Roos 89acc4870b Publish
- @strudel.cycles/core@0.3.2
 - @strudel.cycles/eval@0.3.2
 - @strudel.cycles/midi@0.3.2
 - @strudel.cycles/mini@0.3.2
 - @strudel.cycles/react@0.3.2
 - @strudel.cycles/soundfonts@0.3.2
 - @strudel.cycles/tonal@0.3.2
 - @strudel.cycles/tone@0.3.2
 - @strudel.cycles/transpiler@0.3.2
 - @strudel.cycles/webaudio@0.3.2
 - @strudel.cycles/webdirt@0.3.2
 - @strudel.cycles/xen@0.3.2
2022-11-08 22:45:44 +01:00
Felix Roos 314c739c3a Merge pull request #249 from tidalcycles/use-acorn
new transpiler based on acorn
2022-11-08 22:43:31 +01:00
Felix Roos 30b18fc997 add transpiler readme 2022-11-08 22:32:42 +01:00
Felix Roos 168ac60853 use tune that works without transpiler 2022-11-08 21:25:21 +01:00
Felix Roos dff0c0c3b0 vanilla-repl: use mini for all strings
+ skip transpiler
2022-11-08 21:17:00 +01:00
Felix Roos ea3e9de7ab feat: can now set a string parser for reify 2022-11-08 21:16:23 +01:00
Felix Roos c93fd900bc fix: tests 2022-11-08 21:04:41 +01:00
Felix Roos a761aa9a37 use new transpiler in nano-repl 2022-11-08 20:53:47 +01:00
Felix Roos f37eb92d93 support line,column,offset format 2022-11-08 20:53:26 +01:00
Felix Roos 2c7cc5d325 core evaluate now works without transpiler 2022-11-08 20:23:30 +01:00
Felix Roos 16659c82d2 test with old transpiler for now 2022-11-08 19:54:57 +01:00
Felix Roos 4ed3ca4128 use new transpiler in vite-vanilla-repl 2022-11-08 19:50:27 +01:00
Felix Roos 9b2899c8fb transpiler package to replace eval package 2022-11-06 23:15:01 +01:00
Felix Roos fada7fc9cc Publish
- @strudel.cycles/eval@0.3.1
 - @strudel.cycles/midi@0.3.1
 - @strudel.cycles/mini@0.3.1
 - @strudel.cycles/react@0.3.1
 - @strudel.cycles/soundfonts@0.3.1
 - @strudel.cycles/tonal@0.3.1
 - @strudel.cycles/tone@0.3.1
 - @strudel.cycles/webaudio@0.3.1
 - @strudel.cycles/webdirt@0.3.1
 - @strudel.cycles/xen@0.3.1
2022-11-06 19:53:24 +01:00
Felix Roos 2be5bca42b hotfix: core dependencies 2022-11-06 19:51:56 +01:00
Felix Roos b1ebf6367c Publish
- @strudel.cycles/core@0.3.1
 - @strudel.cycles/eval@0.3.0
 - @strudel.cycles/midi@0.3.0
 - @strudel.cycles/mini@0.3.0
 - @strudel.cycles/react@0.3.0
 - @strudel.cycles/soundfonts@0.3.0
 - @strudel.cycles/tonal@0.3.0
 - @strudel.cycles/tone@0.3.0
 - @strudel.cycles/webaudio@0.3.0
 - @strudel.cycles/webdirt@0.3.0
 - @strudel.cycles/xen@0.3.0
2022-11-06 19:39:30 +01:00
Felix Roos 57e373f578 hotfix: npmignore react examples 2022-11-06 19:39:05 +01:00
Felix Roos 5c01874a32 release: bump core 0.3.0 2022-11-06 19:37:49 +01:00
Felix Roos dd89e11633 hotfix: npm ignore examples folder 2022-11-06 19:36:01 +01:00
Felix Roos 4e51f19780 Publish
- @strudel.cycles/embed@0.2.0
 - @strudel.cycles/osc@0.2.0
2022-11-06 19:30:53 +01:00
Felix Roos 33d37d8dee Revert "Publish"
This reverts commit 60ce34af43.
2022-11-06 19:28:11 +01:00
Felix Roos 60ce34af43 Publish
- @strudel.cycles/core@0.3.0
 - @strudel.cycles/embed@0.2.0
 - @strudel.cycles/eval@0.3.0
 - @strudel.cycles/midi@0.3.0
 - @strudel.cycles/mini@0.3.0
 - @strudel.cycles/osc@0.2.0
 - @strudel.cycles/react@0.3.0
 - @strudel.cycles/soundfonts@0.3.0
 - @strudel.cycles/tonal@0.3.0
 - @strudel.cycles/tone@0.3.0
 - @strudel.cycles/webaudio@0.3.0
 - @strudel.cycles/webdirt@0.3.0
 - @strudel.cycles/xen@0.3.0
2022-11-06 19:12:57 +01:00
Felix Roos 2602ff6e34 hotfix: revert lerna upgrade 2022-11-06 19:10:09 +01:00
Felix Roos ef5cd36a37 Merge pull request #248 from tidalcycles/general-purpose-scheduler
General purpose scheduler
2022-11-06 19:03:19 +01:00
Felix Roos 7d47f5aba3 remove old clockworker + scheduler 2022-11-06 17:35:53 +01:00
Felix Roos 33cb506c71 add vanilla repl link to githack 2022-11-06 16:09:47 +01:00
Felix Roos 5fb36acb04 rebuild with correct base 2022-11-06 16:06:54 +01:00
Felix Roos 5f985f359b add vanilla repl build 2022-11-06 16:03:49 +01:00
Felix Roos 09045d5387 add vite vanilla js repl example 2022-11-06 15:50:53 +01:00
Felix Roos 371af755df move evaluate logic without transpiler to core
+ breaking change: evalScope is now imported from core
+ breaking change: deprecated extend is now removed
+ add repl.mjs
2022-11-06 12:12:43 +01:00
Felix Roos 0485632e22 Merge remote-tracking branch 'origin/main' into general-purpose-scheduler 2022-11-06 11:06:32 +01:00
Felix Roos c3d6de2412 Merge pull request #243 from tidalcycles/shared-tests
snapshot tests on shared snippets
2022-11-06 11:05:23 +01:00
Felix Roos 36d49b11d9 Merge pull request #247 from tidalcycles/some-tunes
added some tunes
2022-11-06 11:03:41 +01:00
Felix Roos 866277510e fix: samples function did not work in tests 2022-11-06 00:44:23 +01:00
Felix Roos da8e00eb4e Merge remote-tracking branch 'origin/main' into some-tunes 2022-11-06 00:38:05 +01:00
Felix Roos cd30b2af3f Merge pull request #246 from tidalcycles/readme-tlc
patchday
2022-11-06 00:37:11 +01:00
Felix Roos 38b3337d35 add amensister 2022-11-06 00:31:59 +01:00
Felix Roos 84d34aa12b update shift packages 2022-11-05 12:09:00 +01:00
Felix Roos 96b7b68900 add scheduled example 2022-11-05 11:34:15 +01:00
Felix Roos 2a6ffbf5a4 update lerna 2022-11-05 11:33:59 +01:00
Felix Roos 1ac99e260b update plugin-react + osc-js 2022-11-05 11:20:53 +01:00
Felix Roos 519062c8d0 update tailwind 2022-11-04 23:03:54 +01:00
Felix Roos 78d7cdf662 update more things 2022-11-04 21:05:24 +01:00
Felix Roos a191b1e811 update vite in repl 2022-11-04 21:01:04 +01:00
Felix Roos b372161874 update vite in react package 2022-11-04 20:58:36 +01:00
Felix Roos 5bbec7b17c package-lock 2022-11-04 20:46:06 +01:00
Felix Roos 54b847a8ef update tailwind + react 2022-11-04 20:45:45 +01:00
Felix Roos a40a0f730f update codemirror 2022-11-04 20:43:16 +01:00
Felix Roos a677b94297 update webmidi + remove tone piano 2022-11-04 20:36:33 +01:00
Felix Roos d102528d0a Merge pull request #244 from tidalcycles/readme-tlc
Readme + TLC
2022-11-04 20:28:22 +01:00
Felix Roos 854692f975 use only node 18 to save some energy 2022-11-04 20:25:31 +01:00
Felix Roos bdc321df4d update browserslist 2022-11-04 20:24:42 +01:00
Felix Roos 230e8e9d4d revert auto formatted snippet 2022-11-04 20:21:08 +01:00
Felix Roos 96c49689ec improve readmes 2022-11-04 20:15:46 +01:00
Felix Roos 698f560d56 export controls from core root 2022-11-04 20:15:36 +01:00
Felix Roos 67ee493e56 remove cross import + code format 2022-11-04 20:15:11 +01:00
Felix Roos 4fc7ef698a code format 2022-11-04 20:14:57 +01:00
Felix Roos 89434fc3bd replace old snippet 2022-11-04 20:14:47 +01:00
Felix Roos 6129f9afe8 fix: mini repl test tune 2022-11-04 20:13:25 +01:00
Felix Roos e5f38dbbc6 dbdump script 2022-11-04 17:30:19 +01:00
Felix Roos 5534db95bc exclude shared test for now 2022-11-03 19:01:23 +01:00
Felix Roos 37c45424fd all shared tests now pass 2022-11-03 18:57:27 +01:00
Felix Roos ed44f4ed0c add shared tunes test 2022-11-03 16:18:29 +01:00
Felix Roos f829f35cfa Merge pull request #242 from tidalcycles/example-tests
in source example tests
2022-11-03 15:16:03 +01:00
Felix Roos 3033acadbb remove log 2022-11-03 14:57:46 +01:00
Felix Roos 5c2a8a68c0 render doc.json before testing 2022-11-03 14:52:24 +01:00
Felix Roos e9544f8f92 test all in source examples 2022-11-03 14:47:27 +01:00
Felix Roos 1a6743dba9 hotfix: #241 2022-11-03 12:52:01 +01:00
Felix Roos 06d6621c14 Merge pull request #240 from tidalcycles/load-samples-from-url
feat: support github: links
2022-11-02 23:16:43 +01:00
Felix Roos d7b82edae3 feat: support github: links 2022-11-02 23:13:00 +01:00
Felix Roos 5eae156134 Merge pull request #239 from tidalcycles/load-samples-from-url
Load samples from url
2022-11-02 21:26:44 +01:00
Felix Roos d8843e6057 refactor prebake 2022-11-02 21:07:47 +01:00
Felix Roos cf7c734778 feat: can now load samples via url 2022-11-02 12:29:34 +01:00
Felix Roos 240a8930ef Merge pull request #238 from tidalcycles/object-arithmetic
Object arithmetic
2022-11-02 11:42:32 +01:00
Felix Roos 4f3046593a fix: test 2022-11-01 21:54:25 +01:00
Felix Roos a0bd5bdd35 simplify asNumber 2022-11-01 21:45:40 +01:00
Felix Roos e3bc63e4fa fix: osc notes 2022-11-01 21:45:25 +01:00
Felix Roos fbf7c6293f get rid of asNumber on arithmetic functions 2022-11-01 21:38:16 +01:00
Felix Roos e128b02da1 support object arithmetic 2022-11-01 21:31:39 +01:00
Felix Roos 2168dbc6fc flat rave 2022-11-01 17:09:18 +01:00
Felix Roos 97db895354 use new bank function 2022-11-01 00:38:38 +01:00
Felix Roos 48fc68bfdb Merge remote-tracking branch 'origin/tidal-drum-machines' into some-tunes 2022-11-01 00:36:53 +01:00
Felix Roos 3741ffbb59 Merge pull request #237 from tidalcycles/tidal-drum-machines
Tidal drum machines
2022-11-01 00:36:14 +01:00
Felix Roos caf58492f2 move sample data to json files 2022-10-31 23:58:12 +01:00
Felix Roos 0c5bdd0205 make bank a normal param 2022-10-31 23:30:50 +01:00
Felix Roos ae6da0d6ef Merge pull request #236 from tidalcycles/fix-mono
fx on stereo speakers
2022-10-31 21:39:23 +01:00
Felix Roos bdbb4cb495 add all drum machines + soundbank helper 2022-10-31 20:55:23 +01:00
Felix Roos 566c358e8d drum demo 2022-10-31 20:35:34 +01:00
Felix Roos 324cffe6df 808 + 909 2022-10-31 20:34:47 +01:00
Felix Roos dadb8119e8 fix: reverb mono 2022-10-31 20:34:07 +01:00
Felix Roos 335d54b5f4 fix: multichannel worklets 2022-10-31 20:33:42 +01:00
Felix Roos 0fd851999f little fluty tune 2022-10-30 20:38:12 +01:00
Felix Roos 50f88798d8 Merge remote-tracking branch 'origin/main' into some-tunes 2022-10-30 19:36:16 +01:00
Felix Roos 8033cfc49d add sample demo tune 2022-10-30 19:36:06 +01:00
Felix Roos 882f450ee8 Merge pull request #235 from tidalcycles/vcsl-samples
add vcsl sample library
2022-10-30 19:10:32 +01:00
Felix Roos 4d60a582fe note default to 36 2022-10-30 18:49:26 +01:00
Felix Roos 7ef3d33d0e add vcsl sample library 2022-10-30 15:52:51 +01:00
Alex McLean 24328ee8ae Fix zero length queries WIP (#234)
* failing tests for zero-width queries

* support zero width timespans in splitArcs. Fixes one test, breaks a load more..

* fix fastGap
2022-10-29 23:23:10 +01:00
Felix Roos d45c380389 add two tunes 2022-10-29 22:19:11 +02:00
Felix Roos fbb3d144a1 hotfix: missing note calls in some tunes 2022-10-29 18:07:46 +02:00
Felix Roos 7e7e299bce Merge remote-tracking branch 'origin/main' into general-purpose-scheduler 2022-10-29 17:56:30 +02:00
Felix Roos d18116fcbe Merge pull request #232 from tidalcycles/out-by-default
Out by default
2022-10-29 17:54:05 +02:00
Felix Roos e38513f077 more fixes 2022-10-29 17:51:46 +02:00
Felix Roos 08c4c641ec add note calls everywhere 2022-10-29 17:38:54 +02:00
Felix Roos 5d7e46b246 started removing primitive haps from tutorial 2022-10-29 14:58:50 +02:00
Felix Roos dac906a79d fix sample name 2022-10-27 21:20:09 +02:00
Felix Roos ecfeac4d63 clearer error 2022-10-27 21:20:01 +02:00
Felix Roos db1fc399a1 add baseDir to prebake + obj params 2022-10-27 21:19:50 +02:00
Felix Roos 60616a5228 remove old defaultSynth 2022-10-27 21:19:17 +02:00
Felix Roos 699c8d5b60 different default adsr for synths and samples 2022-10-27 20:55:12 +02:00
Felix Roos 4264f013af remove webdirt + tone from tutorial
+ do not load webdirt in repl
2022-10-27 20:51:14 +02:00
Felix Roos ecc4e1803c remove all occurrences of .out() 2022-10-27 19:47:07 +02:00
Felix Roos 5c230c2d65 use webaudio output by default 2022-10-27 19:40:00 +02:00
Felix Roos 6af681354b support primitive notes + tame default gain 2022-10-27 19:39:33 +02:00
Alex McLean 5f381cf153 Patternify range (#231)
* patternify range

* patternify range

* fix test
2022-10-26 22:53:49 +01:00
Felix Roos 2ed290a214 Merge pull request #228 from tidalcycles/just-another-docs-branch
Just another docs branch
2022-10-26 21:42:12 +02:00
Felix Roos cf11472348 Merge pull request #230 from tidalcycles/reafactor-tunes
Refactor tunes away from tone
2022-10-26 21:41:12 +02:00
Felix Roos 2c14514c56 update snapshot 2022-10-26 21:37:41 +02:00
Felix Roos 053e6d8325 refactor remaining usages of tone 2022-10-26 21:30:27 +02:00
Felix Roos 603c55fda7 doc: in source value modifiers 2022-10-26 20:29:12 +02:00
MysteryHouse 113adcc5cc Core util tests (#226)
* Error message formatting, deprecate unused functions
* Add 'test-coverage' script
* Additional test coverage for core util module
* Additional tests for core util module

by @mystery-house
2022-10-20 08:26:28 +01:00
Alex McLean a5bf8f6732 fix fastgap for events that go across cycle boundaries (#225) 2022-10-06 21:35:45 +01:00
Felix Roos c4b482634f doc: begin end 2022-09-25 23:35:30 +02:00
Felix Roos 4b083d6f81 add reverb link 2022-09-25 23:23:37 +02:00
Felix Roos 04973d153b doc: legato gain velocity 2022-09-25 22:39:16 +02:00
Felix Roos 69ce7c78a4 doc: euclid + euclidLegato 2022-09-25 22:09:39 +02:00
Felix Roos b64cf197f2 doc: improve chop + loopAt examples 2022-09-25 21:57:56 +02:00
Felix Roos a8b0279853 Merge remote-tracking branch 'origin/main' into reafactor-tunes 2022-09-25 21:18:03 +02:00
Felix Roos e715e2ba2f Merge remote-tracking branch 'origin/main' into general-purpose-scheduler 2022-09-25 21:16:37 +02:00
Felix Roos 985de36647 Merge remote-tracking branch 'origin/main' into just-another-docs-branch 2022-09-25 21:16:05 +02:00
Felix Roos b7b576e38b Merge pull request #224 from tidalcycles/reverb
Reverb
2022-09-25 21:15:36 +02:00
Felix Roos 5018669ded roomsize 2022-09-25 20:08:02 +02:00
Felix Roos c5342d3eb0 snaps 2022-09-25 16:40:50 +02:00
Felix Roos 0e7a0b5754 more tunes 2022-09-25 16:37:10 +02:00
Felix Roos 933ef02df0 really simple reverb 2022-09-25 16:36:59 +02:00
Alex McLean 513e0d748d focus tweak for squeezeJoin - another go at fixing #216 (#221)
Fixes squeezeJoin, and in the process struct/keepif. fixes #216

Co-authored-by: Felix Roos <flix91@gmail.com>
2022-09-24 23:27:25 +01:00
Felix Roos 852f01fddd Merge pull request #222 from tidalcycles/negative-speed
support negative speeds
2022-09-24 23:17:21 +02:00
Felix Roos 9ebada63e9 support negative speeds 2022-09-24 23:14:43 +02:00
Felix Roos dbda70eee9 Merge pull request #213 from tidalcycles/feedbackdelay
Feedback Delay
2022-09-24 21:55:14 +02:00
Felix Roos 18bd10dfed clean up getDelay args 2022-09-24 21:51:55 +02:00
Felix Roos f76d03a0dc delay as global send via orbit 2022-09-24 21:45:23 +02:00
Alex McLean 86ba5c9c1a Merge pull request #220 from tidalcycles/fix-squeezeJoin
Fix squeeze join
2022-09-23 11:06:16 +01:00
alex 5b56fbed97 adjust use of focus in squeezeJoin - fixes #216 2022-09-23 08:00:53 +01:00
alex dfdd918ea0 attempt at fixing #216 2022-09-22 22:52:02 +01:00
Felix Roos df2c7ec1a1 doc: chop + loopAt 2022-09-22 23:20:15 +02:00
Felix Roos 0d179f2042 tutorial is now dark 2022-09-22 23:20:03 +02:00
Felix Roos 63c6a9735c Merge branch 'main' into general-purpose-scheduler 2022-09-22 21:25:44 +02:00
Felix Roos f7e3f7d187 Merge branch 'main' into feedbackdelay 2022-09-22 21:25:12 +02:00
Felix Roos cc54da5980 Merge pull request #219 from tidalcycles/webaudio-output
encapsulate webaudio output
2022-09-22 21:23:11 +02:00
Felix Roos ca82796081 getDestination collides with tone
-> do not export for now (not needed)
-> can be refactored when tone is removed
-> also prevent loading worklets in node
2022-09-22 21:19:44 +02:00
Felix Roos d092068bd2 migrate to encapsulated out 2022-09-22 20:24:59 +02:00
Felix Roos 0c1529237c Merge commit '6dbb2cb98a41edc6ad6b3458a6f7067044cb66cd' into general-purpose-scheduler 2022-09-22 19:54:58 +02:00
Felix Roos 6dbb2cb98a encapsulate out
+ encapsulate destination
+ error handling
to simplify merge scheduler branch
2022-09-22 19:50:07 +02:00
Felix Roos ead763b909 Merge remote-tracking branch 'origin/main' into reafactor-tunes 2022-09-22 19:24:28 +02:00
Felix Roos 415139851e Merge remote-tracking branch 'origin/HEAD' into just-another-docs-branch 2022-09-22 19:22:35 +02:00
Felix Roos 5c99b72e2f Merge remote-tracking branch 'origin/HEAD' into feedbackdelay 2022-09-22 19:22:08 +02:00
Felix Roos 82cb6c93cf Merge pull request #218 from tidalcycles/webdirt-feature-parity
samples now have envelopes
2022-09-22 19:18:18 +02:00
Felix Roos d21734ccf2 update snapshots 2022-09-22 19:15:53 +02:00
Felix Roos 91934006d5 adjust default envelope 2022-09-22 19:09:38 +02:00
Felix Roos 014c258c57 sample adsr support 2022-09-22 15:33:06 +02:00
Felix Roos 5e76bc3f2f Merge pull request #217 from tidalcycles/webdirt-feature-parity
sampler features + fixes
2022-09-22 00:03:30 +02:00
Felix Roos 7f6940f3a5 cut precision 2022-09-21 22:47:16 +02:00
Felix Roos 8d5682deb0 cut + loop 2022-09-21 22:44:56 +02:00
Felix Roos 819abbfa7a fix sample slicing + unit + nudge 2022-09-21 22:25:35 +02:00
Felix Roos 227ad332b8 add missing params to echo 2022-09-19 23:42:04 +02:00
Felix Roos 17c83e1a85 Merge pull request #215 from tidalcycles/just-another-docs-branch
Just another docs PR
2022-09-19 23:32:55 +02:00
Felix Roos 5d699496ca doc: chunk + chunkBack 2022-09-19 23:30:37 +02:00
Felix Roos e4f4fe81ae doc: iterBack 2022-09-19 23:21:55 +02:00
Felix Roos abe28367fb doc: iter 2022-09-19 23:19:39 +02:00
Felix Roos cc394d9f74 doc: echo + echoWith 2022-09-19 23:13:36 +02:00
Felix Roos 476b51ee31 fix deployment permissions 2022-09-19 22:40:04 +02:00
Felix Roos ec823ade14 do everything in one step 2022-09-19 22:35:56 +02:00
Felix Roos 0c3777f7d7 wait for build before deploy 2022-09-19 22:31:41 +02:00
Felix Roos a679e47c0d fix workflow 2022-09-19 22:27:56 +02:00
Felix Roos 1e82735241 rename deploy workflow 2022-09-19 22:26:34 +02:00
Felix Roos a09ec6b0b5 deployment: next try 2022-09-19 22:22:11 +02:00
Felix Roos 0134a50ffa add update button 2022-09-19 22:09:23 +02:00
Felix Roos 1da005e811 deploy after build 2022-09-19 21:58:12 +02:00
Felix Roos 8ab912429b build: npm i inside tutorial 2022-09-19 21:54:34 +02:00
Felix Roos 88d12223a5 build: add npm i in repl folder 2022-09-19 21:52:31 +02:00
Felix Roos 6c363d9c4b add rollup-plugin-visualizer in root pkg 2022-09-19 21:50:38 +02:00
Felix Roos 6d3d9659e2 try build workflow 2022-09-19 21:48:47 +02:00
Felix Roos 8977c5cef4 revert exponential adsr 2022-09-18 22:55:33 +02:00
Felix Roos d3645f6c63 fix tests 2022-09-18 22:42:30 +02:00
Felix Roos dbb057621d refactor caverave + throw out some tunes 2022-09-18 22:40:19 +02:00
Felix Roos 3a65bc0650 improve adsr 2022-09-18 22:39:40 +02:00
Felix Roos 1eb6ff8c17 add feedback delay effect 2022-09-18 21:17:16 +02:00
Felix Roos 505cc01a18 remove empty heading 2022-09-17 23:59:16 +02:00
Felix Roos fdc4bb455f fix: formatting 2022-09-17 23:54:28 +02:00
Felix Roos c1a27aa6e4 Merge pull request #212 from tidalcycles/even-more-docs
Even more docs
2022-09-17 23:47:43 +02:00
Felix Roos a14c7233d4 fix: tests 2022-09-17 23:40:56 +02:00
Felix Roos c786d77b07 make polyrhythm alias of stack #211 2022-09-17 23:38:42 +02:00
Felix Roos e4913dfb73 mark tone + webdirt deprecated
+ add superdirt param list
2022-09-17 23:35:35 +02:00
Felix Roos dfd33bab8e dedupe accumulation modifiers 2022-09-17 23:16:13 +02:00
Felix Roos 19b8f073b1 dedupe most of core api doc 2022-09-17 22:46:30 +02:00
Felix Roos b38b16f70e doc: early, late, each, every, rev + doc structure 2022-09-17 21:45:39 +02:00
Felix Roos dd69e4caff doc: rand irand perlin 2022-09-17 21:03:58 +02:00
Felix Roos 762a17d949 fix: remove TLA 2022-09-17 15:42:34 +02:00
Felix Roos d90cb23f22 Merge pull request #207 from tidalcycles/webaudio-guide
Webaudio guide
2022-09-17 15:36:53 +02:00
Felix Roos 1ccc391c8e proper disconnect onend 2022-09-17 15:32:36 +02:00
Felix Roos cafcead62e doc: web audio effects 2022-09-17 15:18:57 +02:00
Felix Roos 71ca46b21b remove headings for generated doc 2022-09-17 15:18:38 +02:00
Felix Roos acf339ad13 load worklets on startup 2022-09-17 15:18:16 +02:00
Felix Roos de4726ec8d improve sampler section 2022-09-16 23:59:46 +02:00
Felix Roos e58aff41f9 begin webaudio tutorial 2022-09-16 23:25:42 +02:00
Felix Roos 3c8acf9e0e comment out timeout:
it will cut of samples that are longer than hap..
2022-09-16 23:25:33 +02:00
Felix Roos 782e8522c5 add all default samples to mini repl 2022-09-16 23:24:47 +02:00
Felix Roos dd4464cb08 fix build: dont add sourcemaps 2022-09-16 11:05:38 +02:00
Felix Roos 3fdfd12448 hotfix: disconnect chain after use 2022-09-16 00:53:43 +02:00
Felix Roos a11d23ba62 hotfix: out should not be async 2022-09-16 00:30:37 +02:00
Felix Roos 6bab362171 Merge pull request #205 from tidalcycles/coarse-crush-shape
Coarse crush shape
2022-09-16 00:21:28 +02:00
Felix Roos 5d28c5c825 add license info 2022-09-16 00:17:42 +02:00
Felix Roos b9173ebe50 add coarse, crush and shape 2022-09-16 00:14:28 +02:00
Felix Roos 0a1577ff43 refactor kalimba 2022-09-15 21:17:39 +02:00
Felix Roos a616d6fd3e Merge pull request #201 from tidalcycles/vowel
add vowel to .out
2022-09-15 21:04:28 +02:00
Felix Roos 149b2ab9f9 make vowel work with node 2022-09-15 20:11:10 +02:00
Felix Roos 4406dd88d1 add vowel 2022-09-15 20:09:07 +02:00
Felix Roos 48a950faf8 Merge pull request #200 from tidalcycles/build-analyze
add rollup-plugin-visualizer to build
2022-09-15 16:55:52 +02:00
Felix Roos 0ffbb5cb2c ignore stats 2022-09-15 16:54:27 +02:00
Felix Roos f4c31bcf2c Merge pull request #199 from tidalcycles/docs-update
document random functions
2022-09-14 23:46:39 +02:00
Felix Roos f0e412a443 doc: chooseCycles + mini shorthands 2022-09-14 23:40:48 +02:00
Felix Roos ce91d36b7a doc: random functions 2022-09-14 23:16:24 +02:00
Felix Roos a022e5bb93 add missing external deps to react pkg 2022-09-14 21:55:09 +02:00
Felix Roos 8e61673bd6 doc: degradeBy 2022-09-14 21:54:42 +02:00
Felix Roos 88e39d22f1 add drums to mini repl 2022-09-14 21:53:41 +02:00
Felix Roos 1441374f6e Create README.md 2022-09-13 22:45:03 +02:00
Felix Roos d1cedaa3e8 add dependencies graphic
npx depcruise --include-only "^packages" -X "node_modules" --output-type dot packages | dot -T svg > dependencies.svg
2022-09-13 22:40:52 +02:00
Felix Roos 5b721f6453 package-lock 2022-09-10 23:32:33 +02:00
Felix Roos a5f05b4715 hotfix: regression of #196
- samples loaded as arrays would not be repitched
2022-09-10 23:19:23 +02:00
Felix Roos 96f49f117a add build analyzer 2022-09-10 23:04:21 +02:00
Felix Roos 88e1211762 Merge pull request #196 from tidalcycles/fix-numbers-in-sampler
Fix numbers in sampler
2022-09-09 22:04:40 +02:00
Felix Roos 59e1664223 pull in midi logic 2022-09-09 22:02:24 +02:00
Felix Roos 42922a0d75 fix: support numbers in piano / sampler 2022-09-09 21:56:07 +02:00
Felix Roos 4f8a2a0900 another round of scheduling 2022-08-26 23:58:39 +02:00
Felix Roos 9a2a26e904 add a little dot 2022-08-23 21:56:38 +02:00
Felix Roos 067c3433b6 add nano-repl build 2022-08-23 21:55:06 +02:00
Felix Roos d0b07c4890 fix latency issues for larger intervals 2022-08-23 21:52:24 +02:00
Felix Roos 24f8f48a2f nano repl now supports highlighting 2022-08-23 21:24:25 +02:00
Felix Roos acafcc9888 build react pkg 2022-08-23 21:23:44 +02:00
Felix Roos ec4cfe6f86 use new getTime callback in repl + mini repl 2022-08-23 21:23:28 +02:00
Felix Roos 7b0c80c8be getTime callback for highlighting time 2022-08-23 21:23:01 +02:00
Felix Roos 29029714ee expose pattern form useStrudel 2022-08-23 21:22:28 +02:00
Felix Roos cd1203d1e2 fix pause + remove logs 2022-08-23 20:56:09 +02:00
Felix Roos 4dfc34515c fix nano-repl prod build 2022-08-23 18:23:36 +02:00
Felix Roos 11a9f3ced3 no top level await + no evaluate on mount 2022-08-23 18:04:35 +02:00
Felix Roos 5be1a7000c cleanup 2022-08-23 17:56:01 +02:00
Felix Roos 9059c1b850 scheduler is now finally tight 2022-08-23 17:55:10 +02:00
Felix Roos ec60fe42be fix scheduler again.. add comments 2022-08-23 11:30:00 +02:00
Felix Roos 275931969e scheduler error correction failed attempt 2022-08-22 22:15:32 +02:00
Felix Roos e37e0f189a build react package 2022-08-21 11:22:30 +02:00
Felix Roos 8103943396 wait for ctx.resume 2022-08-21 11:21:36 +02:00
Felix Roos 9497c99e9e merge evaluator and scheduler hooks + use getTime 2022-08-21 11:21:19 +02:00
Felix Roos 2172d1a767 scheduler error correction via getTime 2022-08-21 11:20:15 +02:00
Felix Roos e72c47869a comment out stuff that uses tone.js 2022-08-18 20:50:20 +02:00
Felix Roos 5ea2124e91 webaudio error handling 2022-08-18 20:46:42 +02:00
Felix Roos 0c08919bfa add codemirror + keyboard shortcuts 2022-08-18 16:16:23 +02:00
Felix Roos a7562c3803 add useKeydown helper 2022-08-18 16:15:44 +02:00
Felix Roos 5f4d8f6862 add tailwind 2022-08-18 16:15:23 +02:00
Felix Roos 9c7d0951b7 pause action + started flag 2022-08-18 16:13:50 +02:00
Felix Roos 75e57c75cf add master gain + panic 2022-08-18 16:13:27 +02:00
Felix Roos 04502b05d4 better default tune + fix dirty state 2022-08-18 15:16:29 +02:00
Felix Roos e3e3a8404a nano-repl add modules + proper eval 2022-08-18 00:27:16 +02:00
Felix Roos 48bf17614f fix: runtime error reify undefined 2022-08-18 00:26:57 +02:00
Felix Roos 1941b1ff65 add react nano-repl example 2022-08-17 23:59:40 +02:00
Felix Roos 46aa3d275a package-lock 2022-08-17 23:58:47 +02:00
Felix Roos d667e790b9 export new hooks 2022-08-17 23:58:34 +02:00
Felix Roos bc345b569b add hooks for scheduler and evaluator 2022-08-17 23:57:49 +02:00
Felix Roos ee84b4e013 export webaudio out as separate function 2022-08-17 23:56:36 +02:00
Felix Roos e77129fa51 scheduler error callback 2022-08-17 23:55:06 +02:00
Felix Roos 591855919e working default tune 2022-08-17 21:29:57 +02:00
Felix Roos 7af6188a8a move scheduler to core + move audioctx to userland 2022-08-17 21:26:00 +02:00
Felix Roos 1cd31cfce9 fix getFrequency for .note 2022-08-17 21:25:04 +02:00
Felix Roos 227dda921c bump to 0.0.4 2022-08-14 18:06:50 +02:00
Felix Roos bdf2047ea1 add npte for new packages 2022-08-14 18:05:08 +02:00
Felix Roos 0522996b7f bump soundfont package for rerelease 2022-08-14 18:02:06 +02:00
Felix Roos e9e25ef8d8 Publish
- @strudel.cycles/core@0.2.0
 - @strudel.cycles/eval@0.2.0
 - @strudel.cycles/midi@0.2.0
 - @strudel.cycles/mini@0.2.0
 - @strudel.cycles/react@0.2.0
 - @strudel.cycles/soundfonts@0.2.0
 - @strudel.cycles/tonal@0.2.0
 - @strudel.cycles/tone@0.2.0
 - @strudel.cycles/webaudio@0.2.0
 - @strudel.cycles/webdirt@0.2.0
 - @strudel.cycles/xen@0.2.0
2022-08-14 17:56:28 +02:00
Felix Roos a08325c975 add soundfont2 dependency 2022-08-14 17:51:07 +02:00
Felix Roos 4d8adde9d5 Merge pull request #185 from bpow/mini-notation-random-offsets
change "stride"/"offset" of successive degradeBy/chooseIn
2022-08-14 17:40:41 +02:00
Felix Roos f2b2f4f226 Merge pull request #183 from tidalcycles/soundfont-file-support
Soundfont file support
2022-08-14 16:04:14 +02:00
Felix Roos 40bbc57269 Merge pull request #190 from tidalcycles/fix-legacy-frequency
fix regression: old way of setting frequencies was broken
2022-08-14 15:55:50 +02:00
Felix Roos 48526824d6 support old way of setting frequencies 2022-08-14 15:51:01 +02:00
Felix Roos 745c37f2d1 Merge pull request #189 from tidalcycles/fix-188
wait for prebake to finish before evaluating
2022-08-14 15:45:53 +02:00
Felix Roos 0e185b7335 wait for prebake to finish before evaluating 2022-08-14 15:43:17 +02:00
Felix Roos 596ae696f9 Merge branch 'main' into soundfont-file-support 2022-08-14 14:53:53 +02:00
Felix Roos b5e2bdf0f9 Merge pull request #186 from tidalcycles/fix-codemirror-bug
Fix codemirror bug
2022-08-14 11:30:59 +02:00
Felix Roos 4e09cc14b6 fix #178 2022-08-14 11:27:13 +02:00
Bradford Powell 58dc46b445 change "stride"/"offset" of successive degradeBy/chooseIn
This avoids (without fixing) #184).

Note that the offset in tidal is currently 0.0001, but using this
would result in excess correlation between sequential uses of
random, which would manifest in failure of the 'supports the randome
choice operator with nesting' test. So I just used 0.0002 instead
2022-08-13 21:55:17 -04:00
Felix Roos f34d0a29e8 memo all things codemirror 2022-08-13 18:39:38 +02:00
Felix Roos 365a90e72e Merge remote-tracking branch 'origin/main' into soundfont-file-support 2022-08-13 16:31:50 +02:00
Felix Roos 72f4d3efa8 Merge pull request #181 from tidalcycles/optimize-scheduler
scheduler improvements
2022-08-13 16:29:53 +02:00
Felix Roos 98f4d4de8b remove cps-sketch build 2022-08-13 16:28:31 +02:00
Felix Roos 57f84748ec Merge remote-tracking branch 'origin/HEAD' into optimize-scheduler 2022-08-13 16:26:39 +02:00
Felix Roos 4fb57d2818 Merge pull request #175 from tidalcycles/vitest
replace mocha with vitest
2022-08-12 23:10:35 +02:00
Felix Roos aff819069f relative script src 2022-08-12 22:32:37 +02:00
Felix Roos af585588af rebuild example for cps control 2022-08-12 22:30:32 +02:00
Felix Roos eaf6617a43 allow changing cps from a hap 2022-08-12 22:28:19 +02:00
Felix Roos 4b294c4aff build example 2022-08-12 22:03:35 +02:00
Felix Roos c2354bffa2 use phase to allow smooth tempo changes 2022-08-12 22:01:09 +02:00
Felix Roos ea1ffca4ae remove lastEnd 2022-08-12 01:27:01 +02:00
Felix Roos 86a68d78c1 test build 2022-08-12 00:57:36 +02:00
Felix Roos 2e4a3516c8 example: import from modules 2022-08-12 00:53:40 +02:00
Felix Roos e71fec0e95 change theme 2022-08-11 23:15:27 +02:00
Felix Roos 9478915cf4 work on scheduler:
- simplify clockworker (no audioContext)
- tick based scheduler with cps
- support cps in .out
2022-08-11 22:58:37 +02:00
Felix Roos f955d77d71 use vitest snapshot feature for tunes 2022-08-10 00:17:58 +02:00
Felix Roos c1255bfa88 vitest config via file 2022-08-10 00:17:29 +02:00
Felix Roos 9aaeee2026 disable isolate 2022-08-09 23:49:15 +02:00
Felix Roos 27b3a4083b try with isolate + add task for ui 2022-08-09 23:45:33 +02:00
Felix Roos 2f1d963126 dont use beforeAll 2022-08-09 23:45:19 +02:00
Felix Roos 235e82a348 make tests a little bit faster 2022-08-09 23:28:36 +02:00
Felix Roos 17d0b7d291 bump vitest + remove mocha 2022-08-09 23:09:02 +02:00
Felix Roos 22c60fb894 move tunes test to vitest 2022-08-09 23:08:01 +02:00
Felix Roos dc3a873abc extend -> evalScope in runtime 2022-08-09 23:07:41 +02:00
Felix Roos 543d5f0619 test with evalScope instead of extend 2022-08-09 23:07:24 +02:00
Felix Roos 8b088ab6c2 migrate mini test 2022-08-09 23:06:16 +02:00
Felix Roos 29009e14f4 Merge remote-tracking branch 'origin/HEAD' into vitest 2022-08-09 22:08:45 +02:00
Felix Roos bf3e90baf5 add contributor avatars 2022-08-08 22:49:41 +02:00
Felix Roos 3986c407ff cache loaded soundfonts 2022-08-07 23:53:14 +02:00
Felix Roos 8bd56d29d6 add sfumato soundfont player 2022-08-07 21:30:02 +02:00
Felix Roos 467b3db824 handle objects in getPlayableNoteValue 2022-08-07 21:21:44 +02:00
Felix Roos 6025dd6f79 Merge pull request #165 from bpow/randomness
incorporate elements of randomness to the mini notation
2022-08-07 00:59:07 +02:00
Bradford Powell 984f3d2781 add a "tune" and snapshot using the | and ? operators 2022-08-06 18:22:03 -04:00
Bradford Powell 0a558b963d add probabilistic tests for the ? and | mini-notation operators
The tests are probabilistic, so it is possible that if the
pseudo-random number generator changes in the future, we might
get results that fail. They work for the current PRNG, though,
and use boundaries for the number of values of different types
such that there should only be about a 1% probability that the
tests would fail by chance assuming that the PRNG returns
evenly distributed values.
2022-08-06 18:22:03 -04:00
Bradford Powell 1227d98904 add a non-probabilistic test for the ? operator
This really just tests that the ? operator faithfully gets represented
as degradeBy(0.5)
2022-08-06 18:22:03 -04:00
Bradford Powell f533e4a5d0 Change offset for "stateful random" streams
This would no longer match with Tidal (which uses
0.0001), but reduces the correlation among the
the different random streams in the mini-notation's
parsing of ? and |
2022-08-06 18:22:03 -04:00
Bradford Powell 0b00ad98e6 claim victory over the ? and | notations 2022-08-06 18:22:03 -04:00
Bradford Powell 8988408d18 update krill-parser for the changes to .pegjs file 2022-08-06 18:22:02 -04:00
Bradford Powell f858d89f7b implement random choice in mini notation
this will require update to krill-parser.js (aggregated
in later commit) to work properly
2022-08-06 18:22:02 -04:00
Bradford Powell 964ee68974 implement "?" operator in minilanguage (for degradeBy)
this will require update to krill-parser.js (aggregated
in later commit) to work properly
2022-08-06 18:22:02 -04:00
Felix Roos 8244ba7754 hotfix: prebake flag to skip fetch 2022-08-07 00:14:27 +02:00
Felix Roos 21b2184750 Merge pull request #177 from tidalcycles/soft-errors
fix some annoying bugs
2022-08-06 23:32:16 +02:00
Felix Roos 8d1c98f03e always throw error for invalid notes 2022-08-06 21:37:41 +02:00
Felix Roos 684bab99a9 Merge remote-tracking branch 'origin/main' into soft-errors 2022-08-06 21:32:47 +02:00
Felix Roos 7a4a8a4581 run all tests at once 2022-08-06 21:29:36 +02:00
Felix Roos b8843a0eb6 readd mocha dep to root package 2022-08-06 12:32:42 +02:00
Felix Roos 563dfbea43 remove mocha from packages 2022-08-06 12:30:14 +02:00
Felix Roos 488ebf8f1a replace old tests
+ ignore tune test for now
+ add happy-dom
2022-08-06 12:22:11 +02:00
Felix Roos 03158bd689 test tonal tone xen 2022-08-06 11:20:11 +02:00
Felix Roos 765f2df18e vitest eval + mini 2022-08-06 10:48:44 +02:00
Felix Roos a15d8553e0 refactor pattern tests 2022-08-06 01:31:50 +02:00
Felix Roos 3a790b03ac refactor drawLine + fraction test 2022-08-06 00:53:10 +02:00
Felix Roos 90e5e03531 refactor value.test 2022-08-06 00:50:10 +02:00
Felix Roos a4158c16f0 refactor core util.test 2022-08-06 00:47:49 +02:00
Felix Roos ffc0b364ca add vitest 2022-08-06 00:47:36 +02:00
Felix Roos 1efb8f6681 Merge pull request #173 from tidalcycles/replace-react-codemirror
Replace react-codemirror6 with @uiw/react-codemirror
2022-08-06 00:27:16 +02:00
Felix Roos 55b2d7f68f add onSelectionChange callback 2022-08-05 23:50:42 +02:00
Felix Roos 7f0e98ea93 remove old overrides 2022-08-05 23:38:45 +02:00
Felix Roos 67c21c18cf set background to 222 + remove log 2022-08-05 23:23:51 +02:00
Felix Roos 0cd82c7e57 tutorial styles 2022-08-05 23:23:17 +02:00
Felix Roos 1942c36443 fix style import 2022-08-05 23:18:03 +02:00
Felix Roos 93251582ab replace react-codemirror 2022-08-05 23:05:33 +02:00
Felix Roos decd2d6625 fixes #130 + #156 2022-08-05 16:10:37 +02:00
Felix Roos 6824dcb89b Merge pull request #99 from tidalcycles/configurable-shapeshifter
add more shapeshifter flags
2022-08-04 22:19:46 +02:00
Felix Roos eeac075a29 Merge branch 'main' into configurable-shapeshifter 2022-08-04 22:13:52 +02:00
Felix Roos b864b1dec3 Merge pull request #171 from debrisapron/dynamic-import
Amend shapeshifter to allow use of dynamic import
2022-08-04 22:06:38 +02:00
DEBRIS APRON 130fb9c217 Amend shapeshifter to allow use of dynamic import 2022-08-03 17:32:23 -07:00
Felix Roos 688a3d29fd Merge pull request #164 from tidalcycles/talk-fixes
Talk fixes
2022-08-02 23:43:07 +02:00
Felix Roos 800f2f466b darken repl background
+ dont highlight active line
2022-08-02 23:39:07 +02:00
Felix Roos 655a9ff1a4 Merge remote-tracking branch 'origin/HEAD' into talk-fixes 2022-08-02 23:17:02 +02:00
Felix Roos 12f8902c5f Merge pull request #163 from tidalcycles/pianoroll-fixes
Pianoroll fixes
2022-08-02 23:04:34 +02:00
Felix Roos 9cdb1a53f9 Merge pull request #169 from tidalcycles/fix-jsdoc
fix: jsdoc comments
2022-08-02 22:57:43 +02:00
Felix Roos f5efa18e96 fix: jsdoc comments 2022-08-02 22:56:04 +02:00
Alex McLean fcebde5abd Merge pull request #166 from tidalcycles/chooseCycles
add chooseInWith/chooseCycles
2022-07-30 22:51:11 +01:00
alex 7fbd4527e5 chooseInWith, choose2, randcat, and some reformatting 2022-07-30 22:24:26 +01:00
alex d79716c3f8 add chooseInWith/chooseCycles 2022-07-30 09:27:43 +01:00
Felix Roos 884811fd99 darken mini repl bg 2022-07-29 00:19:06 +02:00
Felix Roos 712a2ae018 .out error handling 2022-07-29 00:05:20 +02:00
Felix Roos 4f460eeb32 style errors, fixed backdrop + hide console 2022-07-29 00:03:46 +02:00
Felix Roos 913416a9d5 style fixes + hide-console option
- thicker highlighting outline
- only shade actual characters, not whole lines
- strudel hide-console will now hide console
2022-07-29 00:00:41 +02:00
Felix Roos fd61001b4d getFreq + midi2note helpers 2022-07-28 23:55:17 +02:00
Felix Roos ce4d2c17a7 minirepl optimizations:
- can now evaluate on init
- support disable-highlighting
- support keyboard shortcuts
- support flash
2022-07-28 23:55:05 +02:00
Felix Roos a42ebd7aaf log helpers 2022-07-28 23:46:30 +02:00
Felix Roos f38718004f pianoroll optimizations
- fix flickering due to global alpha mutation
- change default inactive color
- add smear option
- add playheadColor option
2022-07-28 22:27:54 +02:00
Felix Roos 1ddf968750 fix: draw playhead only once 2022-07-28 22:26:14 +02:00
Felix Roos 71dc108b2d Merge pull request #162 from larkob/euclidian
update to tutorial documentation
2022-07-28 19:26:41 +02:00
Lars Kobbe 82728be44b remove edit and pipe function (duplicate of layer and apply) 2022-07-25 22:20:06 +02:00
Lars Kobbe bebfa23cc9 add Euclidian, remove append 2022-07-24 21:20:38 +02:00
Felix Roos 1dad987073 Merge pull request #150 from larkob/prebake-emusp12
add webdirt drum samples to prebake for general availability
2022-07-12 18:58:46 +02:00
Lars Kobbe 6728abf595 added flag for node 16 LTS compatibility 2022-07-12 11:03:15 +02:00
Lars Kobbe 669fce36e9 use fetch instead of import 2022-07-12 09:46:18 +02:00
Lars Kobbe b11003c472 added json assertion 2022-07-12 08:37:21 +02:00
Alex McLean 187f80bfc9 Merge pull request #151 from tidalcycles/paper-update
Final update to demo.pdf
2022-07-12 07:34:16 +01:00
Lars Kobbe 611d216bb0 added EMuSP12 samples to prebake 2022-07-11 23:57:49 +02:00
Felix Roos 8a1cd32d50 Merge pull request #148 from tidalcycles/webaudio-optimizations
Sampler optimizations and more
2022-06-28 21:54:34 +02:00
Felix Roos 2a18b27114 rerun snapshots 2022-06-28 21:51:11 +02:00
Felix Roos 55f91143d9 rename choke -> clip 2022-06-28 21:50:08 +02:00
Felix Roos cf564a7d06 fix tests 2022-06-27 23:52:02 +02:00
Felix Roos b55067ad60 load piano samples locally 2022-06-27 23:32:45 +02:00
Felix Roos a437c698eb style version log + check if already loaded 2022-06-27 23:17:46 +02:00
Felix Roos f8ada70fe7 add tune 2022-06-27 22:40:59 +02:00
Felix Roos 196d9db3fa log core version + add warning to isPattern 2022-06-27 22:40:50 +02:00
Felix Roos e29eaf3785 fix splitSN 2022-06-27 00:57:27 +02:00
Felix Roos 7048ea473f migrate tone piano to own piano 2022-06-27 00:50:24 +02:00
Felix Roos 720b1eeb27 fix soundfonts + samples without base 2022-06-27 00:49:58 +02:00
Felix Roos 4e282dac5b migrate underground plumber 2022-06-27 00:26:29 +02:00
Felix Roos 42343254b1 fix single sampels 2022-06-27 00:26:21 +02:00
Felix Roos e98829c96b tame oscillator gain 2022-06-27 00:26:11 +02:00
Felix Roos 5791f12a28 add prebake script with piano 2022-06-27 00:04:33 +02:00
Felix Roos fe9a6e8fdd draw note property if set 2022-06-27 00:03:26 +02:00
Felix Roos dd3f4e4751 support "s" as "#" alternative inside note names 2022-06-27 00:03:06 +02:00
Felix Roos a89fa766ea support colon sign as normal char 2022-06-27 00:02:33 +02:00
Felix Roos 39c2cf6c72 add build:parser script once more.. 2022-06-27 00:01:59 +02:00
Felix Roos c1ce72469c webaudio optimizations
- samples with obejct format for pitch declaration
- support note to repitch samples
- support choke to fit samples to hap duration
- support "legacy" context.velocity in .out
- support ":" inside s or note to set n
- fix sample fadeout for soundfonts and choke
- move gain before filters
2022-06-27 00:01:28 +02:00
Felix Roos eca76dd7c4 refactor share for build without top level await 2022-06-26 13:05:36 +02:00
Felix Roos 621b2d8fc9 Merge pull request #146 from tidalcycles/share-link
can now generate short link for sharing
2022-06-26 12:58:53 +02:00
Felix Roos 4039b962b4 can now generate short link for sharing 2022-06-26 12:49:29 +02:00
Felix Roos 70cc0b93f0 build 2022-06-25 23:53:31 +02:00
Felix Roos 81e90cd4e4 small fixes 2022-06-25 23:53:27 +02:00
alex 80bd3be0a1 more citations 2022-06-24 22:40:13 +01:00
alex 829a794df7 Merge branch 'paper-update' of github.com:tidalcycles/strudel into paper-update 2022-06-24 22:39:59 +01:00
alex 00997408b8 build 2022-06-24 22:22:56 +01:00
alex 4d3bdfc52f improved ciations 2022-06-24 22:22:44 +01:00
alex b14d0926ed improved ciations 2022-06-24 22:22:28 +01:00
Felix Roos 59b46db8db add sound chapter, trim down future chapter 2022-06-24 23:16:12 +02:00
alex a240284727 paper updates 2022-06-24 21:29:18 +01:00
Felix Roos 3d314324e0 Merge pull request #144 from tidalcycles/flash-effect
flash effect on ctrl enter
2022-06-24 22:16:03 +02:00
Felix Roos b9829bb696 flash effect on ctrl enter 2022-06-24 21:13:17 +02:00
Felix Roos 85f03fb1d0 Merge pull request #142 from tidalcycles/pianoroll-object-support
Pianoroll Object Support
2022-06-22 20:18:17 +02:00
Felix Roos 69810303e5 remove old code 2022-06-22 20:17:12 +02:00
Felix Roos 5b0e31acf3 add tune 2022-06-22 20:13:41 +02:00
alex f0a934e014 Publish
- @strudel.cycles/serial@0.1.3
 - @strudel.cycles/soundfonts@0.1.1
 - @strudel.cycles/webaudio@0.1.4
2022-06-22 13:35:13 +01:00
alex 328e4db1a2 bump 2022-06-21 22:00:08 +01:00
Alex McLean a708265e14 Merge pull request #141 from tidalcycles/serial-twiddles
Serial twiddles
2022-06-21 21:57:27 +01:00
alex a0618f7f47 remove console logging 2022-06-21 21:47:29 +01:00
alex f2bd9fae01 remove hackery 2022-06-21 21:46:23 +01:00
Felix Roos 64f717f81b object support for pianoroll 2022-06-21 22:38:05 +02:00
Felix Roos fd17377c18 Merge pull request #139 from tidalcycles/soundfonts
Soundfont Support
2022-06-21 22:20:04 +02:00
alex 6698fdb6e6 Merge branch 'main' into serial-twiddles 2022-06-21 17:03:02 +01:00
alex e2eab1ee5d Publish
- @strudel.cycles/core@0.1.2
 - @strudel.cycles/eval@0.1.3
 - @strudel.cycles/midi@0.1.3
 - @strudel.cycles/mini@0.1.3
 - @strudel.cycles/react@0.1.4
 - @strudel.cycles/tonal@0.1.3
 - @strudel.cycles/tone@0.1.3
 - @strudel.cycles/webaudio@0.1.3
 - @strudel.cycles/webdirt@0.1.2
 - @strudel.cycles/xen@0.1.3
2022-06-21 16:41:54 +01:00
alex aee9bf7cc2 remove async from serial, default baudrate to 38400 2022-06-21 15:54:18 +01:00
Alex McLean 63d9d554b9 Merge pull request #140 from tidalcycles/fix-createParam
Fix createParam()
2022-06-21 13:11:50 +01:00
alex f6c04f9e74 no need to involve controls[name] 2022-06-21 12:53:00 +01:00
alex e167300194 add created param to controls 2022-06-21 12:15:35 +01:00
Felix Roos 319400ab13 remove unused sf control 2022-06-20 22:20:22 +02:00
Felix Roos 38b1717fac load fonts from forked version 2022-06-20 22:00:14 +02:00
Felix Roos d5938a016c fix looping fonts 2022-06-20 20:55:20 +02:00
Felix Roos 3ac592b18a Publish
- @strudel.cycles/core@0.1.1
 - @strudel.cycles/embed@0.1.1
 - @strudel.cycles/eval@0.1.2
 - @strudel.cycles/midi@0.1.2
 - @strudel.cycles/mini@0.1.2
 - @strudel.cycles/osc@0.1.1
 - @strudel.cycles/react@0.1.3
 - @strudel.cycles/serial@0.1.1
 - @strudel.cycles/tonal@0.1.2
 - @strudel.cycles/tone@0.1.2
 - @strudel.cycles/webaudio@0.1.2
 - @strudel.cycles/webdirt@0.1.1
 - @strudel.cycles/xen@0.1.2
2022-06-20 20:04:21 +02:00
Felix Roos 82d6103907 began soundfont implementation 2022-06-20 20:02:55 +02:00
Felix Roos b353db67d4 began soundfonts package 2022-06-19 15:31:19 +02:00
Felix Roos 5334abebaa hotfix: no sound in ios webkit 2022-06-19 11:50:00 +02:00
Felix Roos ad053361dc Merge pull request #138 from tidalcycles/webaudio-rewrite
Webaudio rewrite
2022-06-18 23:24:41 +02:00
Felix Roos ad62ccd8c7 allow _base prop for samples loader 2022-06-18 23:06:37 +02:00
Felix Roos ecd93c9a92 cache gist by default for faster eval 2022-06-18 23:06:21 +02:00
Felix Roos 774c02afab update tune 2022-06-18 21:44:32 +02:00
Felix Roos 18f1f7d83d simplify url 2022-06-18 18:31:13 +02:00
Felix Roos 9eb3266891 add comments to tune 2022-06-18 18:29:58 +02:00
Felix Roos c3a3a68054 add snapshot 2022-06-18 17:27:57 +02:00
Felix Roos 925fb30e05 fix cracks + add tune 2022-06-18 17:25:36 +02:00
alex 363895761e Merge branch 'main' of github.com:tidalcycles/strudel 2022-06-18 13:19:38 +01:00
alex c191accc64 add top-level chop 2022-06-18 13:19:14 +01:00
Felix Roos 71b6b83ab3 samples: support speed, begin and end 2022-06-18 13:56:41 +02:00
Felix Roos d532f8007e move sampler to webaudio
+ add basic sample playback to .out
2022-06-18 13:11:25 +02:00
Felix Roos 44574af3eb use closures to simplify api 2022-06-18 00:56:58 +02:00
Felix Roos faa4019b27 dont use tone audio context 2022-06-18 00:54:36 +02:00
Felix Roos c1e934d171 regenerate snapshots - update webaudio ones 2022-06-18 00:39:25 +02:00
Felix Roos 5fd88f9213 fix snapshots for objects 2022-06-18 00:38:51 +02:00
Felix Roos 2bb095d47d add controls to tune test 2022-06-17 23:40:38 +02:00
Felix Roos a4a30e8b60 add new tune 2022-06-17 23:26:07 +02:00
Felix Roos 4c05876066 rewrite webaudio + migrate tunes + empty setters 2022-06-17 23:23:51 +02:00
alex 23be3e5ba3 hackery 2022-06-17 14:45:58 +01:00
Felix Roos f69d776cf6 prepare webaudio rewrite 2022-06-16 23:53:29 +02:00
Felix Roos 25795eaecc Merge pull request #136 from tidalcycles/on-trigger
add onTrigger helper
2022-06-16 21:58:37 +02:00
Felix Roos 3e1e92a6f1 add onTrigger helper 2022-06-16 21:01:35 +02:00
Felix Roos f2f3511a2f Merge pull request #134 from tidalcycles/scheduler-improvements
Scheduler improvements
2022-06-16 20:48:23 +02:00
Felix Roos 0ce70f4d0d Merge pull request #135 from tidalcycles/trigger-simplification
remove cycle + delta from onTrigger
2022-06-16 20:48:06 +02:00
Felix Roos cac5d96c16 remove cycle + delta from onTrigger 2022-06-16 20:38:21 +02:00
Felix Roos 25d6ff1c90 can now set latency on the scheduler 2022-06-16 20:37:13 +02:00
Felix Roos 87de8c0800 automatically run onTrigger in scheduler 2022-06-16 20:36:59 +02:00
alex 34ba762b42 funky serialisation for serial 2022-06-16 13:54:53 +01:00
Felix Roos badc4bcc2f Update README.md
remove unused import
2022-06-16 14:11:25 +02:00
Felix Roos 729b4e18ab Update README.md
replace extend with evalScope
2022-06-16 14:10:29 +02:00
alex c3f03f50b3 package locks 2022-06-16 10:30:02 +01:00
alex 8fd4cfe0a3 Merge branch 'main' of github.com:yaxu/strudel into main 2022-06-16 10:17:54 +01:00
alex 8dee07082d add tutorial to setup 2022-06-16 10:17:47 +01:00
Alex McLean 11e33f5c70 Update README.md 2022-06-16 10:10:13 +01:00
Alex McLean 3d68b0c566 Update README.md 2022-06-16 10:10:01 +01:00
Felix Roos ad3a324719 Merge branch 'in-source-doc' into binaries 2022-05-25 21:55:53 +02:00
Felix Roos 8c9e178206 add build script for binaries 2022-05-25 21:24:05 +02:00
Felix Roos 0d325a3ec4 add more shapeshifter flags 2022-04-25 22:52:16 +02:00
568 changed files with 86438 additions and 52397 deletions
+20
View File
@@ -0,0 +1,20 @@
krill-parser.js
krill.pegjs
.eslintrc.json
server.js
tidal-sniffer.js
*.jsx
tunejs.js
out/**
postcss.config.js
postcss.config.cjs
tailwind.config.js
tailwind.config.cjs
vite.config.js
/**/dist/**/*
!**/*.mjs
**/*.tsx
**/*.ts
**/*.json
**/dev-dist
**/dist
+17
View File
@@ -0,0 +1,17 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended"],
"overrides": [],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["import"],
"rules": {
"no-unused-vars": ["warn", { "destructuredArrayIgnorePattern": ".", "ignoreRestSiblings": false }],
"import/no-extraneous-dependencies": ["error", {"devDependencies": true}]
}
}
+49
View File
@@ -0,0 +1,49 @@
name: Build and Deploy
on: [workflow_dispatch]
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
deployments: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"
- name: Install Dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: "./website/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
+62
View File
@@ -0,0 +1,62 @@
name: Tauri Builder
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
release:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
- os: macos-latest
rust_target: x86_64-apple-darwin
- os: macos-latest
rust_target: aarch64-apple-darwin
- os: windows-latest
rust_target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8.6.2
- name: Node.js setup
uses: actions/setup-node@v3
with:
node-version: latest
# node-version-file: '.nvmrc'
- name: Install Rust (Stable)
run:
curl https://sh.rustup.rs -sSf | sh -s -- -y
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Install app dependencies from lockfile and build web
run: pnpm install
- name: Build the app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# tauri-action replaces \_\_VERSION\_\_ with the app version
tagName: ${{ github.ref_name }}
releaseName: "Strudel v__VERSION__"
releaseBody: |
See the assets to download this version and install.
releaseDraft: true
prerelease: false
+13 -8
View File
@@ -7,13 +7,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 17]
node-version: [18]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm test
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 7
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run format-check
- run: pnpm run lint
- run: pnpm test
+10 -1
View File
@@ -34,4 +34,13 @@ repl_old
tutorial.rendered.mdx
doc.json
talk/public/EmuSP12
talk/public/samples
talk/public/samples
server/samples/old
repl/stats.html
coverage
public/icons/apple-splash-*
dev-dist
Dirt-Samples
tidal-drum-machines
webaudiofontdata
src-tauri/target
+12
View File
@@ -0,0 +1,12 @@
*.md
*.json
*.yml
*.
**/out
**/dist
packages/mini/krill-parser.js
packages/xen/tunejs.js
paper
pnpm-lock.yaml
pnpm-workspace.yaml
**/dev-dist
+14 -15
View File
@@ -1,16 +1,15 @@
{
"printWidth": 120,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}
"printWidth": 120,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"endOfLine": "lf"
}
+5 -1
View File
@@ -2,5 +2,9 @@
"cSpell.words": [
"subspan",
"vals"
]
],
"yaml.schemas": {
"https://json.schemastore.org/github-workflow.json": "file:///home/felix/projects/strudel/.github/workflows/deploy.yml"
},
"testing.automaticallyOpenPeekView": "never"
}
+61 -25
View File
@@ -12,8 +12,8 @@ To get in touch with the contributors, either
## Ask a Question
If you have any questions about strudel, make sure you've read the
[tutorial](https://strudel.tidalcycles.org/tutorial/) to find out if it answers your question.
If you have any questions about strudel, make sure you've glanced through the
[docs](https://strudel.tidalcycles.org/learn/) to find out if it answers your question.
If not, use one of the Communication Channels above!
Don't be afraid to ask! Your question might be of great value for other people too.
@@ -29,13 +29,10 @@ If you made some music with strudel, you can give back some love and share what
Your creation could also be part of the random selection in the REPL if you want.
Use one of the Communication Channels listed above.
## Improve the Tutorial
## Improve the Docs
If you find some weak spots in the [tutorial](https://strudel.tidalcycles.org/),
you are welcome to improve them by editing [this file](https://github.com/tidalcycles/strudel/blob/main/tutorial/tutorial.mdx).
This will even work without setting up a development environment, only a github account is required.
If you find some weak spots in the [docs](https://strudel.tidalcycles.org/workshop/getting-started/),
you can edit each file directly on github via the "Edit this page" link located in the right sidebar.
## Propose a Feature
@@ -52,40 +49,43 @@ Please check that it has not been reported before.
To fix a bug that has been reported,
1. check that nobody else is already fixing it and respond to the issue to let people know you're on it
3. fork the repository
4. make sure you've setup the project (see below)
5. hopefully fix the bug
6. make sure the tests pass
7. send a pull request
2. fork the repository
3. make sure you've setup the project (see below)
4. hopefully fix the bug
5. make sure the tests pass
6. send a pull request
## Write Tests
There are still many tests that have not been written yet! Reading and writing tests is a great opportunity to get familiar with the codebase.
You can find the tests in each package in the `test` folder. To run all tests, run `npm test` from the root folder.
You can find the tests in each package in the `test` folder. To run all tests, run `pnpm test` from the root folder.
## Project Setup
To get the project up and running for development, make sure you have installed:
- git
- node, preferably v16
- [git](https://git-scm.com/)
- [node](https://nodejs.org/en/) >= 18
- [pnpm](https://pnpm.io/) (`npm i pnpm -g`)
then, do the following:
```sh
git clone https://github.com/tidalcycles/strudel.git && cd strudel
npm i # install at root to symlink packages
npx lerna bootstrap # install all dependencies in packages
cd repl && npm i # install repl dependencies
npm run start # start repl
pnpm i # install at root to symlink packages
pnpm start # start repl
```
Those commands might look slightly different for your OS.
Those commands might look slightly different for your OS.
Please report any problems you've had with the setup instructions!
## Code Style
To make sure the code changes only where it should, we are using prettier to unify the code style.
- You can format all files at once by running `pnpm prettier` from the project root
- Run `pnpm format-check` from the project root to check if all files are well formatted
If you use VSCode, you can
1. install [the prettier extension](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
@@ -93,19 +93,55 @@ If you use VSCode, you can
3. Choose "Configure Default Formatter..."
4. Select prettier
## ESLint
To prevent unwanted runtime errors, this project uses [eslint](https://eslint.org/).
- You can check for lint errors by running `pnpm lint`
There are also eslint extensions / plugins for most editors.
## Running Tests
- Run all tests with `pnpm test`
- Run all tests with UI using `pnpm test-ui`
## Running all CI Checks
When opening a PR, the CI runner will automatically check the code style and eslint, as well as run all tests.
You can run the same check with `pnpm check`
## Package Workflow
The project is split into multiple [packages](https://github.com/tidalcycles/strudel/tree/main/packages) with independent versioning.
When you run `npm i` on the root folder, [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) will symlink all packages
in the `node_modules` folder. This will allow any js file to import `@strudel.cycles/<package-name>` to get the local version,
which allows developing multiple packages at the same time
When you run `pnpm i` on the root folder, [pnpm workspaces](https://pnpm.io/workspaces) will install all dependencies of all subpackages. This will allow any js file to import `@strudel.cycles/<package-name>` to get the local version,
allowing to develop multiple packages at the same time.
## Package Publishing
To publish all packages that have been changed since the last release, run:
```sh
npx lerna publish
npm login
# this will increment all the versions in package.json files of non private packages to selected versions
npx lerna version --no-private
# publish all packages inside /packages using pnpm! don't use lerna to publish!!
pnpm --filter "./packages/**" publish --dry-run
# the last command was only a dry-run, make sure everything looks ok, if yes, run the same command without flag
```
To manually publish a single package, increase the version in the `package.json`, then run `pnpm publish`.
Important: Always publish with `pnpm`, as `npm` does not support overriding main files in `publishConfig`, which is done in all the packages.
### New Packages
To add a new package, you have to publish it manually the first time, using:
```sh
cd packages/<package-name> && pnpm publish --access public
```
## Have Fun
+11 -4
View File
@@ -2,19 +2,20 @@
[![Strudel test status](https://github.com/tidalcycles/strudel/actions/workflows/test.yml/badge.svg)](https://github.com/tidalcycles/strudel/actions)
An experiment in making a [Tidal](https://github.com/tidalcycles/tidal/) using web technologies. This is unstable software, please tread carefully.
An experiment in making a [Tidal](https://github.com/tidalcycles/tidal/) using web technologies. This software is slowly stabilising, but please continue to tread carefully.
- Try it here: <https://strudel.tidalcycles.org/>
- Tutorial: <https://strudel.tidalcycles.org/tutorial/>
- Docs: <https://strudel.tidalcycles.org/learn/>
- Technical Blog Post: <https://loophole-letters.vercel.app/strudel>
- 1 Year of Strudel Blog Post: <https://loophole-letters.vercel.app/strudel1year>
## Running Locally
After cloning the project, you can run the REPL locally:
```bash
npm run setup
npm run repl
pnpm run setup
pnpm run repl
```
## Using Strudel In Your Project
@@ -38,6 +39,12 @@ Click on the package names to find out more about each one.
There are many ways to contribute to this project! See [contribution guide](./CONTRIBUTING.md).
<a href="https://github.com/tidalcycles/strudel/graphs/contributors">
<img src="https://contrib.rocks/image?repo=tidalcycles/strudel" />
</a>
Made with [contrib.rocks](https://contrib.rocks).
## Community
There is a #strudel channel on the TidalCycles discord: <https://discord.com/invite/HGEdXmRkzT>
+1806
View File
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 150 KiB

+17
View File
@@ -0,0 +1,17 @@
// this barrel export is currently only used to find undocumented exports
export * from './packages/core/index.mjs';
export * from './packages/csound/index.mjs';
export * from './packages/embed/index.mjs';
export * from './packages/eval/index.mjs';
export * from './packages/midi/index.mjs';
export * from './packages/mini/index.mjs';
export * from './packages/osc/index.mjs';
export * from './packages/react/index.mjs';
export * from './packages/serial/index.mjs';
export * from './packages/soundfonts/index.mjs';
export * from './packages/tonal/index.mjs';
export * from './packages/tone/index.mjs';
export * from './packages/transpiler/index.mjs';
export * from './packages/webaudio/index.mjs';
export * from './packages/webdirt/index.mjs';
export * from './packages/xen/index.mjs';
+1 -1
View File
@@ -1,7 +1,7 @@
{
"source": {
"includePattern": ".+\\.(js(doc|x)?|mjs)$",
"excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser"
"excludePattern": "node_modules|shift-parser|shift-reducer|shift-traverser|dist"
},
"plugins": ["plugins/markdown"],
"opts": {
+3 -1
View File
@@ -2,5 +2,7 @@
"packages": [
"packages/*"
],
"version": "independent"
"version": "independent",
"npmClient": "pnpm",
"useWorkspaces": true
}
+59
View File
@@ -0,0 +1,59 @@
# my-patterns
This directory can be used to save your own patterns, which then get
made into a pattern swatch.
Example: <https://felixroos.github.io/strudel/swatch/>
## deploy
### 1. fork the [strudel repo on github](https://github.com/tidalcycles/strudel.git)
### 2. clone your fork to your machine `git clone https://github.com/<your-username>/strudel.git strudel && cd strudel`
### 3. create a separate branch like `git branch patternuary && git checkout patternuary`
### 4. save one or more .txt files in the my-patterns folder
### 5. edit `website/public/CNAME` to contain `<your-username>.github.io/strudel`
### 6. edit `website/astro.config.mjs` to use site: `https://<your-username>.github.io` and base `/strudel`, like this
```js
const site = 'https://<your-username>.github.io';
const base = '/strudel';
```
### 7. commit & push the changes
```sh
git add . && git commit -m "site config" && git push --set-upstream origin
```
### 8. deploy to github pages
- go to settings -> pages and select "Github Actions" as source
- go to settings -> environments -> github-pages and press the edit button next to `main` and type in `patternuary` (under "Deployment branches")
- go to Actions -> `Build and Deploy` and click `Run workflow` with branch `patternuary`
### 9. view your patterns at `<your-username>.github.io/strudel/swatch/`
Alternatively, github pages allows you to use a custom domain, like https://mycooldomain.org/swatch/. [See their documentation for details](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site).
### 10. optional: automatic deployment
If you want to automatically deploy your site on push, go to `deploy.yml` and change `workflow_dispatch` to `push`.
## running locally
- install dependencies with `npm run setup`
- run dev server with `npm run repl` and open `http://localhost:3000/strudel/swatch/`
## tests fail?
Your tests might fail if the code does not follow prettiers format.
In that case, run `npm run codeformat`. To disable that, remove `npm run format-check` from `test.yml`
## updating your fork
To update your fork, you can pull the main branch and merge it into your `patternuary` branch.
-20366
View File
File diff suppressed because it is too large Load Diff
+42 -17
View File
@@ -1,23 +1,32 @@
{
"name": "@strudel.cycles/monorepo",
"version": "0.0.1",
"version": "0.5.0",
"private": true,
"description": "Port of tidalcycles to javascript",
"scripts": {
"test": "npm run test --workspaces --if-present && cd repl && npm run test",
"bootstrap": "lerna bootstrap",
"setup": "npm i && npm run bootstrap && cd repl && npm i",
"repl": "cd repl && npm run dev",
"setup": "pnpm i",
"pretest": "npm run jsdoc-json",
"prebuild": "npm run jsdoc-json",
"prestart": "npm run jsdoc-json",
"test": "npm run pretest && vitest run --version",
"test-ui": "npm run pretest && vitest --ui",
"test-coverage": "npm run pretest && vitest --coverage",
"snapshot": "npm run pretest && vitest run -u --silent",
"repl": "npm run prestart && cd website && npm run dev",
"start": "npm run prestart && cd website && npm run dev",
"dev": "npm run prestart && cd website && npm run dev",
"build": "npm run prebuild && cd website && npm run build",
"preview": "cd website && npm run preview",
"osc": "cd packages/osc && npm run server",
"build": "rm -rf out && cd repl && npm run build && cd ../tutorial && npm run build",
"preview": "npx serve ./out",
"deploy": "gh-pages -d out",
"jsdoc": "jsdoc packages/ -c jsdoc.config.json",
"jsdoc-json": "jsdoc packages/ --template ./node_modules/jsdoc-json --destination doc.json -c jsdoc.config.json"
"jsdoc-json": "jsdoc packages/ --template ./node_modules/jsdoc-json --destination doc.json -c jsdoc.config.json",
"lint": "eslint . --ext mjs,js --quiet",
"codeformat": "prettier --write .",
"format-check": "prettier --check .",
"report-undocumented": "npm run jsdoc-json && node undocumented.mjs > undocumented.json",
"check": "npm run format-check && npm run lint && npm run test",
"iclc": "cd paper && pandoc --template=pandoc/iclc.html --citeproc --number-sections iclc2023.md -o iclc2023.html && pandoc --template=pandoc/iclc.latex --citeproc --number-sections iclc2023.md -o iclc2023.pdf"
},
"workspaces": [
"packages/*"
],
"repository": {
"type": "git",
"url": "git+https://github.com/tidalcycles/strudel.git"
@@ -35,13 +44,29 @@
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://strudel.tidalcycles.org",
"dependencies": {
"@strudel.cycles/core": "workspace:*",
"@strudel.cycles/mini": "workspace:*",
"@strudel.cycles/tonal": "workspace:*",
"@strudel.cycles/transpiler": "workspace:*",
"@strudel.cycles/webaudio": "workspace:*",
"@strudel.cycles/xen": "workspace:*",
"acorn": "^8.8.1",
"dependency-tree": "^9.0.0"
},
"devDependencies": {
"@tauri-apps/cli": "^1.4.0",
"@vitest/ui": "^0.28.0",
"canvas": "^2.11.2",
"eslint": "^8.39.0",
"eslint-plugin-import": "^2.27.5",
"events": "^3.3.0",
"gh-pages": "^4.0.0",
"jsdoc": "^3.6.10",
"jsdoc": "^4.0.2",
"jsdoc-json": "^2.0.2",
"jsdoc-to-markdown": "^7.1.1",
"lerna": "^4.0.0",
"mocha": "^9.1.4"
"jsdoc-to-markdown": "^8.0.0",
"lerna": "^6.6.1",
"prettier": "^2.8.8",
"rollup-plugin-visualizer": "^5.8.1",
"vitest": "^0.28.0"
}
}
+15
View File
@@ -0,0 +1,15 @@
# Packages
Each folder represents one of the @strudel.cycles/* packages [published to npm](https://www.npmjs.com/org/strudel.cycles).
To understand how those pieces connect, refer to the [Technical Manual](https://github.com/tidalcycles/strudel/wiki/Technical-Manual) or the individual READMEs.
This is a graphical view of all the packages: [full screen](https://raw.githubusercontent.com/tidalcycles/strudel/main/dependencies.svg)
![dependencies](https://raw.githubusercontent.com/tidalcycles/strudel/main/dependencies.svg)
Generated with
```sh
npx depcruise --include-only "^packages" -X "node_modules" --output-type dot packages | dot -T svg > dependencygraph.svg
```
+3
View File
@@ -0,0 +1,3 @@
# @strudel/codemirror
This package contains helpers and extensions to use codemirror6. See [vite-vanilla-repl-cm6](../core/examples/vite-vanilla-repl-cm6/main.js) as an example of using it.
+199
View File
@@ -0,0 +1,199 @@
import { EditorState } from '@codemirror/state';
import { EditorView, keymap, Decoration, lineNumbers, highlightActiveLineGutter } from '@codemirror/view';
import { defaultKeymap } from '@codemirror/commands';
import { syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
import { javascript } from '@codemirror/lang-javascript';
import { StateField, StateEffect } from '@codemirror/state';
import { oneDark } from './themes/one-dark';
import { repl, Drawer } from '@strudel.cycles/core';
// https://codemirror.net/docs/guide/
export function initEditor({ initialCode = '', onChange, onEvaluate, onStop, theme = oneDark, root }) {
let state = EditorState.create({
doc: initialCode,
extensions: [
theme,
javascript(),
lineNumbers(),
highlightField,
highlightActiveLineGutter(),
syntaxHighlighting(defaultHighlightStyle),
keymap.of(defaultKeymap),
flashField,
EditorView.updateListener.of((v) => onChange(v)),
keymap.of([
{
key: 'Ctrl-Enter',
run: () => onEvaluate(),
},
{
key: 'Ctrl-.',
run: () => onStop(),
},
]),
],
});
return new EditorView({
state,
parent: root,
});
}
//
// highlighting
//
export const setHighlights = StateEffect.define();
export const highlightField = StateField.define({
create() {
return Decoration.none;
},
update(highlights, tr) {
try {
for (let e of tr.effects) {
if (e.is(setHighlights)) {
const { haps } = e.value;
const marks =
haps
.map((hap) =>
(hap.context.locations || []).map(({ start, end }) => {
// const color = hap.context.color || e.value.color || '#FFCA28';
let from = tr.newDoc.line(start.line).from + start.column;
let to = tr.newDoc.line(end.line).from + end.column;
const l = tr.newDoc.length;
if (from > l || to > l) {
return; // dont mark outside of range, as it will throw an error
}
const mark = Decoration.mark({
attributes: { style: `outline: 2px solid #FFCA28;` },
});
return mark.range(from, to);
}),
)
.flat()
.filter(Boolean) || [];
highlights = Decoration.set(marks, true);
}
}
return highlights;
} catch (err) {
// console.warn('highlighting error', err);
return Decoration.set([]);
}
},
provide: (f) => EditorView.decorations.from(f),
});
// helper to simply trigger highlighting for given haps
export function highlightHaps(view, haps) {
view.dispatch({ effects: setHighlights.of({ haps }) });
}
//
// flash
//
export const setFlash = StateEffect.define();
const flashField = StateField.define({
create() {
return Decoration.none;
},
update(flash, tr) {
try {
for (let e of tr.effects) {
if (e.is(setFlash)) {
if (e.value) {
const mark = Decoration.mark({ attributes: { style: `background-color: #FFCA2880` } });
flash = Decoration.set([mark.range(0, tr.newDoc.length)]);
} else {
flash = Decoration.set([]);
}
}
}
return flash;
} catch (err) {
console.warn('flash error', err);
return flash;
}
},
provide: (f) => EditorView.decorations.from(f),
});
export const flash = (view, ms = 200) => {
view.dispatch({ effects: setFlash.of(true) });
setTimeout(() => {
view.dispatch({ effects: setFlash.of(false) });
}, ms);
};
export class StrudelMirror {
constructor(options) {
const { root, initialCode = '', onDraw, drawTime = [-2, 2], prebake, ...replOptions } = options;
this.code = initialCode;
this.drawer = new Drawer((haps, time) => {
const currentFrame = haps.filter((hap) => time >= hap.whole.begin && time <= hap.endClipped);
this.highlight(currentFrame);
onDraw?.(haps, time, currentFrame);
}, drawTime);
const prebaked = prebake();
prebaked.then(async () => {
if (!onDraw) {
return;
}
const { scheduler, evaluate } = await this.repl;
// draw first frame instantly
prebaked.then(async () => {
await evaluate(this.code, false);
this.drawer.invalidate(scheduler);
onDraw?.(this.drawer.visibleHaps, 0, []);
});
});
this.repl = repl({
...replOptions,
onToggle: async (started) => {
replOptions?.onToggle?.(started);
const { scheduler } = await this.repl;
if (started) {
this.drawer.start(scheduler);
} else {
this.drawer.stop();
}
},
beforeEval: async () => {
await prebaked;
},
afterEval: (options) => {
replOptions?.afterEval?.(options);
this.drawer.invalidate();
},
});
this.editor = initEditor({
root,
initialCode,
onChange: (v) => {
this.code = v.state.doc.toString();
},
onEvaluate: () => this.evaluate(),
onStop: () => this.stop(),
});
}
async evaluate() {
const { evaluate } = await this.repl;
this.flash();
await evaluate(this.code);
}
async stop() {
const { scheduler } = await this.repl;
scheduler.stop();
}
flash(ms) {
flash(this.editor, ms);
}
highlight(haps) {
highlightHaps(this.editor, haps);
}
}
+47
View File
@@ -0,0 +1,47 @@
{
"name": "@strudel/codemirror",
"version": "0.8.4",
"description": "Codemirror Extensions for Strudel",
"main": "codemirror.mjs",
"publishConfig": {
"main": "dist/index.js",
"module": "dist/index.mjs"
},
"scripts": {
"build": "vite build",
"prepublishOnly": "npm run build"
},
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/tidalcycles/strudel.git"
},
"keywords": [
"tidalcycles",
"strudel",
"pattern",
"livecoding",
"algorave"
],
"author": "Felix Roos <flix91@gmail.com>",
"contributors": [
"Alex McLean <alex@slab.org>"
],
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@codemirror/commands": "^6.2.4",
"@codemirror/lang-javascript": "^6.1.7",
"@codemirror/language": "^6.6.0",
"@codemirror/state": "^6.2.0",
"@codemirror/view": "^6.10.0",
"@lezer/highlight": "^1.1.4",
"@strudel.cycles/core": "workspace:*"
},
"devDependencies": {
"vite": "^4.3.3"
}
}
+139
View File
@@ -0,0 +1,139 @@
import { EditorView } from '@codemirror/view';
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
import { tags as t } from '@lezer/highlight';
// Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
const chalky = '#e5c07b',
coral = '#e06c75',
cyan = '#56b6c2',
invalid = '#ffffff',
ivory = '#abb2bf',
stone = '#7d8799', // Brightened compared to original to increase contrast
malibu = '#61afef',
sage = '#98c379',
whiskey = '#d19a66',
violet = '#c678dd',
darkBackground = '#21252b',
highlightBackground = '#2c313a',
background = '#282c34',
tooltipBackground = '#353a42',
selection = '#3E4451',
cursor = '#528bff';
/// The colors used in the theme, as CSS color strings.
export const color = {
chalky,
coral,
cyan,
invalid,
ivory,
stone,
malibu,
sage,
whiskey,
violet,
darkBackground,
highlightBackground,
background,
tooltipBackground,
selection,
cursor,
};
/// The editor theme styles for One Dark.
export const oneDarkTheme = EditorView.theme(
{
'&': {
color: ivory,
backgroundColor: background,
},
'.cm-content': {
caretColor: cursor,
},
'.cm-cursor, .cm-dropCursor': { borderLeftColor: cursor },
'&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection':
{ backgroundColor: selection },
'.cm-panels': { backgroundColor: darkBackground, color: ivory },
'.cm-panels.cm-panels-top': { borderBottom: '2px solid black' },
'.cm-panels.cm-panels-bottom': { borderTop: '2px solid black' },
'.cm-searchMatch': {
backgroundColor: '#72a1ff59',
outline: '1px solid #457dff',
},
'.cm-searchMatch.cm-searchMatch-selected': {
backgroundColor: '#6199ff2f',
},
'.cm-activeLine': { backgroundColor: '#6699ff0b' },
'.cm-selectionMatch': { backgroundColor: '#aafe661a' },
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
backgroundColor: '#bad0f847',
},
'.cm-gutters': {
backgroundColor: background,
color: stone,
border: 'none',
},
'.cm-activeLineGutter': {
backgroundColor: highlightBackground,
},
'.cm-foldPlaceholder': {
backgroundColor: 'transparent',
border: 'none',
color: '#ddd',
},
'.cm-tooltip': {
border: 'none',
backgroundColor: tooltipBackground,
},
'.cm-tooltip .cm-tooltip-arrow:before': {
borderTopColor: 'transparent',
borderBottomColor: 'transparent',
},
'.cm-tooltip .cm-tooltip-arrow:after': {
borderTopColor: tooltipBackground,
borderBottomColor: tooltipBackground,
},
'.cm-tooltip-autocomplete': {
'& > ul > li[aria-selected]': {
backgroundColor: highlightBackground,
color: ivory,
},
},
},
{ dark: true },
);
/// The highlighting style for code in the One Dark theme.
export const oneDarkHighlightStyle = HighlightStyle.define([
{ tag: t.keyword, color: violet },
{ tag: [t.name, t.deleted, t.character, t.propertyName, t.macroName], color: coral },
{ tag: [t.function(t.variableName), t.labelName], color: malibu },
{ tag: [t.color, t.constant(t.name), t.standard(t.name)], color: whiskey },
{ tag: [t.definition(t.name), t.separator], color: ivory },
{ tag: [t.typeName, t.className, t.number, t.changed, t.annotation, t.modifier, t.self, t.namespace], color: chalky },
{ tag: [t.operator, t.operatorKeyword, t.url, t.escape, t.regexp, t.link, t.special(t.string)], color: cyan },
{ tag: [t.meta, t.comment], color: stone },
{ tag: t.strong, fontWeight: 'bold' },
{ tag: t.emphasis, fontStyle: 'italic' },
{ tag: t.strikethrough, textDecoration: 'line-through' },
{ tag: t.link, color: stone, textDecoration: 'underline' },
{ tag: t.heading, fontWeight: 'bold', color: coral },
{ tag: [t.atom, t.bool, t.special(t.variableName)], color: whiskey },
{ tag: [t.processingInstruction, t.string, t.inserted], color: sage },
{ tag: t.invalid, color: invalid },
]);
/// Extension to enable the One Dark theme (both the editor theme and
/// the highlight style).
export const oneDark = [oneDarkTheme, syntaxHighlighting(oneDarkHighlightStyle)];
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import { dependencies } from './package.json';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [],
build: {
lib: {
entry: resolve(__dirname, 'codemirror.mjs'),
formats: ['es', 'cjs'],
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]),
},
rollupOptions: {
external: [...Object.keys(dependencies)],
},
target: 'esnext',
},
});
+1
View File
@@ -0,0 +1 @@
examples
+4 -3
View File
@@ -33,6 +33,7 @@ b: 3/2 - 7/4
c: 7/4 - 2
```
- [play with @strudel.cycles/core on codesandbox](https://codesandbox.io/s/strudel-core-test-qmz6qr?file=/src/index.js).
- [open color pattern example](https://raw.githack.com/tidalcycles/strudel/package-examples/packages/core/examples/canvas.html)
- [open minimal repl example](https://raw.githack.com/tidalcycles/strudel/package-examples/packages/core/examples/metro.html)
- [play with @strudel.cycles/core on codesandbox](https://codesandbox.io/s/strudel-core-test-forked-9ywhv7?file=/src/index.js).
- [open color pattern example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/canvas.html)
- [open minimal repl example](https://raw.githack.com/tidalcycles/strudel/main/packages/core/examples/vanilla.html)
- [open minimal vite example](./examples/vite-vanilla-repl/)
+68
View File
@@ -0,0 +1,68 @@
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;
let clearColor = '#22222210';
Pattern.prototype.animate = function ({ callback, sync = false, smear = 0.5 } = {}) {
window.frame && cancelAnimationFrame(window.frame);
const ctx = getDrawContext();
const { clientWidth: ww, clientHeight: wh } = ctx.canvas;
let smearPart = smear === 0 ? '99' : Number((1 - smear) * 100).toFixed(0);
smearPart = smearPart.length === 1 ? `0${smearPart}` : smearPart;
clearColor = `#200010${smearPart}`;
const render = (t) => {
let frame;
/* if (sync) {
t = scheduler.now();
frame = this.queryArc(t, t);
} else { */
t = Math.round(t);
frame = this.slow(1000).queryArc(t, t);
// }
ctx.fillStyle = clearColor;
ctx.fillRect(0, 0, ww, wh);
frame.forEach((f) => {
let { x, y, w, h, s, r, angle = 0, fill = 'darkseagreen' } = f.value;
w *= ww;
h *= wh;
if (r !== undefined && angle !== undefined) {
const radians = angle * 2 * Math.PI;
const [cx, cy] = [(ww - w) / 2, (wh - h) / 2];
x = cx + Math.cos(radians) * r * cx;
y = cy + Math.sin(radians) * r * cy;
} else {
x *= ww - w;
y *= wh - h;
}
const val = { ...f.value, x, y, w, h };
ctx.fillStyle = fill;
if (s === 'rect') {
ctx.fillRect(x, y, w, h);
} else if (s === 'ellipse') {
ctx.beginPath();
ctx.ellipse(x + w / 2, y + h / 2, w / 2, h / 2, 0, 0, 2 * Math.PI);
ctx.fill();
}
callback && callback(ctx, val, f);
});
window.frame = requestAnimationFrame(render);
};
window.frame = requestAnimationFrame(render);
return silence;
};
export const { x, y, w, h, angle, r, fill, smear } = createParams('x', 'y', 'w', 'h', 'angle', 'r', 'fill', 'smear');
export const rescale = register('rescale', function (f, pat) {
return pat.mul(x(f).w(f).y(f).h(f));
});
export const moveXY = register('moveXY', function (dx, dy, pat) {
return pat.add(x(dx).y(dy));
});
export const zoomIn = register('zoomIn', function (f, pat) {
const d = pure(1).sub(f).div(2);
return pat.rescale(f).move(d, d);
});
+175
View File
@@ -0,0 +1,175 @@
export const colorMap = {
aliceblue: '#f0f8ff',
antiquewhite: '#faebd7',
aqua: '#00ffff',
aquamarine: '#7fffd4',
azure: '#f0ffff',
beige: '#f5f5dc',
bisque: '#ffe4c4',
black: '#000000',
blanchedalmond: '#ffebcd',
blue: '#0000ff',
blueviolet: '#8a2be2',
brown: '#a52a2a',
burlywood: '#deb887',
cadetblue: '#5f9ea0',
chartreuse: '#7fff00',
chocolate: '#d2691e',
coral: '#ff7f50',
cornflowerblue: '#6495ed',
cornsilk: '#fff8dc',
crimson: '#dc143c',
cyan: '#00ffff',
darkblue: '#00008b',
darkcyan: '#008b8b',
darkgoldenrod: '#b8860b',
darkgray: '#a9a9a9',
darkgreen: '#006400',
darkgrey: '#a9a9a9',
darkkhaki: '#bdb76b',
darkmagenta: '#8b008b',
darkolivegreen: '#556b2f',
darkorange: '#ff8c00',
darkorchid: '#9932cc',
darkred: '#8b0000',
darksalmon: '#e9967a',
darkseagreen: '#8fbc8f',
darkslateblue: '#483d8b',
darkslategray: '#2f4f4f',
darkslategrey: '#2f4f4f',
darkturquoise: '#00ced1',
darkviolet: '#9400d3',
deeppink: '#ff1493',
deepskyblue: '#00bfff',
dimgray: '#696969',
dimgrey: '#696969',
dodgerblue: '#1e90ff',
firebrick: '#b22222',
floralwhite: '#fffaf0',
forestgreen: '#228b22',
fuchsia: '#ff00ff',
gainsboro: '#dcdcdc',
ghostwhite: '#f8f8ff',
gold: '#ffd700',
goldenrod: '#daa520',
gray: '#808080',
green: '#008000',
greenyellow: '#adff2f',
grey: '#808080',
honeydew: '#f0fff0',
hotpink: '#ff69b4',
indianred: '#cd5c5c',
indigo: '#4b0082',
ivory: '#fffff0',
khaki: '#f0e68c',
lavender: '#e6e6fa',
lavenderblush: '#fff0f5',
lawngreen: '#7cfc00',
lemonchiffon: '#fffacd',
lightblue: '#add8e6',
lightcoral: '#f08080',
lightcyan: '#e0ffff',
lightgoldenrodyellow: '#fafad2',
lightgray: '#d3d3d3',
lightgreen: '#90ee90',
lightgrey: '#d3d3d3',
lightpink: '#ffb6c1',
lightsalmon: '#ffa07a',
lightseagreen: '#20b2aa',
lightskyblue: '#87cefa',
lightslategray: '#778899',
lightslategrey: '#778899',
lightsteelblue: '#b0c4de',
lightyellow: '#ffffe0',
lime: '#00ff00',
limegreen: '#32cd32',
linen: '#faf0e6',
magenta: '#ff00ff',
maroon: '#800000',
mediumaquamarine: '#66cdaa',
mediumblue: '#0000cd',
mediumorchid: '#ba55d3',
mediumpurple: '#9370db',
mediumseagreen: '#3cb371',
mediumslateblue: '#7b68ee',
mediumspringgreen: '#00fa9a',
mediumturquoise: '#48d1cc',
mediumvioletred: '#c71585',
midnightblue: '#191970',
mintcream: '#f5fffa',
mistyrose: '#ffe4e1',
moccasin: '#ffe4b5',
navajowhite: '#ffdead',
navy: '#000080',
oldlace: '#fdf5e6',
olive: '#808000',
olivedrab: '#6b8e23',
orange: '#ffa500',
orangered: '#ff4500',
orchid: '#da70d6',
palegoldenrod: '#eee8aa',
palegreen: '#98fb98',
paleturquoise: '#afeeee',
palevioletred: '#db7093',
papayawhip: '#ffefd5',
peachpuff: '#ffdab9',
peru: '#cd853f',
pink: '#ffc0cb',
plum: '#dda0dd',
powderblue: '#b0e0e6',
purple: '#800080',
red: '#ff0000',
rosybrown: '#bc8f8f',
royalblue: '#4169e1',
saddlebrown: '#8b4513',
salmon: '#fa8072',
sandybrown: '#f4a460',
seagreen: '#2e8b57',
seashell: '#fff5ee',
sienna: '#a0522d',
silver: '#c0c0c0',
skyblue: '#87ceeb',
slateblue: '#6a5acd',
slategray: '#708090',
slategrey: '#708090',
snow: '#fffafa',
springgreen: '#00ff7f',
steelblue: '#4682b4',
tan: '#d2b48c',
teal: '#008080',
thistle: '#d8bfd8',
tomato: '#ff6347',
turquoise: '#40e0d0',
violet: '#ee82ee',
wheat: '#f5deb3',
white: '#ffffff',
whitesmoke: '#f5f5f5',
yellow: '#ffff00',
yellowgreen: '#9acd32',
};
export function convertColorToNumber(color) {
// Convert color to lowercase for easier matching
color = color.toLowerCase();
// If the color is a hex code, convert it to a number
if (color[0] === '#') {
return convertHexToNumber(color);
}
// If the color is a named color, return the corresponding number
if (colorMap[color] !== undefined) {
return convertHexToNumber(colorMap[color]);
}
// If the color is not recognized, return null
return -1;
}
export function convertHexToNumber(hex) {
// Remove the leading '#' from the hex code
hex = hex.slice(1);
// Convert the hex code to a number
return parseInt(hex, 16);
}
+425 -371
View File
File diff suppressed because it is too large Load Diff
+93
View File
@@ -0,0 +1,93 @@
/*
cyclist.mjs - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/cyclist.mjs>
This 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/>.
*/
import createClock from './zyklus.mjs';
import { logger } from './logger.mjs';
export class Cyclist {
constructor({ interval, onTrigger, onToggle, onError, getTime, latency = 0.1 }) {
this.started = false;
this.cps = 1;
this.lastTick = 0; // absolute time when last tick (clock callback) happened
this.lastBegin = 0; // query begin of last tick
this.lastEnd = 0; // query end of last tick
this.getTime = getTime; // get absolute time
this.onToggle = onToggle;
this.latency = latency; // fixed trigger time offset
const round = (x) => Math.round(x * 1000) / 1000;
this.clock = createClock(
getTime,
// called slightly before each cycle
(phase, duration, tick) => {
if (tick === 0) {
this.origin = phase;
}
try {
const time = getTime();
const begin = this.lastEnd;
this.lastBegin = begin;
const end = round(begin + duration * this.cps);
this.lastEnd = end;
const haps = this.pattern.queryArc(begin, end);
const tickdeadline = phase - time; // time left till phase begins
this.lastTick = time + tickdeadline;
haps.forEach((hap) => {
if (hap.part.begin.equals(hap.whole.begin)) {
const deadline = (hap.whole.begin - begin) / this.cps + tickdeadline + latency;
const duration = hap.duration / this.cps;
onTrigger?.(hap, deadline, duration, this.cps);
}
});
} catch (e) {
logger(`[cyclist] error: ${e.message}`);
onError?.(e);
}
},
interval, // duration of each cycle
);
}
now() {
const secondsSinceLastTick = this.getTime() - this.lastTick - this.clock.duration;
return this.lastBegin + secondsSinceLastTick * this.cps; // + this.clock.minLatency;
}
setStarted(v) {
this.started = v;
this.onToggle?.(v);
}
start() {
if (!this.pattern) {
throw new Error('Scheduler: no pattern set! call .setPattern first.');
}
logger('[cyclist] start');
this.clock.start();
this.setStarted(true);
}
pause() {
logger('[cyclist] pause');
this.clock.pause();
this.setStarted(false);
}
stop() {
logger('[cyclist] stop');
this.clock.stop();
this.lastEnd = 0;
this.setStarted(false);
}
setPattern(pat, autostart = false) {
this.pattern = pat;
if (autostart && !this.started) {
this.start();
}
}
setCps(cps = 1) {
this.cps = cps;
}
log(begin, end, haps) {
const onsets = haps.filter((h) => h.hasOnset());
console.log(`${begin.toFixed(4)} - ${end.toFixed(4)} ${Array(onsets.length).fill('I').join('')}`);
}
}
+161
View File
@@ -0,0 +1,161 @@
/*
draw.mjs - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/draw.mjs>
This 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/>.
*/
import { Pattern, getTime, State, TimeSpan } from './index.mjs';
export const getDrawContext = (id = 'test-canvas') => {
let canvas = document.querySelector('#' + id);
if (!canvas) {
canvas = document.createElement('canvas');
canvas.id = id;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas.style = 'pointer-events:none;width:100%;height:100%;position:fixed;top:0;left:0';
document.body.prepend(canvas);
}
return canvas.getContext('2d');
};
Pattern.prototype.draw = function (callback, { from, to, onQuery }) {
if (window.strudelAnimation) {
cancelAnimationFrame(window.strudelAnimation);
}
const ctx = getDrawContext();
let cycle,
events = [];
const animate = (time) => {
const t = getTime();
if (from !== undefined && to !== undefined) {
const currentCycle = Math.floor(t);
if (cycle !== currentCycle) {
cycle = currentCycle;
const begin = currentCycle + from;
const end = currentCycle + to;
setTimeout(() => {
events = this.query(new State(new TimeSpan(begin, end)))
.filter(Boolean)
.filter((event) => event.part.begin.equals(event.whole.begin));
onQuery?.(events);
}, 0);
}
}
callback(ctx, events, t, time);
window.strudelAnimation = requestAnimationFrame(animate);
};
requestAnimationFrame(animate);
return this;
};
export const cleanupDraw = (clearScreen = true) => {
const ctx = getDrawContext();
clearScreen && ctx.clearRect(0, 0, window.innerWidth, window.innerHeight);
if (window.strudelAnimation) {
cancelAnimationFrame(window.strudelAnimation);
}
if (window.strudelScheduler) {
clearInterval(window.strudelScheduler);
}
};
Pattern.prototype.onPaint = function (onPaint) {
// this is evil! TODO: add pattern.context
this.context = { onPaint };
return this;
};
// const round = (x) => Math.round(x * 1000) / 1000;
// encapsulates starting and stopping animation frames
export class Framer {
constructor(onFrame, onError) {
this.onFrame = onFrame;
this.onError = onError;
}
start() {
const self = this;
let frame = requestAnimationFrame(function updateHighlights(time) {
try {
self.onFrame(time);
} catch (err) {
self.onError(err);
}
frame = requestAnimationFrame(updateHighlights);
});
self.cancel = () => {
cancelAnimationFrame(frame);
};
}
stop() {
if (this.cancel) {
this.cancel();
}
}
}
// syncs animation frames to a cyclist scheduler
// see vite-vanilla-repl-cm6 for an example
export class Drawer {
constructor(onDraw, drawTime) {
let [lookbehind, lookahead] = drawTime; // e.g. [-2, 2]
lookbehind = Math.abs(lookbehind);
this.visibleHaps = [];
this.lastFrame = null;
this.drawTime = drawTime;
this.framer = new Framer(
() => {
if (!this.scheduler) {
console.warn('Drawer: no scheduler');
return;
}
// calculate current frame time (think right side of screen for pianoroll)
const phase = this.scheduler.now() + lookahead;
// first frame just captures the phase
if (this.lastFrame === null) {
this.lastFrame = phase;
return;
}
// query haps from last frame till now. take last 100ms max
const haps = this.scheduler.pattern.queryArc(Math.max(this.lastFrame, phase - 1 / 10), phase);
this.lastFrame = phase;
this.visibleHaps = (this.visibleHaps || [])
// filter out haps that are too far in the past (think left edge of screen for pianoroll)
.filter((h) => h.whole.end >= phase - lookbehind - lookahead)
// add new haps with onset (think right edge bars scrolling in)
.concat(haps.filter((h) => h.hasOnset()));
const time = phase - lookahead;
onDraw(this.visibleHaps, time, this);
},
(err) => {
console.warn('draw error', err);
},
);
}
invalidate(scheduler = this.scheduler) {
if (!scheduler) {
return;
}
this.scheduler = scheduler;
const t = scheduler.now();
let [_, lookahead] = this.drawTime;
const [begin, end] = [Math.max(t, 0), t + lookahead + 0.1];
// remove all future haps
this.visibleHaps = this.visibleHaps.filter((h) => h.whole.begin < t);
// query future haps
const futureHaps = scheduler.pattern.queryArc(begin, end); // +0.1 = workaround for weird holes in query..
// append future haps
this.visibleHaps = this.visibleHaps.concat(futureHaps);
}
start(scheduler) {
this.scheduler = scheduler;
this.invalidate();
this.framer.start();
}
stop() {
if (this.framer) {
this.framer.stop();
}
}
}
+1
View File
@@ -21,6 +21,7 @@ import Fraction, { gcd } from './fraction.mjs';
* @example
* const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123
* console.log(line);
* silence;
*/
function drawLine(pat, chars = 60) {
let cycle = 0;
+150 -74
View File
@@ -1,95 +1,171 @@
/*
euclid.mjs - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/euclid.mjs>
euclid.mjs - Bjorklund/Euclidean/Diaspora rhythms
Copyright (C) 2023 Rohan Drape and strudel contributors
See <https://github.com/tidalcycles/strudel/blob/main/packages/core/euclid.mjs> for authors of this file.
The Bjorklund algorithm implementation is ported from the Haskell Music Theory Haskell module by Rohan Drape -
https://rohandrape.net/?t=hmt
This 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/>.
*/
import { Pattern, timeCat } from './pattern.mjs';
import bjork from 'bjork';
import { rotate } from './util.mjs';
import { Pattern, timeCat, register, silence } from './pattern.mjs';
import { rotate, flatten, splitAt, zipWith } from './util.mjs';
import Fraction from './fraction.mjs';
const euclid = (pulses, steps, rotation = 0) => {
const b = bjork(steps, pulses);
const left = function (n, x) {
const [ons, offs] = n;
const [xs, ys] = x;
const [_xs, __xs] = splitAt(offs, xs);
return [
[offs, ons - offs],
[zipWith((a, b) => a.concat(b), _xs, ys), __xs],
];
};
const right = function (n, x) {
const [ons, offs] = n;
const [xs, ys] = x;
const [_ys, __ys] = splitAt(ons, ys);
const result = [
[ons, offs - ons],
[zipWith((a, b) => a.concat(b), xs, _ys), __ys],
];
return result;
};
const _bjork = function (n, x) {
const [ons, offs] = n;
return Math.min(ons, offs) <= 1 ? [n, x] : _bjork(...(ons > offs ? left(n, x) : right(n, x)));
};
export const bjork = function (ons, steps) {
const offs = steps - ons;
const x = Array(ons).fill([1]);
const y = Array(offs).fill([0]);
const result = _bjork([ons, offs], [x, y]);
return flatten(result[1][0]).concat(flatten(result[1][1]));
};
/**
* Changes the structure of the pattern to form an euclidean rhythm.
* Euclidian rhythms are rhythms obtained using the greatest common
* divisor of two numbers. They were described in 2004 by Godfried
* Toussaint, a canadian computer scientist. Euclidian rhythms are
* really useful for computer/algorithmic music because they can
* describe a large number of rhythms with a couple of numbers.
*
* @memberof Pattern
* @name euclid
* @param {number} pulses the number of onsets / beats
* @param {number} steps the number of steps to fill
* @returns Pattern
* @example
* // The Cuban tresillo pattern.
* note("c3").euclid(3,8)
*/
/**
* Like `euclid`, but has an additional parameter for 'rotating' the resulting sequence.
* @memberof Pattern
* @name euclidRot
* @param {number} pulses the number of onsets / beats
* @param {number} steps the number of steps to fill
* @param {number} rotation offset in steps
* @returns Pattern
* @example
* // A Samba rhythm necklace from Brazil
* note("c3").euclidRot(3,16,14)
*/
/**
* @example // A thirteenth century Persian rhythm called Khafif-e-ramal.
* note("c3").euclid(2,5)
* @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.
* note("c3").euclid(3,4)
* @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.
* note("c3").euclidRot(3,5,2)
* @example // A Ruchenitza rhythm used in a Bulgarian folk-dance.
* note("c3").euclid(3,7)
* @example // The Cuban tresillo pattern.
* note("c3").euclid(3,8)
* @example // Another Ruchenitza Bulgarian folk-dance rhythm.
* note("c3").euclid(4,7)
* @example // The Aksak rhythm of Turkey.
* note("c3").euclid(4,9)
* @example // The metric pattern used by Frank Zappa in his piece titled Outside Now.
* note("c3").euclid(4,11)
* @example // Yields the York-Samai pattern, a popular Arab rhythm.
* note("c3").euclid(5,6)
* @example // The Nawakhat pattern, another popular Arab rhythm.
* note("c3").euclid(5,7)
* @example // The Cuban cinquillo pattern.
* note("c3").euclid(5,8)
* @example // A popular Arab rhythm called Agsag-Samai.
* note("c3").euclid(5,9)
* @example // The metric pattern used by Moussorgsky in Pictures at an Exhibition.
* note("c3").euclid(5,11)
* @example // The Venda clapping pattern of a South African childrens song.
* note("c3").euclid(5,12)
* @example // The Bossa-Nova rhythm necklace of Brazil.
* note("c3").euclid(5,16)
* @example // A typical rhythm played on the Bendir (frame drum).
* note("c3").euclid(7,8)
* @example // A common West African bell pattern.
* note("c3").euclid(7,12)
* @example // A Samba rhythm necklace from Brazil.
* note("c3").euclidRot(7,16,14)
* @example // A rhythm necklace used in the Central African Republic.
* note("c3").euclid(9,16)
* @example // A rhythm necklace of the Aka Pygmies of Central Africa.
* note("c3").euclidRot(11,24,14)
* @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha.
* note("c3").euclidRot(13,24,5)
*/
const _euclidRot = function (pulses, steps, rotation) {
const b = bjork(pulses, steps);
if (rotation) {
return rotate(b, -rotation);
}
return b;
};
/**
* Changes the structure of the pattern to form an euclidean rhythm.
* Euclidian rhythms are rhythms obtained using the greatest common divisor of two numbers.
* They were described in 2004 by Godfried Toussaint, a canadian computer scientist.
* Euclidian rhythms are really useful for computer/algorithmic music because they can accurately
* describe a large number of rhythms used in the most important music world traditions.
*
* @memberof Pattern
* @param {number} pulses the number of onsets / beats
* @param {number} steps the number of steps to fill
* @param {number} rotation (optional) offset in steps
* @returns Pattern
* @example // The Cuban tresillo pattern.
* "c3".euclid(3,8)
* @example // A thirteenth century Persian rhythm called Khafif-e-ramal.
* "c3".euclid(2,5)
* @example // The archetypal pattern of the Cumbia from Colombia, as well as a Calypso rhythm from Trinidad.
* "c3".euclid(3,4)
* @example // Another thirteenth century Persian rhythm by the name of Khafif-e-ramal, as well as a Rumanian folk-dance rhythm.
* "c3".euclid(3,5,2)
* @example // A Ruchenitza rhythm used in a Bulgarian folk-dance.
* "c3".euclid(3,7)
* @example // The Cuban tresillo pattern.
* "c3".euclid(3,8)
* @example // Another Ruchenitza Bulgarian folk-dance rhythm.
* "c3".euclid(4,7)
* @example // The Aksak rhythm of Turkey.
* "c3".euclid(4,9)
* @example // The metric pattern used by Frank Zappa in his piece titled Outside Now.
* "c3".euclid(4,11)
* @example // Yields the York-Samai pattern, a popular Arab rhythm.
* "c3".euclid(5,6)
* @example // The Nawakhat pattern, another popular Arab rhythm.
* "c3".euclid(5,7)
* @example // The Cuban cinquillo pattern.
* "c3".euclid(5,8)
* @example // A popular Arab rhythm called Agsag-Samai.
* "c3".euclid(5,9)
* @example // The metric pattern used by Moussorgsky in Pictures at an Exhibition.
* "c3".euclid(5,11)
* @example // The Venda clapping pattern of a South African childrens song.
* "c3".euclid(5,12)
* @example // The Bossa-Nova rhythm necklace of Brazil.
* "c3".euclid(5,16)
* @example // A typical rhythm played on the Bendir (frame drum).
* "c3".euclid(7,8)
* @example // A common West African bell pattern.
* "c3".euclid(7,12)
* @example // A Samba rhythm necklace from Brazil.
* "c3".euclid(7,16,14)
* @example // A rhythm necklace used in the Central African Republic.
* "c3".euclid(9,16)
* @example // A rhythm necklace of the Aka Pygmies of Central Africa.
* "c3".euclid(11,24,14)
* @example // Another rhythm necklace of the Aka Pygmies of the upper Sangha.
* "c3".euclid(13,24,5)
*/
Pattern.prototype.euclid = function (pulses, steps, rotation = 0) {
return this.struct(euclid(pulses, steps, rotation));
};
export const euclid = register('euclid', function (pulses, steps, pat) {
return pat.struct(_euclidRot(pulses, steps, 0));
});
export const { euclidrot, euclidRot } = register(['euclidrot', 'euclidRot'], function (pulses, steps, rotation, pat) {
return pat.struct(_euclidRot(pulses, steps, rotation));
});
/**
* Similar to {@link Pattern#euclid}, but each pulse is held until the next pulse, so there will be no gaps.
* Similar to `euclid`, but each pulse is held until the next pulse,
* so there will be no gaps.
* @name euclidLegato
* @memberof Pattern
* @example
* n("g2").decay(.1).sustain(.3).euclidLegato(3,8)
*/
Pattern.prototype.euclidLegato = function (pulses, steps, rotation = 0) {
const bin_pat = euclid(pulses, steps, rotation);
const firstOne = bin_pat.indexOf(1);
const gapless = rotate(bin_pat, firstOne)
const _euclidLegato = function (pulses, steps, rotation, pat) {
if (pulses < 1) {
return silence;
}
const bin_pat = _euclidRot(pulses, steps, rotation);
const gapless = bin_pat
.join('')
.split('1')
.slice(1)
.map((s) => [s.length + 1, true]);
return this.struct(timeCat(...gapless)).late(Fraction(firstOne).div(steps));
return pat.struct(timeCat(...gapless));
};
export default euclid;
export const euclidLegato = register(['euclidLegato'], function (pulses, steps, pat) {
return _euclidLegato(pulses, steps, 0, pat);
});
export const euclidLegatoRot = register(['euclidLegatoRot'], function (pulses, steps, rotation, pat) {
return _euclidLegato(pulses, steps, rotation, pat);
});
+52
View File
@@ -0,0 +1,52 @@
/*
evaluate.mjs - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/eval/evaluate.mjs>
This 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/>.
*/
import { isPattern } from './index.mjs';
export const evalScope = async (...args) => {
const results = await Promise.allSettled(args);
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
results.forEach((result, i) => {
if (result.status === 'rejected') {
console.warn(`evalScope: module with index ${i} could not be loaded:`, result.reason);
}
});
// Object.assign(globalThis, ...modules);
// below is a fix for above commented out line
// same error as https://github.com/vitest-dev/vitest/issues/1807 when running this on astro server
modules.forEach((module) => {
Object.entries(module).forEach(([name, value]) => {
globalThis[name] = value;
});
});
};
function safeEval(str, options = {}) {
const { wrapExpression = true, wrapAsync = true } = options;
if (wrapExpression) {
str = `{${str}}`;
}
if (wrapAsync) {
str = `(async ()=>${str})()`;
}
const body = `"use strict";return (${str})`;
return Function(body)();
}
export const evaluate = async (code, transpiler) => {
if (transpiler) {
code = transpiler(code); // transform syntactically correct js code to semantically usable code
}
// if no transpiler is given, we expect a single instruction (!wrapExpression)
const options = { wrapExpression: !!transpiler };
let evaluated = await safeEval(code, options);
if (!isPattern(evaluated)) {
console.log('evaluated', evaluated);
const message = `got "${typeof evaluated}" instead of pattern`;
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
}
return { mode: 'javascript', pattern: evaluated };
};
+2 -2
View File
@@ -1,13 +1,13 @@
<input
type="text"
id="text"
value="cat('a', 'b')"
value="seq('a', ['b', 'c'])"
style="width: 100%; font-size: 2em; outline: none; margin-bottom: 10px"
spellcheck="false"
/>
<div id="output"></div>
<script type="module">
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.0.2');
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.6.8');
Object.assign(window, strudel); // assign all strudel functions to global scope to use with eval
const input = document.getElementById('text');
const getEvents = () => {
+2 -2
View File
@@ -2,13 +2,13 @@
<input
type="text"
id="text"
value="cat('orange', 'indigo')"
value="seq('tomato', 'indigo', ['white', 'steelblue']).fast(4)"
style="width: 100%; font-size: 2em; background: black; color: white; outline: none; position: absolute; top: 0"
spellcheck="false"
/>
<canvas id="canvas"></canvas>
<script type="module">
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.0.2');
const strudel = await import('https://cdn.skypack.dev/@strudel.cycles/core@0.6.8');
// this adds all strudel functions to the global scope, to be used by eval
Object.assign(window, strudel);
// setup elements
+83
View File
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Buildless Vanilla Strudel REPL</title>
</head>
<body style="margin: 0; background: #222">
<div style="display: grid; height: 100vh; grid-template-rows: 32px auto">
<button id="start" style="width: 100vw; height: 32px">evaluate</button>
<textarea
id="text"
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
spellcheck="false"
></textarea>
</div>
<div id="output"></div>
<script type="module">
import { controls, repl, evalScope } from 'https://cdn.skypack.dev/@strudel.cycles/core@0.6.8';
import { mini } from 'https://cdn.skypack.dev/@strudel.cycles/mini@0.6.0';
import { transpiler } from 'https://cdn.skypack.dev/@strudel.cycles/transpiler@0.6.0';
import {
getAudioContext,
webaudioOutput,
initAudioOnFirstClick,
} from 'https://cdn.skypack.dev/@strudel.cycles/webaudio@0.6.0';
initAudioOnFirstClick();
const ctx = getAudioContext();
const input = document.getElementById('text');
input.innerHTML = getTune();
evalScope(
controls,
import('https://cdn.skypack.dev/@strudel.cycles/core@0.6.8'),
import('https://cdn.skypack.dev/@strudel.cycles/mini@0.6.0'),
import('https://cdn.skypack.dev/@strudel.cycles/tonal@0.6.0'),
import('https://cdn.skypack.dev/@strudel.cycles/webaudio@0.6.0'),
);
const { evaluate } = repl({
defaultOutput: webaudioOutput,
getTime: () => ctx.currentTime,
transpiler,
});
document.getElementById('start').addEventListener('click', () => evaluate(input.value));
function getTune() {
return `await samples('github:tidalcycles/Dirt-Samples/master')
stack(
// amen
n("0 1 2 3 4 5 6 7")
.sometimes(x=>x.ply(2))
.rarely(x=>x.speed("2 | -2"))
.sometimesBy(.4, x=>x.delay(".5"))
.s("amencutup")
.slow(2)
.room(.5)
,
// bass
sine.add(saw.slow(4)).range(0,7).segment(8)
.superimpose(x=>x.add(.1))
.scale('G0 minor').note()
.s("sawtooth").decay(.1).sustain(0)
.gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10)
.degradeBy("0 0.1 .5 .1")
.rarely(add(note("12")))
,
// chord
note("Bb3,D4".superimpose(x=>x.add(.2)))
.s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>")
.decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8)
,
// alien
s("breath").room(1).shape(.6).chop(16).rev().mask("<x ~@7>")
,
n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5))
).reset("<x@7 x(5,8)>")`;
}
</script>
</body>
</html>
@@ -0,0 +1,8 @@
# vite-vanilla-repl-cm6
This folder demonstrates how to set up a strudel repl using vite and vanilla JS + codemirror. Run it using:
```sh
npm i
npm run dev
```
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite Vanilla Strudel REPL</title>
</head>
<body>
<main>
<nav>
<button id="play">eval</button>
<button id="stop">stop</button>
</nav>
<div class="container">
<div id="editor"></div>
<div id="output"></div>
</div>
<canvas id="roll"></canvas>
</main>
<script type="module" src="./main.js"></script>
</body>
</html>
@@ -0,0 +1,39 @@
import { StrudelMirror } from '@strudel/codemirror';
import { funk42 } from './tunes';
import { drawPianoroll, evalScope, controls } from '@strudel.cycles/core';
import './style.css';
import { initAudioOnFirstClick } from '@strudel.cycles/webaudio';
import { transpiler } from '@strudel.cycles/transpiler';
import { getAudioContext, webaudioOutput, registerSynthSounds } from '@strudel.cycles/webaudio';
import { registerSoundfonts } from '@strudel.cycles/soundfonts';
// init canvas
const canvas = document.getElementById('roll');
canvas.width = canvas.width * 2;
canvas.height = canvas.height * 2;
const drawContext = canvas.getContext('2d');
const drawTime = [-2, 2]; // time window of drawn haps
const editor = new StrudelMirror({
defaultOutput: webaudioOutput,
getTime: () => getAudioContext().currentTime,
transpiler,
root: document.getElementById('editor'),
initialCode: funk42,
drawTime,
onDraw: (haps, time) => drawPianoroll({ haps, time, ctx: drawContext, drawTime, fold: 0 }),
prebake: async () => {
initAudioOnFirstClick(); // needed to make the browser happy (don't await this here..)
const loadModules = evalScope(
controls,
import('@strudel.cycles/core'),
import('@strudel.cycles/mini'),
import('@strudel.cycles/tonal'),
import('@strudel.cycles/webaudio'),
);
await Promise.all([loadModules, registerSynthSounds(), registerSoundfonts()]);
},
});
document.getElementById('play').addEventListener('click', () => editor.evaluate());
document.getElementById('stop').addEventListener('click', () => editor.stop());
@@ -0,0 +1,23 @@
{
"name": "vite-vanilla-repl-cm6",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^4.3.2"
},
"dependencies": {
"@strudel/codemirror": "workspace:*",
"@strudel.cycles/core": "workspace:*",
"@strudel.cycles/mini": "workspace:*",
"@strudel.cycles/soundfonts": "workspace:*",
"@strudel.cycles/tonal": "workspace:*",
"@strudel.cycles/transpiler": "workspace:*",
"@strudel.cycles/webaudio": "workspace:*"
}
}
@@ -0,0 +1,31 @@
body,
html {
margin: 0;
height: 100%;
background: #282c34;
}
main {
height: 100%;
display: flex;
flex-direction: column;
}
.container {
flex-grow: 1;
max-height: 100%;
position: relative;
overflow: auto;
}
#editor {
overflow: auto;
}
.cm-editor {
height: 100%;
}
#roll {
height: 300px;
}
@@ -0,0 +1,112 @@
export const bumpStreet = `// froos - "22 bump street", licensed with CC BY-NC-SA 4.0
await samples('github:felixroos/samples/main')
await samples('https://strudel.tidalcycles.org/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
"<[0,<6 7 9>,13,<17 20 22 26>]!2>/2"
// make it 22 edo
.fmap(v => Math.pow(2,v/22))
// mess with the base frequency
.mul("<300 [300@3 200]>/8").freq()
.layer(
// chords
x=>x.div(freq(2)).s("flute").euclidLegato("<3 2>",8)
.shape(.4).lpf(sine.range(800,4000).slow(8)),
// adlibs
x=>x.arp("{0 3 2 [1 3]}%1.5")
.s('xylo').mul(freq(2))
.delay(.5).delayfeedback(.4).juxBy(.5, rev)
.hpf(sine.range(200,3000).slow(8)),
// bass
x=>x.arp("[0 [2 1?]](5,8)").s('sawtooth').div(freq(4))
.lpf(sine.range(400,2000).slow(8)).lpq(8).shape(.4)
.off(1/8, x=>x.mul(freq(2)).degradeBy(.5)).gain(.3)
).clip(1).release(.2)
.stack(
// drums
s("bd sd:<2 1>, [~ hh]*2, [~ rim]").bank('RolandTR909')
.off(1/8, x=>x.speed(2).gain(.4)).sometimes(ply(2)).gain(.8)
.mask("<0@4 1@12>/4")
.reset("<x@15 [x(3,8) x*[4 8]]>")
// wait for it...
).fast(2/3)
//.crush(6) // remove "//" if you dare`;
export const trafficFlam = `// froos - "traffic flam", licensed with CC BY-NC-SA 4.0
await samples('github:felixroos/samples/main')
await samples('https://strudel.tidalcycles.org/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
addVoicings('hip', {
m11: ['2M 3m 4P 7m'],
'^7#11': ['3M 4A 5P 7M'],
}, ['C4', 'C6'])
stack(
stack(
"<Bbm11 A^7#11>/2".voicings('hip').note()
.s("gm_epiano1:2")
.arp("[<[0 1 2 3] [3 2 1 0]> ~@5]/2")
.release(2).late(.25).lpf(2000),
"<Bb1 A1>/2".note().s('gm_acoustic_bass'),
n("<0 2 3>(3,8)".off(1/8, add(4)))
.scale("<Bb4:minor A4:lydian>/2")
.s('gm_electric_guitar_jazz')
.decay(sine.range(.05, .2).slow(32)).sustain(0)
.delay(.5).lpf(sine.range(100,5000).slow(64))
.gain(.7).room(.5).pan(sine.range(0,1).slow(11))
).add(perlin.range(0,.25).note()),
stack(
s("bd:1(3,8) rim").bank('RolandTR707').slow(2).room("<0 <.1 .6>>")
.when("<0@7 1>",x=>x.echoWith(3, .0625, (x,i) => x.speed(1+i*.24))),
s("rim*4").end(.05).bank('RolandTR808').speed(.8).room(.2)
)
)
.late("[0 .05]*2").late(12)
`;
export const funk42 = `// froos - how to funk in 42 lines of code
// adapted from "how to funk in two minutes" by marc rebillet https://www.youtube.com/watch?v=3vBwRfQbXkg
// thanks to peach for the transcription: https://www.youtube.com/watch?v=8eiPXvIgda4
await samples('github:felixroos/samples/main')
await samples('https://strudel.tidalcycles.org/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
setcps(.5)
let drums = stack(
s("bd*2, ~ sd").bank('RolandTR707').room("0 .1"),
s("hh*4").begin(.2).release(.02).end(.25).release(.02)
.gain(.3).bank('RolandTR707').late(.02).room(.5),
//s("shaker_small").struct("[x x*2]*2").speed(".8,.9").release(.02)
).fast(2)
let wurli = note(\`<
[[a2,g3,[b3 c4],e4] ~ [g3,c4,e4](3,8)@4 ~@2]!3
[[e2,e3,a3,b3,e4]@3 [e2,e3,ab3,b3,e4]@5]>\`)
.s("gm_epiano1:5").decay(.2).sustain("<[1 0@7]!3 1>")
.gain("<[.8@2 .4@14]!3 .7>").room(.3)
let organ = note("<[~@3 [a3,d4,f#4]@2 [[a3,c4,e4]@2 ~] ~@2]!3 ~>".add(12))
.s("gm_percussive_organ:2").gain(.6).lpf(1800).pan(.2).room(.3);
let clav = note(\`<
[~@3 a2 [g3,[b3 c4],e4]@2 ~ a2 [g3,b3,e4] ~@2 [g3,c4,e4] ~@4]!3
[~@3 e3 [[a3 b3],c3,e3]@2 ~ e2 [e3,a3]@3 [b3,e3] ~@2 [b3,e3]@2]>\`)
.s("gm_clavinet:1").decay("<.25!3 [.25 .4]>").sustain(0)
.gain(.7).pan(.8).room(.2);
let bass = note(\`<
[a1 [~ [g2 a2]] [g1 g#1] [a1 [g2 a2]]]
[a1 [~ [g2 a2]] [e3 d3] [c3 [g3 a3]]]
[a1 [~ [g2 a2]] [g1 g#1] [a1 [g2 a2]]]
[e2@6 e1@5 e1 [[d2 e3] g1]@4]
>\`).s("gm_electric_bass_pick:1").release(.1)
stack(
drums
,wurli
,organ
,clav
,bass
)`;
@@ -0,0 +1 @@
!dist
@@ -0,0 +1,8 @@
# vite-vanilla-repl
This folder demonstrates how to set up a strudel repl using vite and vanilla JS. Run it using:
```sh
npm i
npm run dev
```
@@ -0,0 +1 @@
import{b as s,h as i,m,a as n,c as p,p as t}from"./index.4cbc0a10.js";export{s as SyntaxError,i as h,m as mini,n as minify,p as parse,t as patternifyAST};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
import{g as s,f as d,i as t,n as r,l as u,j as o,d as f,k as p,r as g,s as i,w as l,e as m}from"./index.4cbc0a10.js";export{s as getAudioContext,d as getCachedBuffer,t as getLoadedBuffer,r as getLoadedSamples,u as loadBuffer,o as loadGithubSamples,f as panic,p as resetLoadedSamples,g as reverseBuffer,i as samples,l as webaudioOutput,m as webaudioOutputTrigger};
@@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite Vanilla Strudel REPL</title>
<script type="module" crossorigin src="/tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/assets/index.4cbc0a10.js"></script>
</head>
<body style="margin: 0; background: #222">
<div style="display: grid; height: 100vh">
<textarea
id="text"
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
spellcheck="false"
></textarea>
</div>
<button
id="start"
style="
position: absolute;
border-radius: 10px;
top: 20px;
right: 20px;
padding: 20px;
border: 2px solid white;
background: transparent;
color: white;
cursor: pointer;
"
>
evaluate
</button>
<div id="output"></div>
</body>
</html>
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite Vanilla Strudel REPL</title>
</head>
<body style="margin: 0; background: #222">
<div style="display: grid; height: 100vh">
<textarea
id="text"
style="font-size: 2em; border: 0; color: white; background: transparent; outline: none; padding: 20px"
spellcheck="false"
></textarea>
</div>
<button
id="start"
style="
position: absolute;
border-radius: 10px;
top: 20px;
right: 20px;
padding: 20px;
border: 2px solid white;
background: transparent;
color: white;
cursor: pointer;
"
>
evaluate
</button>
<div id="output"></div>
<script type="module" src="./main.js"></script>
</body>
</html>
@@ -0,0 +1,28 @@
import { controls, repl, evalScope } from '@strudel.cycles/core';
import { getAudioContext, webaudioOutput, initAudioOnFirstClick } from '@strudel.cycles/webaudio';
import { transpiler } from '@strudel.cycles/transpiler';
import tune from './tune.mjs';
const ctx = getAudioContext();
const input = document.getElementById('text');
input.innerHTML = tune;
initAudioOnFirstClick();
evalScope(
controls,
import('@strudel.cycles/core'),
import('@strudel.cycles/mini'),
import('@strudel.cycles/webaudio'),
import('@strudel.cycles/tonal'),
);
const { evaluate } = repl({
defaultOutput: webaudioOutput,
getTime: () => ctx.currentTime,
transpiler,
});
document.getElementById('start').addEventListener('click', () => {
ctx.resume();
console.log('eval', input.value);
evaluate(input.value);
});
@@ -0,0 +1,22 @@
{
"name": "vite-vanilla-repl",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build-githack": "vite build --base /tidalcycles/strudel/use-acorn/packages/core/examples/vite-vanilla-repl/dist/",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^4.3.3"
},
"dependencies": {
"@strudel.cycles/core": "workspace:*",
"@strudel.cycles/mini": "workspace:*",
"@strudel.cycles/transpiler": "workspace:*",
"@strudel.cycles/webaudio": "workspace:*",
"@strudel.cycles/tonal": "workspace:*"
}
}
@@ -0,0 +1,31 @@
export default `await samples('github:tidalcycles/Dirt-Samples/master')
stack(
// amen
n("0 1 2 3 4 5 6 7")
.sometimes(x=>x.ply(2))
.rarely(x=>x.speed("2 | -2"))
.sometimesBy(.4, x=>x.delay(".5"))
.s("amencutup")
.slow(2)
.room(.5)
,
// bass
sine.add(saw.slow(4)).range(0,7).segment(8)
.superimpose(x=>x.add(.1))
.scale('G0 minor').note()
.s("sawtooth").decay(.1).sustain(0)
.gain(.4).cutoff(perlin.range(300,3000).slow(8)).resonance(10)
.degradeBy("0 0.1 .5 .1")
.rarely(add(note("12")))
,
// chord
note("Bb3,D4".superimpose(x=>x.add(.2)))
.s('sawtooth').cutoff(1000).struct("<~@3 [~ x]>")
.decay(.05).sustain(.0).delay(.8).delaytime(.125).room(.8)
,
// alien
s("breath").room(1).shape(.6).chop(16).rev().mask("<x ~@7>")
,
n("0 1").s("east").delay(.5).degradeBy(.8).speed(rand.range(.5,1.5))
).reset("<x@7 x(5,8)>")`;
+3 -2
View File
@@ -55,7 +55,8 @@ Fraction.prototype.min = function (other) {
return this.lt(other) ? this : other;
};
Fraction.prototype.show = function () {
Fraction.prototype.show = function (/* excludeWhole = false */) {
// return this.toFraction(excludeWhole);
return this.s * this.n + '/' + this.d;
};
@@ -73,7 +74,7 @@ const fraction = (n) => {
-> those farey sequences turn out to make pattern querying ~20 times slower! always use strings!
-> still, some optimizations could be done: .mul .div .add .sub calls still use numbers
*/
n = String(n);
// n = String(n); // this is actually faster but imprecise...
}
return Fraction(n);
};
+2 -2
View File
@@ -6,7 +6,7 @@ This program is free software: you can redistribute it and/or modify it under th
// this is a shortcut to eval code from a gist
// why? to be able to shorten strudel code + e.g. be able to change instruments after links have been generated
export default (route) =>
fetch(`https://gist.githubusercontent.com/${route}?cachebust=${Date.now()}`)
export default (route, cache = true) =>
fetch(`https://gist.githubusercontent.com/${route}?cachebust=${cache ? '' : Date.now()}`)
.then((res) => res.text())
.then((code) => eval(code));
+53 -11
View File
@@ -32,7 +32,11 @@ export class Hap {
}
get duration() {
return this.whole.end.sub(this.whole.begin);
return this.whole.end.sub(this.whole.begin).mul(typeof this.value?.clip === 'number' ? this.value?.clip : 1);
}
get endClipped() {
return this.whole.begin.add(this.duration);
}
wholeOrPart() {
@@ -79,18 +83,43 @@ export class Hap {
);
}
show() {
return (
'(' + (this.whole == undefined ? '~' : this.whole.show()) + ', ' + this.part.show() + ', ' + this.value + ')'
);
show(compact = false) {
const value =
typeof this.value === 'object'
? compact
? JSON.stringify(this.value).slice(1, -1).replaceAll('"', '').replaceAll(',', ' ')
: JSON.stringify(this.value)
: this.value;
var spans = '';
if (this.whole == undefined) {
spans = '~' + this.part.show;
} else {
var is_whole = this.whole.begin.equals(this.part.begin) && this.whole.end.equals(this.part.end);
if (!this.whole.begin.equals(this.part.begin)) {
spans = this.whole.begin.show() + ' ⇜ ';
}
if (!is_whole) {
spans += '(';
}
spans += this.part.show();
if (!is_whole) {
spans += ')';
}
if (!this.whole.end.equals(this.part.end)) {
spans += ' ⇝ ' + this.whole.end.show();
}
}
return '[ ' + spans + ' | ' + value + ' ]';
}
showWhole() {
return `${this.whole == undefined ? '~' : this.whole.show()}: ${this.value}`;
}
showWhole() {
return `${this.whole == undefined ? '~' : this.whole.show()}: ${this.value}`;
showWhole(compact = false) {
return `${this.whole == undefined ? '~' : this.whole.show()}: ${
typeof this.value === 'object'
? compact
? JSON.stringify(this.value).slice(1, -1).replaceAll('"', '').replaceAll(',', ' ')
: JSON.stringify(this.value)
: this.value
}`;
}
combineContext(b) {
@@ -101,6 +130,19 @@ export class Hap {
setContext(context) {
return new Hap(this.whole, this.part, this.value, context);
}
ensureObjectValue() {
/* if (isNote(hap.value)) {
// supports primitive hap values that look like notes
hap.value = { note: hap.value };
} */
if (typeof this.value !== 'object') {
throw new Error(
`expected hap.value to be an object, but got "${this.value}". Hint: append .note() or .s() to the end`,
'error',
);
}
}
}
export default Hap;
+27 -4
View File
@@ -4,10 +4,11 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
export * from './controls.mjs';
import controls from './controls.mjs';
export * from './euclid.mjs';
import Fraction from './fraction.mjs';
export { Fraction };
import { logger } from './logger.mjs';
export { Fraction, controls };
export * from './hap.mjs';
export * from './pattern.mjs';
export * from './signal.mjs';
@@ -15,5 +16,27 @@ export * from './state.mjs';
export * from './timespan.mjs';
export * from './util.mjs';
export * from './speak.mjs';
export * as gist from './gist.js';
// export * from './value.mjs';
export * from './evaluate.mjs';
export * from './repl.mjs';
export * from './cyclist.mjs';
export * from './logger.mjs';
export * from './time.mjs';
export * from './draw.mjs';
export * from './animate.mjs';
export * from './pianoroll.mjs';
export * from './spiral.mjs';
export * from './ui.mjs';
export { default as drawLine } from './drawLine.mjs';
export { default as gist } from './gist.js';
// below won't work with runtime.mjs (json import fails)
/* import * as p from './package.json';
export const version = p.version; */
logger('🌀 @strudel.cycles/core loaded 🌀');
if (globalThis._strudelLoaded) {
console.warn(
`@strudel.cycles/core was loaded more than once...
This might happen when you have multiple versions of strudel installed.
Please check with "npm ls @strudel.cycles/core".`,
);
}
globalThis._strudelLoaded = true;
+18
View File
@@ -0,0 +1,18 @@
export const logKey = 'strudel.log';
export function logger(message, type, data = {}) {
console.log(`%c${message}`, 'background-color: black;color:white;border-radius:15px');
if (typeof document !== 'undefined' && typeof CustomEvent !== 'undefined') {
document.dispatchEvent(
new CustomEvent(logKey, {
detail: {
message,
type,
data,
},
}),
);
}
}
logger.key = logKey;
-1639
View File
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -1,11 +1,17 @@
{
"name": "@strudel.cycles/core",
"version": "0.1.0",
"version": "0.8.2",
"description": "Port of Tidal Cycles to JavaScript",
"main": "index.mjs",
"type": "module",
"publishConfig": {
"main": "dist/index.js",
"module": "dist/index.mjs"
},
"scripts": {
"test": "mocha --colors"
"test": "vitest run",
"build": "vite build",
"prepublishOnly": "pnpm build"
},
"repository": {
"type": "git",
@@ -25,11 +31,11 @@
},
"homepage": "https://strudel.tidalcycles.org",
"dependencies": {
"bjork": "^0.0.1",
"fraction.js": "^4.2.0"
},
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2",
"devDependencies": {
"mocha": "^9.2.2"
},
"gitHead": "0e26d4e741500f5bae35b023608f062a794905c2"
"vite": "^4.3.3",
"vitest": "^0.28.0"
}
}
+1791 -991
View File
File diff suppressed because it is too large Load Diff
+328
View File
@@ -0,0 +1,328 @@
/*
pianoroll.mjs - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/tone/pianoroll.mjs>
This 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/>.
*/
import { Pattern, noteToMidi, getDrawContext, freqToMidi, isNote } from './index.mjs';
const scale = (normalized, min, max) => normalized * (max - min) + min;
const getValue = (e) => {
let { value } = e;
if (typeof e.value !== 'object') {
value = { value };
}
let { note, n, freq, s } = value;
if (freq) {
return freqToMidi(freq);
}
note = note ?? n;
if (typeof note === 'string') {
return noteToMidi(note);
}
if (typeof note === 'number') {
return note;
}
if (s) {
return '_' + s;
}
return value;
};
Pattern.prototype.pianoroll = function ({
cycles = 4,
playhead = 0.5,
overscan = 1,
flipTime = 0,
flipValues = 0,
hideNegative = false,
// inactive = '#C9E597',
// inactive = '#FFCA28',
inactive = '#7491D2',
active = '#FFCA28',
// background = '#2A3236',
background = 'transparent',
smear = 0,
playheadColor = 'white',
minMidi = 10,
maxMidi = 90,
autorange = 0,
timeframe: timeframeProp,
fold = 0,
vertical = 0,
labels = 0,
} = {}) {
const ctx = getDrawContext();
const w = ctx.canvas.width;
const h = ctx.canvas.height;
let from = -cycles * playhead;
let to = cycles * (1 - playhead);
if (timeframeProp) {
console.warn('timeframe is deprecated! use from/to instead');
from = 0;
to = timeframeProp;
}
const timeAxis = vertical ? h : w;
const valueAxis = vertical ? w : h;
let timeRange = vertical ? [timeAxis, 0] : [0, timeAxis]; // pixel range for time
const timeExtent = to - from; // number of seconds that fit inside the canvas frame
const valueRange = vertical ? [0, valueAxis] : [valueAxis, 0]; // pixel range for values
let valueExtent = maxMidi - minMidi + 1; // number of "slots" for values, overwritten if autorange true
let barThickness = valueAxis / valueExtent; // pixels per value, overwritten if autorange true
let foldValues = [];
flipTime && timeRange.reverse();
flipValues && valueRange.reverse();
this.draw(
(ctx, events, t) => {
ctx.fillStyle = background;
ctx.globalAlpha = 1; // reset!
if (!smear) {
ctx.clearRect(0, 0, w, h);
ctx.fillRect(0, 0, w, h);
}
const inFrame = (event) =>
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= t + to && event.endClipped >= t + from;
events.filter(inFrame).forEach((event) => {
const isActive = event.whole.begin <= t && event.endClipped > t;
ctx.fillStyle = event.context?.color || inactive;
ctx.strokeStyle = event.context?.color || active;
ctx.globalAlpha = event.context.velocity ?? event.value?.gain ?? 1;
const timePx = scale((event.whole.begin - (flipTime ? to : from)) / timeExtent, ...timeRange);
let durationPx = scale(event.duration / timeExtent, 0, timeAxis);
const value = getValue(event);
const valuePx = scale(
fold ? foldValues.indexOf(value) / foldValues.length : (Number(value) - minMidi) / valueExtent,
...valueRange,
);
let margin = 0;
const offset = scale(t / timeExtent, ...timeRange);
let coords;
if (vertical) {
coords = [
valuePx + 1 - (flipValues ? barThickness : 0), // x
timeAxis - offset + timePx + margin + 1 - (flipTime ? 0 : durationPx), // y
barThickness - 2, // width
durationPx - 2, // height
];
} else {
coords = [
timePx - offset + margin + 1 - (flipTime ? durationPx : 0), // x
valuePx + 1 - (flipValues ? 0 : barThickness), // y
durationPx - 2, // widith
barThickness - 2, // height
];
}
isActive ? ctx.strokeRect(...coords) : ctx.fillRect(...coords);
if (labels) {
const label = event.value.note ?? event.value.s + (event.value.n ? `:${event.value.n}` : '');
ctx.font = `${barThickness * 0.75}px monospace`;
ctx.strokeStyle = 'black';
ctx.fillStyle = isActive ? 'white' : 'black';
ctx.textBaseline = 'top';
ctx.fillText(label, ...coords);
}
});
ctx.globalAlpha = 1; // reset!
const playheadPosition = scale(-from / timeExtent, ...timeRange);
// draw playhead
ctx.strokeStyle = playheadColor;
ctx.beginPath();
if (vertical) {
ctx.moveTo(0, playheadPosition);
ctx.lineTo(valueAxis, playheadPosition);
} else {
ctx.moveTo(playheadPosition, 0);
ctx.lineTo(playheadPosition, valueAxis);
}
ctx.stroke();
},
{
from: from - overscan,
to: to + overscan,
onQuery: (events) => {
const { min, max, values } = events.reduce(
({ min, max, values }, e) => {
const v = getValue(e);
return {
min: v < min ? v : min,
max: v > max ? v : max,
values: values.includes(v) ? values : [...values, v],
};
},
{ min: Infinity, max: -Infinity, values: [] },
);
if (autorange) {
minMidi = min;
maxMidi = max;
valueExtent = maxMidi - minMidi + 1;
}
foldValues = values.sort((a, b) => String(a).localeCompare(String(b)));
barThickness = fold ? valueAxis / foldValues.length : valueAxis / valueExtent;
},
},
);
return this;
};
// this function allows drawing a pianoroll without ties to Pattern.prototype
// it will probably replace the above in the future
export function pianoroll({
time,
haps,
cycles = 4,
playhead = 0.5,
flipTime = 0,
flipValues = 0,
hideNegative = false,
// inactive = '#C9E597',
// inactive = '#FFCA28',
inactive = '#7491D2',
active = '#FFCA28',
// background = '#2A3236',
background = 'transparent',
smear = 0,
playheadColor = 'white',
minMidi = 10,
maxMidi = 90,
autorange = 0,
timeframe: timeframeProp,
fold = 0,
vertical = 0,
labels = false,
ctx,
} = {}) {
const w = ctx.canvas.width;
const h = ctx.canvas.height;
let from = -cycles * playhead;
let to = cycles * (1 - playhead);
if (timeframeProp) {
console.warn('timeframe is deprecated! use from/to instead');
from = 0;
to = timeframeProp;
}
const timeAxis = vertical ? h : w;
const valueAxis = vertical ? w : h;
let timeRange = vertical ? [timeAxis, 0] : [0, timeAxis]; // pixel range for time
const timeExtent = to - from; // number of seconds that fit inside the canvas frame
const valueRange = vertical ? [0, valueAxis] : [valueAxis, 0]; // pixel range for values
let valueExtent = maxMidi - minMidi + 1; // number of "slots" for values, overwritten if autorange true
let barThickness = valueAxis / valueExtent; // pixels per value, overwritten if autorange true
let foldValues = [];
flipTime && timeRange.reverse();
flipValues && valueRange.reverse();
// onQuery
const { min, max, values } = haps.reduce(
({ min, max, values }, e) => {
const v = getValue(e);
return {
min: v < min ? v : min,
max: v > max ? v : max,
values: values.includes(v) ? values : [...values, v],
};
},
{ min: Infinity, max: -Infinity, values: [] },
);
if (autorange) {
minMidi = min;
maxMidi = max;
valueExtent = maxMidi - minMidi + 1;
}
// foldValues = values.sort((a, b) => a - b);
foldValues = values.sort((a, b) => String(a).localeCompare(String(b)));
barThickness = fold ? valueAxis / foldValues.length : valueAxis / valueExtent;
ctx.fillStyle = background;
ctx.globalAlpha = 1; // reset!
if (!smear) {
ctx.clearRect(0, 0, w, h);
ctx.fillRect(0, 0, w, h);
}
/* const inFrame = (event) =>
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= time + to && event.whole.end >= time + from; */
haps
// .filter(inFrame)
.forEach((event) => {
const isActive = event.whole.begin <= time && event.whole.end > time;
const color = event.value?.color || event.context?.color;
ctx.fillStyle = color || inactive;
ctx.strokeStyle = color || active;
ctx.globalAlpha = event.context.velocity ?? event.value?.gain ?? 1;
const timePx = scale((event.whole.begin - (flipTime ? to : from)) / timeExtent, ...timeRange);
let durationPx = scale(event.duration / timeExtent, 0, timeAxis);
const value = getValue(event);
const valuePx = scale(
fold ? foldValues.indexOf(value) / foldValues.length : (Number(value) - minMidi) / valueExtent,
...valueRange,
);
let margin = 0;
const offset = scale(time / timeExtent, ...timeRange);
let coords;
if (vertical) {
coords = [
valuePx + 1 - (flipValues ? barThickness : 0), // x
timeAxis - offset + timePx + margin + 1 - (flipTime ? 0 : durationPx), // y
barThickness - 2, // width
durationPx - 2, // height
];
} else {
coords = [
timePx - offset + margin + 1 - (flipTime ? durationPx : 0), // x
valuePx + 1 - (flipValues ? 0 : barThickness), // y
durationPx - 2, // widith
barThickness - 2, // height
];
}
isActive ? ctx.strokeRect(...coords) : ctx.fillRect(...coords);
if (labels) {
const label = event.value.note ?? event.value.s + (event.value.n ? `:${event.value.n}` : '');
ctx.font = `${barThickness * 0.75}px monospace`;
ctx.strokeStyle = 'black';
ctx.fillStyle = isActive ? 'white' : 'black';
ctx.textBaseline = 'top';
ctx.fillText(label, ...coords);
}
});
ctx.globalAlpha = 1; // reset!
const playheadPosition = scale(-from / timeExtent, ...timeRange);
// draw playhead
ctx.strokeStyle = playheadColor;
ctx.beginPath();
if (vertical) {
ctx.moveTo(0, playheadPosition);
ctx.lineTo(valueAxis, playheadPosition);
} else {
ctx.moveTo(playheadPosition, 0);
ctx.lineTo(playheadPosition, valueAxis);
}
ctx.stroke();
return this;
}
export function getDrawOptions(drawTime, options = {}) {
let [lookbehind, lookahead] = drawTime;
lookbehind = Math.abs(lookbehind);
const cycles = lookahead + lookbehind;
const playhead = lookbehind / cycles;
return { fold: 1, ...options, cycles, playhead };
}
Pattern.prototype.punchcard = function (options) {
return this.onPaint((ctx, time, haps, drawTime) =>
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, options) }),
);
};
/* Pattern.prototype.pianoroll = function (options) {
return this.onPaint((ctx, time, haps, drawTime) =>
pianoroll({ ctx, time, haps, ...getDrawOptions(drawTime, { fold: 0, ...options }) }),
);
}; */
export function drawPianoroll(options) {
const { drawTime, ...rest } = options;
pianoroll({ ...getDrawOptions(drawTime), ...rest });
}
+97
View File
@@ -0,0 +1,97 @@
import { Cyclist } from './cyclist.mjs';
import { evaluate as _evaluate } from './evaluate.mjs';
import { logger } from './logger.mjs';
import { setTime } from './time.mjs';
import { evalScope } from './evaluate.mjs';
import { register } from './pattern.mjs';
export function repl({
interval,
defaultOutput,
onSchedulerError,
onEvalError,
beforeEval,
afterEval,
getTime,
transpiler,
onToggle,
editPattern,
}) {
const scheduler = new Cyclist({
interval,
onTrigger: getTrigger({ defaultOutput, getTime }),
onError: onSchedulerError,
getTime,
onToggle,
});
const setPattern = (pattern, autostart = true) => {
pattern = editPattern?.(pattern) || pattern;
scheduler.setPattern(pattern, autostart);
};
setTime(() => scheduler.now()); // TODO: refactor?
const evaluate = async (code, autostart = true) => {
if (!code) {
throw new Error('no code to evaluate');
}
try {
await beforeEval?.({ code });
let { pattern } = await _evaluate(code, transpiler);
logger(`[eval] code updated`);
setPattern(pattern, autostart);
afterEval?.({ code, pattern });
return pattern;
} catch (err) {
// console.warn(`[repl] eval error: ${err.message}`);
logger(`[eval] error: ${err.message}`, 'error');
onEvalError?.(err);
}
};
const stop = () => scheduler.stop();
const start = () => scheduler.start();
const pause = () => scheduler.pause();
const setCps = (cps) => scheduler.setCps(cps);
const setCpm = (cpm) => scheduler.setCps(cpm / 60);
// the following functions use the cps value, which is why they are defined here..
const loopAt = register('loopAt', (cycles, pat) => {
return pat.loopAtCps(cycles, scheduler.cps);
});
const fit = register('fit', (pat) =>
pat.withHap((hap) =>
hap.withValue((v) => ({
...v,
speed: scheduler.cps / hap.whole.duration, // overwrite speed completely?
unit: 'c',
})),
),
);
evalScope({
loopAt,
fit,
setCps,
setcps: setCps,
setCpm,
setcpm: setCpm,
});
return { scheduler, evaluate, start, stop, pause, setCps, setPattern };
}
export const getTrigger =
({ getTime, defaultOutput }) =>
async (hap, deadline, duration, cps) => {
try {
if (!hap.context.onTrigger || !hap.context.dominantTrigger) {
await defaultOutput(hap, deadline, duration, cps);
}
if (hap.context.onTrigger) {
// call signature of output / onTrigger is different...
await hap.context.onTrigger(getTime() + deadline, hap, getTime(), cps);
}
} catch (err) {
logger(`[cyclist] error: ${err.message}`, 'error');
}
};
+312 -93
View File
@@ -5,7 +5,7 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import { Hap } from './hap.mjs';
import { Pattern, fastcat, reify, silence, stack } from './pattern.mjs';
import { Pattern, fastcat, reify, silence, stack, register } from './pattern.mjs';
import Fraction from './fraction.mjs';
import { id } from './util.mjs';
@@ -20,20 +20,20 @@ export const signal = (func) => {
};
export const isaw = signal((t) => 1 - (t % 1));
export const isaw2 = isaw._toBipolar();
export const isaw2 = isaw.toBipolar();
/**
* A sawtooth signal between 0 and 1.
*
* @return {Pattern}
* @example
* "c3 [eb3,g3] g2 [g3,bb3]".legato(saw.slow(4))
* "c3 [eb3,g3] g2 [g3,bb3]".note().clip(saw.slow(4))
* @example
* saw.range(0,8).segment(8).scale('C major').slow(4)
* saw.range(0,8).segment(8).scale('C major').slow(4).note()
*
*/
export const saw = signal((t) => t % 1);
export const saw2 = saw._toBipolar();
export const saw2 = saw.toBipolar();
export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t));
@@ -42,41 +42,39 @@ export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t));
*
* @return {Pattern}
* @example
* sine.segment(16).range(0,15).slow(2).scale('C minor')
* sine.segment(16).range(0,15).slow(2).scale('C minor').note()
*
*/
export const sine = sine2._fromBipolar();
export const sine = sine2.fromBipolar();
/**
* A cosine signal between 0 and 1.
*
* @return {Pattern}
* @example
* stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor')
* stack(sine,cosine).segment(16).range(0,15).slow(2).scale('C minor').note()
*
*/
export const cosine = sine._early(Fraction(1).div(4));
export const cosine2 = sine2._early(Fraction(1).div(4));
/**
* A square signal between 0 and 1.
*
* @return {Pattern}
* @example
* square.segment(2).range(0,7).scale('C minor')
* square.segment(2).range(0,7).scale('C minor').note()
*
*/
export const square = signal((t) => Math.floor((t * 2) % 2));
export const square2 = square._toBipolar();
export const square2 = square.toBipolar();
/**
* A triangle signal between 0 and 1.
*
* @return {Pattern}
* @example
* triangle.segment(2).range(0,7).scale('C minor')
* tri.segment(8).range(0,7).scale('C minor').note()
*
*/
export const tri = fastcat(isaw, saw);
@@ -112,28 +110,120 @@ const timeToRandsPrime = (seed, n) => {
const timeToRands = (t, n) => timeToRandsPrime(timeToIntSeed(t), n);
/**
*
*/
/**
* A discrete pattern of numbers from 0 to n-1
* @example
* run(4).scale('C4 major').note()
* // "0 1 2 3".scale('C4 major').note()
*/
export const run = (n) => saw.range(0, n).floor().segment(n);
/**
* A continuous pattern of random numbers, between 0 and 1.
*
* @name rand
* @example
* // randomly change the cutoff
* s("bd sd,hh*4").cutoff(rand.range(500,2000))
*
*/
export const rand = signal(timeToRand);
/**
* A continuous pattern of random numbers, between -1 and 1
*/
export const rand2 = rand.toBipolar();
export const _brandBy = (p) => rand.fmap((x) => x < p);
export const brandBy = (pPat) => reify(pPat).fmap(_brandBy).innerJoin();
export const brand = _brandBy(0.5);
export const _irand = (i) => rand.fmap((x) => Math.trunc(x * i));
/**
* A continuous pattern of random integers, between 0 and n-1.
*
* @name irand
* @param {number} n max value (exclusive)
* @example
* // randomly select scale notes from 0 - 7 (= C to C)
* irand(8).struct("x(3,8)").scale('C minor').note()
*
*/
export const irand = (ipat) => reify(ipat).fmap(_irand).innerJoin();
export const chooseWith = (pat, xs) => {
export const __chooseWith = (pat, xs) => {
xs = xs.map(reify);
if (xs.length == 0) {
return silence;
}
return pat
.range(0, xs.length)
.fmap((i) => xs[Math.floor(i)])
.outerJoin();
return pat.range(0, xs.length).fmap((i) => xs[Math.floor(i)]);
};
/**
* Choose from the list of values (or patterns of values) using the given
* pattern of numbers, which should be in the range of 0..1
* @param {Pattern} pat
* @param {*} xs
* @returns {Pattern}
*/
export const chooseWith = (pat, xs) => {
return __chooseWith(pat, xs).outerJoin();
};
/**
* As with {chooseWith}, but the structure comes from the chosen values, rather
* than the pattern you're using to choose with.
* @param {Pattern} pat
* @param {*} xs
* @returns {Pattern}
*/
export const chooseInWith = (pat, xs) => {
return __chooseWith(pat, xs).innerJoin();
};
/**
* Chooses randomly from the given list of elements.
* @param {...any} xs values / patterns to choose from.
* @returns {Pattern} - a continuous pattern.
*/
export const choose = (...xs) => chooseWith(rand, xs);
/**
* Chooses from the given list of values (or patterns of values), according
* to the pattern that the method is called on. The pattern should be in
* the range 0 .. 1.
* @param {...any} xs
* @returns {Pattern}
*/
Pattern.prototype.choose = function (...xs) {
return chooseWith(this, xs);
};
/**
* As with choose, but the pattern that this method is called on should be
* in the range -1 .. 1
* @param {...any} xs
* @returns {Pattern}
*/
Pattern.prototype.choose2 = function (...xs) {
return chooseWith(this.fromBipolar(), xs);
};
/**
* Picks one of the elements at random each cycle.
* @returns {Pattern}
* @example
* chooseCycles("bd", "hh", "sd").s().fast(4)
* @example
* "bd | hh | sd".s().fast(4)
*/
export const chooseCycles = (...xs) => chooseInWith(rand.segment(1), xs);
export const randcat = chooseCycles;
const _wchooseWith = function (pat, ...pairs) {
const values = pairs.map((pair) => reify(pair[0]));
const weights = [];
@@ -156,6 +246,7 @@ export const wchoose = (...pairs) => wchooseWith(rand, ...pairs);
export const wchooseCycles = (...pairs) => _wchooseWith(rand, ...pairs).innerJoin();
// this function expects pat to be a pattern of floats...
export const perlinWith = (pat) => {
const pata = pat.fmap(Math.floor);
const patb = pat.fmap((t) => Math.floor(t) + 1);
@@ -164,101 +255,229 @@ export const perlinWith = (pat) => {
return pat.sub(pata).fmap(interp).appBoth(pata.fmap(timeToRand)).appBoth(patb.fmap(timeToRand));
};
export const perlin = perlinWith(time);
/**
* Generates a continuous pattern of [perlin noise](https://en.wikipedia.org/wiki/Perlin_noise), in the range 0..1.
*
* @name perlin
* @example
* // randomly change the cutoff
* s("bd sd,hh*4").cutoff(perlin.range(500,2000))
*
*/
export const perlin = perlinWith(time.fmap((v) => Number(v)));
Pattern.prototype._degradeByWith = function (withPat, x) {
return this.fmap((a) => (_) => a).appLeft(withPat._filterValues((v) => v > x));
};
export const degradeByWith = register('degradeByWith', (withPat, x, pat) =>
pat.fmap((a) => (_) => a).appLeft(withPat.filterValues((v) => v > x)),
);
Pattern.prototype._degradeBy = function (x) {
return this._degradeByWith(rand, x);
};
/**
* Randomly removes events from the pattern by a given amount.
* 0 = 0% chance of removal
* 1 = 100% chance of removal
*
* @name degradeBy
* @memberof Pattern
* @param {number} amount - a number between 0 and 1
* @returns Pattern
* @example
* s("hh*8").degradeBy(0.2)
* @example
* s("[hh?0.2]*8")
*/
export const degradeBy = register('degradeBy', function (x, pat) {
return pat._degradeByWith(rand, x);
});
Pattern.prototype.degrade = function () {
return this._degradeBy(0.5);
};
/**
*
* Randomly removes 50% of events from the pattern. Shorthand for `.degradeBy(0.5)`
*
* @name degrade
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").degrade()
* @example
* s("[hh?]*8")
*/
export const degrade = register('degrade', (pat) => pat._degradeBy(0.5));
Pattern.prototype._undegradeBy = function (x) {
return this._degradeByWith(
/**
* Inverse of {@link Pattern#degradeBy}: Randomly removes events from the pattern by a given amount.
* 0 = 100% chance of removal
* 1 = 0% chance of removal
* Events that would be removed by degradeBy are let through by undegradeBy and vice versa (see second example).
*
* @name undegradeBy
* @memberof Pattern
* @param {number} amount - a number between 0 and 1
* @returns Pattern
* @example
* s("hh*8").undegradeBy(0.2)
*/
export const undegradeBy = register('undegradeBy', function (x, pat) {
return pat._degradeByWith(
rand.fmap((r) => 1 - r),
x,
);
};
});
Pattern.prototype.undegrade = function () {
return this._undegradeBy(0.5);
};
export const undegrade = register('undegrade', (pat) => pat._undegradeBy(0.5));
Pattern.prototype._sometimesBy = function (x, func) {
return stack(this._degradeBy(x), func(this._undegradeBy(1 - x)));
};
/**
*
* Randomly applies the given function by the given probability.
* Similar to {@link Pattern#someCyclesBy}
*
* @name sometimesBy
* @memberof Pattern
* @param {number | Pattern} probability - a number between 0 and 1
* @param {function} function - the transformation to apply
* @returns Pattern
* @example
* s("hh(3,8)").sometimesBy(.4, x=>x.speed("0.5"))
*/
Pattern.prototype.sometimesBy = function (patx, func) {
const pat = this;
export const sometimesBy = register('sometimesBy', function (patx, func, pat) {
return reify(patx)
.fmap((x) => pat._sometimesBy(x, func))
.fmap((x) => stack(pat._degradeBy(x), func(pat._undegradeBy(1 - x))))
.innerJoin();
};
});
Pattern.prototype._sometimesByPre = function (x, func) {
return stack(this._degradeBy(x), func(this).undegradeBy(1 - x));
};
/**
*
* Applies the given function with a 50% chance
*
* @name sometimes
* @memberof Pattern
* @param {function} function - the transformation to apply
* @returns Pattern
* @example
* s("hh*4").sometimes(x=>x.speed("0.5"))
*/
export const sometimes = register('sometimes', function (func, pat) {
return pat._sometimesBy(0.5, func);
});
Pattern.prototype.sometimesByPre = function (patx, func) {
const pat = this;
/**
*
* Randomly applies the given function by the given probability on a cycle by cycle basis.
* Similar to {@link Pattern#sometimesBy}
*
* @name someCyclesBy
* @memberof Pattern
* @param {number | Pattern} probability - a number between 0 and 1
* @param {function} function - the transformation to apply
* @returns Pattern
* @example
* s("hh(3,8)").someCyclesBy(.3, x=>x.speed("0.5"))
*/
export const someCyclesBy = register('someCyclesBy', function (patx, func, pat) {
return reify(patx)
.fmap((x) => pat._sometimesByPre(x, func))
.fmap((x) =>
stack(
pat._degradeByWith(rand._segment(1), x),
func(pat._degradeByWith(rand.fmap((r) => 1 - r)._segment(1), 1 - x)),
),
)
.innerJoin();
};
});
Pattern.prototype.sometimes = function (func) {
return this._sometimesBy(0.5, func);
};
/**
*
* Shorthand for `.someCyclesBy(0.5, fn)`
*
* @name someCycles
* @memberof Pattern
* @returns Pattern
* @example
* s("hh(3,8)").someCycles(x=>x.speed("0.5"))
*/
export const someCycles = register('someCycles', function (func, pat) {
return pat._someCyclesBy(0.5, func);
});
Pattern.prototype.sometimesPre = function (func) {
return this._sometimesByPre(0.5, func);
};
/**
*
* Shorthand for `.sometimesBy(0.75, fn)`
*
* @name often
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").often(x=>x.speed("0.5"))
*/
export const often = register('often', function (func, pat) {
return pat.sometimesBy(0.75, func);
});
Pattern.prototype._someCyclesBy = function (x, func) {
return stack(
this._degradeByWith(rand._segment(1), x),
func(this._degradeByWith(rand.fmap((r) => 1 - r)._segment(1), 1 - x)),
);
};
/**
*
* Shorthand for `.sometimesBy(0.25, fn)`
*
* @name rarely
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").rarely(x=>x.speed("0.5"))
*/
export const rarely = register('rarely', function (func, pat) {
return pat.sometimesBy(0.25, func);
});
Pattern.prototype.someCyclesBy = function (patx, func) {
const pat = this;
return reify(patx)
.fmap((x) => pat._someCyclesBy(x, func))
.innerJoin();
};
/**
*
* Shorthand for `.sometimesBy(0.1, fn)`
*
* @name almostNever
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").almostNever(x=>x.speed("0.5"))
*/
export const almostNever = register('almostNever', function (func, pat) {
return pat.sometimesBy(0.1, func);
});
Pattern.prototype.someCycles = function (func) {
return this._someCyclesBy(0.5, func);
};
/**
*
* Shorthand for `.sometimesBy(0.9, fn)`
*
* @name almostAlways
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").almostAlways(x=>x.speed("0.5"))
*/
export const almostAlways = register('almostAlways', function (func, pat) {
return pat.sometimesBy(0.9, func);
});
Pattern.prototype.often = function (func) {
return this.sometimesBy(0.75, func);
};
/**
*
* Shorthand for `.sometimesBy(0, fn)` (never calls fn)
*
* @name never
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").never(x=>x.speed("0.5"))
*/
export const never = register('never', function (_, pat) {
return pat;
});
Pattern.prototype.rarely = function (func) {
return this.sometimesBy(0.25, func);
};
Pattern.prototype.almostNever = function (func) {
return this.sometimesBy(0.1, func);
};
Pattern.prototype.almostAlways = function (func) {
return this.sometimesBy(0.9, func);
};
Pattern.prototype.never = function (func) {
return this;
};
Pattern.prototype.always = function (func) {
return func(this);
};
Pattern.prototype.patternified.push('degradeBy', 'undegradeBy');
/**
*
* Shorthand for `.sometimesBy(1, fn)` (always calls fn)
*
* @name always
* @memberof Pattern
* @returns Pattern
* @example
* s("hh*8").always(x=>x.speed("0.5"))
*/
export const always = register('always', function (func, pat) {
return func(pat);
});
+6 -13
View File
@@ -4,7 +4,7 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { Pattern, patternify2 } from './index.mjs';
import { register } from './index.mjs';
let synth;
try {
@@ -16,7 +16,7 @@ try {
let allVoices = synth?.getVoices();
// console.log('voices', allVoices);
function speak(words, lang, voice) {
function triggerSpeech(words, lang, voice) {
synth.cancel();
const utterance = new SpeechSynthesisUtterance(words);
utterance.lang = lang;
@@ -31,15 +31,8 @@ function speak(words, lang, voice) {
speechSynthesis.speak(utterance);
}
Pattern.prototype._speak = function (lang, voice) {
return this._withHap((hap) => {
const onTrigger = (time, hap) => {
speak(hap.value, lang, voice);
};
return hap.setContext({ ...hap.context, onTrigger });
export const speak = register('speak', function (lang, voice, pat) {
return pat.onTrigger((_, hap) => {
triggerSpeech(hap.value, lang, voice);
});
};
Pattern.prototype.speak = function (lang, voice) {
return patternify2(Pattern.prototype._speak)(reify(lang), reify(voice), this);
};
});
+117
View File
@@ -0,0 +1,117 @@
import { Pattern } from './index.mjs';
// polar coords -> xy
function fromPolar(angle, radius, cx, cy) {
const radians = ((angle - 90) * Math.PI) / 180;
return [cx + Math.cos(radians) * radius, cy + Math.sin(radians) * radius];
}
const xyOnSpiral = (angle, margin, cx, cy, rotate = 0) => fromPolar((angle + rotate) * 360, margin * angle, cx, cy); // TODO: logSpiral
// draw spiral / segment of spiral
function spiralSegment(options) {
let {
ctx,
from = 0,
to = 3,
margin = 50,
cx = 100,
cy = 100,
rotate = 0,
thickness = margin / 2,
color = '#0000ff30',
cap = 'round',
stretch = 1,
fromOpacity = 1,
toOpacity = 1,
} = options;
from *= stretch;
to *= stretch;
rotate *= stretch;
ctx.lineWidth = thickness;
ctx.lineCap = cap;
ctx.strokeStyle = color;
ctx.globalAlpha = fromOpacity;
ctx.beginPath();
let [sx, sy] = xyOnSpiral(from, margin, cx, cy, rotate);
ctx.moveTo(sx, sy);
const increment = 1 / 60;
let angle = from;
while (angle <= to) {
const [x, y] = xyOnSpiral(angle, margin, cx, cy, rotate);
//ctx.lineWidth = angle*thickness;
ctx.globalAlpha = ((angle - from) / (to - from)) * toOpacity;
ctx.lineTo(x, y);
angle += increment;
}
ctx.stroke();
}
Pattern.prototype.spiral = function (options = {}) {
const {
stretch = 1,
size = 80,
thickness = size / 2,
cap = 'butt', // round butt squar,
inset = 3, // start angl,
playheadColor = '#ffffff90',
playheadLength = 0.02,
playheadThickness = thickness,
padding = 0,
steady = 1,
inactiveColor = '#ffffff20',
colorizeInactive = 0,
fade = true,
// logSpiral = true,
} = options;
function spiral({ ctx, time, haps, drawTime }) {
ctx.clearRect(0, 0, ctx.canvas.clientWidth, ctx.canvas.clientHeight);
const [cx, cy] = [ctx.canvas.width / 2, ctx.canvas.height / 2];
const settings = {
margin: size / stretch,
cx,
cy,
stretch,
cap,
thickness,
};
const playhead = {
...settings,
thickness: playheadThickness,
from: inset - playheadLength,
to: inset,
color: playheadColor,
};
const [min] = drawTime;
const rotate = steady * time;
haps.forEach((hap) => {
const isActive = hap.whole.begin <= time && hap.endClipped > time;
const from = hap.whole.begin - time + inset;
const to = hap.endClipped - time + inset - padding;
const { color } = hap.context;
const opacity = fade ? 1 - Math.abs((hap.whole.begin - time) / min) : 1;
spiralSegment({
ctx,
...settings,
from,
to,
rotate,
color: colorizeInactive || isActive ? color : inactiveColor,
fromOpacity: opacity,
toOpacity: opacity,
});
});
spiralSegment({
ctx,
...playhead,
rotate,
});
}
return this.onPaint((ctx, time, haps, drawTime) => spiral({ ctx, time, haps, drawTime }));
};
+28
View File
@@ -0,0 +1,28 @@
/*
controls.test.mjs - <short description TODO>
Copyright (C) 2023 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/test/controls.test.mjs>
This 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/>.
*/
import controls 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' }]);
});
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([
{ 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([
{ s: 'bd', n: 3, gain: 0.4 },
{ s: 'sd', n: 4, gain: 0.5 },
]);
});
});
+21 -31
View File
@@ -5,52 +5,42 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import { fastcat, stack, slowcat, silence, pure } from '../pattern.mjs';
import { strict as assert } from 'assert';
import { describe, it, expect } from 'vitest';
import drawLine from '../drawLine.mjs';
describe('drawLine', () => {
it('supports equal lengths', () => {
assert.equal(drawLine(fastcat(0), 4), '|0|0');
assert.equal(drawLine(fastcat(0, 1), 4), '|01|01');
assert.equal(drawLine(fastcat(0, 1, 2), 6), '|012|012');
expect(drawLine(fastcat(0), 4)).toEqual('|0|0');
expect(drawLine(fastcat(0, 1), 4)).toEqual('|01|01');
expect(drawLine(fastcat(0, 1, 2), 6)).toEqual('|012|012');
});
it('supports unequal lengths', () => {
assert.equal(drawLine(fastcat(0, [1, 2]), 10), '|0-12|0-12');
assert.equal(drawLine(fastcat(0, [1, 2, 3]), 10), '|0--123|0--123');
assert.equal(drawLine(fastcat(0, 1, [2, 3]), 10), '|0-1-23|0-1-23');
expect(drawLine(fastcat(0, [1, 2]), 10)).toEqual('|0-12|0-12');
expect(drawLine(fastcat(0, [1, 2, 3]), 10)).toEqual('|0--123|0--123');
expect(drawLine(fastcat(0, 1, [2, 3]), 10)).toEqual('|0-1-23|0-1-23');
});
it('supports unequal silence', () => {
assert.equal(drawLine(fastcat(0, silence, [1, 2]), 10), '|0-..12|0-..12');
expect(drawLine(fastcat(0, silence, [1, 2]), 10)).toEqual('|0-..12|0-..12');
});
it('supports polyrhythms', () => {
'0*2 1*3';
assert.equal(drawLine(fastcat(pure(0).fast(2), pure(1).fast(3)), 10), '|0--0--1-1-1-');
// assert.equal(drawLine(fastcat(pure(0).fast(2), pure(1).fast(3)), 10), '|0--0--1-1-1-');
expect(drawLine(fastcat(pure(0).fast(2), pure(1).fast(3)), 10)).toEqual('|0--0--1-1-1-');
});
it('supports multiple lines', () => {
assert.equal(
drawLine(fastcat(0, stack(1, 2)), 10),
`|01|01|01|01
|.2|.2|.2|.2`,
);
assert.equal(
drawLine(fastcat(0, 1, stack(2, 3)), 10),
`|012|012|012
|..3|..3|..3`,
);
assert.equal(
drawLine(fastcat(0, stack(1, 2, 3)), 10),
`|01|01|01|01
expect(drawLine(fastcat(0, stack(1, 2)), 10)).toEqual(`|01|01|01|01
|.2|.2|.2|.2`);
expect(drawLine(fastcat(0, 1, stack(2, 3)), 10)).toEqual(`|012|012|012
|..3|..3|..3`);
expect(drawLine(fastcat(0, stack(1, 2, 3)), 10)).toEqual(`|01|01|01|01
|.2|.2|.2|.2
|.3|.3|.3|.3`,
);
assert.equal(
drawLine(fastcat(0, 1, stack(2, 3, 4)), 10),
`|012|012|012
|.3|.3|.3|.3`);
expect(drawLine(fastcat(0, 1, stack(2, 3, 4)), 10)).toEqual(`|012|012|012
|..3|..3|..3
|..4|..4|..4`,
);
|..4|..4|..4`);
});
it('supports unequal cycle lengths', () => {
assert.equal(drawLine(slowcat(0, [1, 2]), 10), `|0|12|0|12`);
expect(drawLine(slowcat(0, [1, 2]), 10)).toEqual(`|0|12|0|12`);
});
});
+2 -2
View File
@@ -5,11 +5,11 @@ This program is free software: you can redistribute it and/or modify it under th
*/
import Fraction, { gcd } from '../fraction.mjs';
import { strict as assert } from 'assert';
import { describe, it, expect } from 'vitest';
describe('gcd', () => {
it('should work', () => {
const F = Fraction._original;
assert.equal(gcd(F(1 / 6), F(1 / 4)).toFraction(), '1/12');
expect(gcd(F(1 / 6), F(1 / 4)).toFraction()).toEqual('1/12');
});
});
File diff suppressed because it is too large Load Diff
+40
View File
@@ -0,0 +1,40 @@
/*test for issue 302 support alternative solmization types */
import { sol2note } from '../util.mjs';
import { test } from 'vitest';
import assert from 'assert';
test('solmization - letters', () => {
const result = sol2note(60, 'letters');
const expected = 'C4';
assert.equal(result, expected);
});
test('solmization - solfeggio', () => {
const result = sol2note(60, 'solfeggio');
const expected = 'Do4';
assert.equal(result, expected);
});
test('solmization - indian', () => {
const result = sol2note(60, 'indian');
const expected = 'Sa4';
assert.equal(result, expected);
});
test('solmization - german', () => {
const result = sol2note(60, 'german');
const expected = 'C4';
assert.equal(result, expected);
});
test('solmization - byzantine', () => {
const result = sol2note(60, 'byzantine');
const expected = 'Ni4';
assert.equal(result, expected);
});
test('solmization - japanese', () => {
const result = sol2note(60, 'japanese');
const expected = 'I4';
assert.equal(result, expected);
});
+180 -65
View File
@@ -1,120 +1,235 @@
/*
util.test.mjs - <short description TODO>
util.test.mjs - Tests for the core 'util' module
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/core/test/util.test.mjs>
This 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/>.
*/
import { strict as assert } from 'assert';
import { pure } from '../pattern.mjs';
import { isNote, tokenizeNote, toMidi, fromMidi, mod, compose, getFrequency } from '../util.mjs';
import {
isNote,
tokenizeNote,
noteToMidi,
midiToFreq,
freqToMidi,
_mod,
compose,
getFrequency,
getPlayableNoteValue,
parseNumeral,
parseFractional,
numeralArgs,
fractionalArgs,
} from '../util.mjs';
import { describe, it, expect } from 'vitest';
describe('isNote', () => {
it('should recognize notes without accidentals', () => {
'C3 D3 E3 F3 G3 A3 B3 C4 D5 c5 d5 e5'.split(' ').forEach((note) => {
assert.equal(isNote(note), true);
expect(isNote(note)).toBe(true);
});
});
it('should recognize notes with accidentals', () => {
'C#3 D##3 Eb3 Fbb3 Bb5'.split(' ').forEach((note) => {
assert.equal(isNote(note), true);
expect(isNote(note)).toBe(true);
});
});
it('should recognize notes without octave', () => {
expect(isNote('C')).toBe(true);
expect(isNote('Bb')).toBe(true);
});
it('should not recognize invalid notes', () => {
assert.equal(isNote('H5'), false);
assert.equal(isNote('C'), false);
assert.equal(isNote('X'), false);
assert.equal(isNote(1), false);
expect(isNote('H5')).toBe(false);
expect(isNote('X')).toBe(false);
expect(isNote(1)).toBe(false);
});
});
describe('isNote', () => {
it('should tokenize notes without accidentals', () => {
assert.deepStrictEqual(tokenizeNote('C3'), ['C', '', 3]);
assert.deepStrictEqual(tokenizeNote('D3'), ['D', '', 3]);
assert.deepStrictEqual(tokenizeNote('E3'), ['E', '', 3]);
assert.deepStrictEqual(tokenizeNote('F3'), ['F', '', 3]);
assert.deepStrictEqual(tokenizeNote('G3'), ['G', '', 3]);
assert.deepStrictEqual(tokenizeNote('A3'), ['A', '', 3]);
assert.deepStrictEqual(tokenizeNote('B3'), ['B', '', 3]);
assert.deepStrictEqual(tokenizeNote('C4'), ['C', '', 4]);
assert.deepStrictEqual(tokenizeNote('D5'), ['D', '', 5]);
expect(tokenizeNote('C3')).toStrictEqual(['C', '', 3]);
expect(tokenizeNote('D3')).toStrictEqual(['D', '', 3]);
expect(tokenizeNote('E3')).toStrictEqual(['E', '', 3]);
expect(tokenizeNote('F3')).toStrictEqual(['F', '', 3]);
expect(tokenizeNote('G3')).toStrictEqual(['G', '', 3]);
expect(tokenizeNote('A3')).toStrictEqual(['A', '', 3]);
expect(tokenizeNote('B3')).toStrictEqual(['B', '', 3]);
expect(tokenizeNote('C4')).toStrictEqual(['C', '', 4]);
expect(tokenizeNote('D5')).toStrictEqual(['D', '', 5]);
});
it('should tokenize notes with accidentals', () => {
assert.deepStrictEqual(tokenizeNote('C#3'), ['C', '#', 3]);
assert.deepStrictEqual(tokenizeNote('D##3'), ['D', '##', 3]);
assert.deepStrictEqual(tokenizeNote('Eb3'), ['E', 'b', 3]);
assert.deepStrictEqual(tokenizeNote('Fbb3'), ['F', 'bb', 3]);
assert.deepStrictEqual(tokenizeNote('Bb5'), ['B', 'b', 5]);
expect(tokenizeNote('C#3')).toStrictEqual(['C', '#', 3]);
expect(tokenizeNote('D##3')).toStrictEqual(['D', '##', 3]);
expect(tokenizeNote('Eb3')).toStrictEqual(['E', 'b', 3]);
expect(tokenizeNote('Fbb3')).toStrictEqual(['F', 'bb', 3]);
expect(tokenizeNote('Bb5')).toStrictEqual(['B', 'b', 5]);
});
it('should tokenize notes without octave', () => {
assert.deepStrictEqual(tokenizeNote('C'), ['C', '', undefined]);
assert.deepStrictEqual(tokenizeNote('C#'), ['C', '#', undefined]);
assert.deepStrictEqual(tokenizeNote('Bb'), ['B', 'b', undefined]);
assert.deepStrictEqual(tokenizeNote('Bbb'), ['B', 'bb', undefined]);
expect(tokenizeNote('C')).toStrictEqual(['C', '', undefined]);
expect(tokenizeNote('C#')).toStrictEqual(['C', '#', undefined]);
expect(tokenizeNote('Bb')).toStrictEqual(['B', 'b', undefined]);
expect(tokenizeNote('Bbb')).toStrictEqual(['B', 'bb', undefined]);
});
it('should not tokenize invalid notes', () => {
assert.deepStrictEqual(tokenizeNote('X'), []);
assert.deepStrictEqual(tokenizeNote('asfasf'), []);
assert.deepStrictEqual(tokenizeNote(123), []);
expect(tokenizeNote('X')).toStrictEqual([]);
expect(tokenizeNote('asfasf')).toStrictEqual([]);
expect(tokenizeNote(123)).toStrictEqual([]);
});
});
describe('toMidi', () => {
describe('noteToMidi', () => {
it('should turn notes into midi', () => {
assert.equal(toMidi('A4'), 69);
assert.equal(toMidi('C4'), 60);
assert.equal(toMidi('Db4'), 61);
assert.equal(toMidi('C3'), 48);
assert.equal(toMidi('Cb3'), 47);
assert.equal(toMidi('Cbb3'), 46);
assert.equal(toMidi('C#3'), 49);
assert.equal(toMidi('C#3'), 49);
assert.equal(toMidi('C##3'), 50);
expect(noteToMidi('A4')).toEqual(69);
expect(noteToMidi('C4')).toEqual(60);
expect(noteToMidi('Db4')).toEqual(61);
expect(noteToMidi('C3')).toEqual(48);
expect(noteToMidi('Cb3')).toEqual(47);
expect(noteToMidi('Cbb3')).toEqual(46);
expect(noteToMidi('C#3')).toEqual(49);
expect(noteToMidi('C#3')).toEqual(49);
expect(noteToMidi('C##3')).toEqual(50);
});
it('should throw an error when given a non-note', () => {
expect(() => noteToMidi('Q')).toThrowError(`not a note: "Q"`);
expect(() => noteToMidi('Z')).toThrowError(`not a note: "Z"`);
});
});
describe('fromMidi', () => {
describe('midiToFreq', () => {
it('should turn midi into frequency', () => {
assert.equal(fromMidi(69), 440);
assert.equal(fromMidi(57), 220);
expect(midiToFreq(69)).toEqual(440);
expect(midiToFreq(57)).toEqual(220);
});
});
describe('freqToMidi', () => {
it('should turn frequency into midi', () => {
expect(freqToMidi(440)).toEqual(69);
expect(freqToMidi(220)).toEqual(57);
});
});
describe('getFrequency', () => {
const happify = (val, context = {}) => pure(val).firstCycle()[0].setContext(context);
it('should turn note into frequency', () => {
expect(getFrequency(happify('a4'))).toEqual(440);
expect(getFrequency(happify('a3'))).toEqual(220);
});
it('should turn midi into frequency', () => {
const happify = (val, context = {}) => pure(val).firstCycle()[0].setContext(context);
assert.equal(getFrequency(happify('a4')), 440);
assert.equal(getFrequency(happify('a3')), 220);
assert.equal(getFrequency(happify(440, { type: 'frequency' })), 440); // TODO: migrate when values are objects..
assert.equal(getFrequency(happify(432, { type: 'frequency' })), 432);
expect(getFrequency(happify(69, { type: 'midi' }))).toEqual(440);
expect(getFrequency(happify(57, { type: 'midi' }))).toEqual(220);
});
it('should return frequencies unchanged', () => {
expect(getFrequency(happify(440, { type: 'frequency' }))).toEqual(440);
expect(getFrequency(happify(432, { type: 'frequency' }))).toEqual(432);
});
it('should turn object with a "freq" property into frequency', () => {
expect(getFrequency(happify({ freq: 220 }))).toEqual(220);
expect(getFrequency(happify({ freq: 440 }))).toEqual(440);
});
it('should throw an error when given a non-note', () => {
expect(() => getFrequency(happify('Q'))).toThrowError(`not a note or frequency: Q`);
expect(() => getFrequency(happify('Z'))).toThrowError(`not a note or frequency: Z`);
});
});
describe('mod', () => {
describe('_mod', () => {
it('should work like regular modulo with positive numbers', () => {
assert.equal(mod(0, 3), 0);
assert.equal(mod(1, 3), 1);
assert.equal(mod(2, 3), 2);
assert.equal(mod(3, 3), 0);
assert.equal(mod(4, 3), 1);
assert.equal(mod(4, 2), 0);
expect(_mod(0, 3)).toEqual(0);
expect(_mod(1, 3)).toEqual(1);
expect(_mod(2, 3)).toEqual(2);
expect(_mod(3, 3)).toEqual(0);
expect(_mod(4, 3)).toEqual(1);
expect(_mod(4, 2)).toEqual(0);
});
it('should work with negative numbers', () => {
assert.equal(mod(-1, 3), 2);
assert.equal(mod(-2, 3), 1);
assert.equal(mod(-3, 3), 0);
assert.equal(mod(-4, 3), 2);
assert.equal(mod(-5, 3), 1);
assert.equal(mod(-3, 2), 1);
expect(_mod(-1, 3)).toEqual(2);
expect(_mod(-2, 3)).toEqual(1);
expect(_mod(-3, 3)).toEqual(0);
expect(_mod(-4, 3)).toEqual(2);
expect(_mod(-5, 3)).toEqual(1);
expect(_mod(-3, 2)).toEqual(1);
});
});
describe('compose', () => {
const add1 = (a) => a + 1;
it('should compose', () => {
assert.equal(compose(add1, add1)(0), 2);
assert.equal(compose(add1)(0), 1);
expect(compose(add1, add1)(0)).toEqual(2);
expect(compose(add1)(0)).toEqual(1);
});
const addS = (s) => (a) => a + s;
it('should compose left to right', () => {
assert.equal(compose(addS('a'), addS('b'))(''), 'ab');
assert.equal(compose(addS('a'), addS('b'))('x'), 'xab');
expect(compose(addS('a'), addS('b'))('')).toEqual('ab');
expect(compose(addS('a'), addS('b'))('x')).toEqual('xab');
});
});
describe('getPlayableNoteValue', () => {
const happify = (val, context = {}) => pure(val).firstCycle()[0].setContext(context);
it('should return object "note" property', () => {
expect(getPlayableNoteValue(happify({ note: 'a4' }))).toEqual('a4');
});
it('should return object "n" property', () => {
expect(getPlayableNoteValue(happify({ n: 'a4' }))).toEqual('a4');
});
it('should return object "value" property', () => {
expect(getPlayableNoteValue(happify({ value: 'a4' }))).toEqual('a4');
});
it('should turn midi into frequency', () => {
expect(getPlayableNoteValue(happify(57, { type: 'midi' }))).toEqual(220);
});
it('should return frequency value', () => {
expect(getPlayableNoteValue(happify(220, { type: 'frequency' }))).toEqual(220);
});
it('should throw an error if value is not an object, number, or string', () => {
expect(() => getPlayableNoteValue(happify(false))).toThrowError(`not a note: false`);
expect(() => getPlayableNoteValue(happify(undefined))).toThrowError(`not a note: undefined`);
});
});
describe('parseNumeral', () => {
it('should parse numbers as is', () => {
expect(parseNumeral(4)).toBe(4);
expect(parseNumeral(0)).toBe(0);
expect(parseNumeral(20)).toBe(20);
expect(parseNumeral('20')).toBe(20);
expect(parseNumeral(1.5)).toBe(1.5);
});
it('should parse notes', () => {
expect(parseNumeral('c')).toBe(48);
expect(parseNumeral('c4')).toBe(60);
expect(parseNumeral('c#4')).toBe(61);
expect(parseNumeral('db4')).toBe(61);
});
it('should throw an error for unknown strings', () => {
expect(() => parseNumeral('xyz')).toThrowError('cannot parse as numeral: "xyz"');
});
});
describe('parseFractional', () => {
it('should parse numbers as is', () => {
expect(parseFractional(4)).toBe(4);
expect(parseFractional(0)).toBe(0);
expect(parseFractional(20)).toBe(20);
expect(parseFractional('20')).toBe(20);
expect(parseFractional(1.5)).toBe(1.5);
});
it('should parse fractional shorthands values', () => {
expect(parseFractional('w')).toBe(1);
expect(parseFractional('h')).toBe(0.5);
expect(parseFractional('q')).toBe(0.25);
expect(parseFractional('e')).toBe(0.125);
});
it('should throw an error for unknown strings', () => {
expect(() => parseFractional('xyz')).toThrowError('cannot parse as fractional: "xyz"');
});
});
describe('numeralArgs', () => {
it('should convert function arguments to numbers', () => {
const add = numeralArgs((a, b) => a + b);
expect(add('c4', 2)).toBe(62);
});
});
describe('fractionalArgs', () => {
it('should convert function arguments to numbers', () => {
const add = fractionalArgs((a, b) => a + b);
expect(add('q', 2)).toBe(2.25);
});
});
+14 -8
View File
@@ -4,21 +4,27 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { strict as assert } from 'assert';
import { describe, it, expect } from 'vitest';
import { map, valued, mul } from '../value.mjs';
import controls from '../controls.mjs';
const { n } = controls;
describe('Value', () => {
it('unionWith', () => {
const { value } = valued({ freq: 2000, distortion: 1.2 }).unionWith({ distortion: 2 }, mul);
assert.deepStrictEqual(value, { freq: 2000, distortion: 2.4 });
expect(value).toStrictEqual({ freq: 2000, distortion: 2.4 });
});
it('experiments', () => {
assert.equal(map(mul(5), valued(3)).value, 15);
assert.equal(map(mul(null), valued(3)).value, 0);
assert.equal(map(mul(3), valued(null)).value, null);
assert.equal(valued(3).map(mul).ap(3).value, 9);
assert.equal(valued(mul).ap(3).ap(3).value, 9);
assert.equal(valued(3).mul(3).value, 9);
expect(map(mul(5), valued(3)).value).toEqual(15);
expect(map(mul(null), valued(3)).value).toEqual(0);
expect(map(mul(3), valued(null)).value).toEqual(null);
expect(valued(3).map(mul).ap(3).value).toEqual(9);
expect(valued(mul).ap(3).ap(3).value).toEqual(9);
expect(valued(3).mul(3).value).toEqual(9);
});
it('union bare numbers for numeral props', () => {
expect(n(3).cutoff(500).add(10).firstCycleValues).toEqual([{ n: 13, cutoff: 510 }]);
expect(n(3).cutoff(500).mul(2).firstCycleValues).toEqual([{ n: 6, cutoff: 1000 }]);
});
});
+11
View File
@@ -0,0 +1,11 @@
let time;
export function getTime() {
if (!time) {
throw new Error('no time set! use setTime to define a time source');
}
return time();
}
export function setTime(func) {
time = func;
}
+6 -1
View File
@@ -18,6 +18,11 @@ export class TimeSpan {
const end = this.end;
const end_sam = end.sam();
// Support zero-width timespans
if (begin.equals(end)) {
return [new TimeSpan(begin, end)];
}
while (end.gt(begin)) {
// If begin and end are in the same cycle, we're done.
if (begin.sam().equals(end_sam)) {
@@ -105,7 +110,7 @@ export class TimeSpan {
}
show() {
return this.begin.show() + ' -> ' + this.end.show();
return this.begin.show() + ' ' + this.end.show();
}
}
@@ -4,19 +4,14 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { Tone } from './tone.mjs';
export const hideHeader = () => {
document.getElementById('header').style = 'display:none';
};
import { getTime } from './time.mjs';
function frame(callback) {
if (window.strudelAnimation) {
cancelAnimationFrame(window.strudelAnimation);
}
const animate = (animationTime) => {
const toneTime = Tone.getTransport().seconds;
callback(animationTime, toneTime);
callback(animationTime, getTime());
window.strudelAnimation = requestAnimationFrame(animate);
};
requestAnimationFrame(animate);
@@ -31,7 +26,7 @@ export const backgroundImage = function (src, animateOptions = {}) {
({
style: () => (container.style = bg + ';' + value),
className: () => (container.className = value + ' ' + initialClassName),
}[option]());
})[option]();
};
const funcOptions = Object.entries(animateOptions).filter(([_, v]) => typeof v === 'function');
const stringOptions = Object.entries(animateOptions).filter(([_, v]) => typeof v === 'string');
@@ -51,6 +46,7 @@ export const cleanupUi = () => {
const container = document.getElementById('code');
if (container) {
container.style = '';
container.className = 'grow relative'; // has to match App.tsx
// TODO: find a way to remove that duplication..
container.className = 'grow flex text-gray-100 relative overflow-auto cursor-text pb-0'; // has to match App.tsx
}
};
+185 -20
View File
@@ -5,12 +5,13 @@ This program is free software: you can redistribute it and/or modify it under th
*/
// returns true if the given string is a note
export const isNote = (name) => /^[a-gA-G][#b]*[0-9]$/.test(name);
export const isNoteWithOctave = (name) => /^[a-gA-G][#bs]*[0-9]$/.test(name);
export const isNote = (name) => /^[a-gA-G][#bsf]*[0-9]?$/.test(name);
export const tokenizeNote = (note) => {
if (typeof note !== 'string') {
return [];
}
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#b]*)([0-9])?$/)?.slice(1) || [];
const [pc, acc = '', oct] = note.match(/^([a-gA-G])([#bsf]*)([0-9])?$/)?.slice(1) || [];
if (!pc) {
return [];
}
@@ -18,30 +19,84 @@ export const tokenizeNote = (note) => {
};
// turns the given note into its midi number representation
export const toMidi = (note) => {
const [pc, acc, oct] = tokenizeNote(note);
export const noteToMidi = (note) => {
const [pc, acc, oct = 3] = tokenizeNote(note);
if (!pc) {
throw new Error('not a note: "' + note + '"');
}
const chroma = { c: 0, d: 2, e: 4, f: 5, g: 7, a: 9, b: 11 }[pc.toLowerCase()];
const offset = acc?.split('').reduce((o, char) => o + { '#': 1, b: -1 }[char], 0) || 0;
const offset = acc?.split('').reduce((o, char) => o + { '#': 1, b: -1, s: 1, f: -1 }[char], 0) || 0;
return (Number(oct) + 1) * 12 + chroma + offset;
};
export const fromMidi = (n) => {
export const midiToFreq = (n) => {
return Math.pow(2, (n - 69) / 12) * 440;
};
// modulo that works with negative numbers e.g. mod(-1, 3) = 2
// const mod = (n: number, m: number): number => (n < 0 ? mod(n + m, m) : n % m);
export const mod = (n, m) => ((n % m) + m) % m;
export const freqToMidi = (freq) => {
return (12 * Math.log(freq / 440)) / Math.LN2 + 69;
};
export const valueToMidi = (value, fallbackValue) => {
if (typeof value !== 'object') {
throw new Error('valueToMidi: expected object value');
}
let { freq, note } = value;
if (typeof freq === 'number') {
return freqToMidi(freq);
}
if (typeof note === 'string') {
return noteToMidi(note);
}
if (typeof note === 'number') {
return note;
}
if (!fallbackValue) {
throw new Error('valueToMidi: expected freq or note to be set');
}
return fallbackValue;
};
/**
* @deprecated does not appear to be referenced or invoked anywhere in the codebase
* @noAutocomplete
*/
export const getFreq = (noteOrMidi) => {
if (typeof noteOrMidi === 'number') {
return midiToFreq(noteOrMidi);
}
return midiToFreq(noteToMidi(noteOrMidi));
};
const pcs = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'];
/**
* @deprecated only used in workshop (first-notes)
* @noAutocomplete
*/
export const midi2note = (n) => {
const oct = Math.floor(n / 12) - 1;
const pc = pcs[n % 12];
return pc + oct;
};
// modulo that works with negative numbers e.g. _mod(-1, 3) = 2. Works on numbers (rather than patterns of numbers, as @mod@ from pattern.mjs does)
export const _mod = (n, m) => ((n % m) + m) % m;
export const getPlayableNoteValue = (hap) => {
let { value: note, context } = hap;
let { value, context } = hap;
let note = value;
if (typeof note === 'object' && !Array.isArray(note)) {
note = note.note || note.n || note.value;
if (note === undefined) {
throw new Error(`cannot find a playable note for ${JSON.stringify(value)}`);
}
}
// if value is number => interpret as midi number as long as its not marked as frequency
if (typeof note === 'number' && context.type !== 'frequency') {
note = fromMidi(hap.value);
} else if (typeof note === 'string' && !isNote(note)) {
throw new Error('not a note: ' + note);
note = midiToFreq(hap.value);
} else if (typeof note === 'number' && context.type === 'frequency') {
note = hap.value; // legacy workaround.. will be removed in the future
} else if (typeof note !== 'string' || !isNote(note)) {
throw new Error('not a note: ' + JSON.stringify(note));
}
return note;
};
@@ -49,15 +104,18 @@ export const getPlayableNoteValue = (hap) => {
export const getFrequency = (hap) => {
let { value, context } = hap;
// if value is number => interpret as midi number as long as its not marked as frequency
if (typeof value === 'object' && value.freq) {
return value.freq;
if (typeof value === 'object') {
if (value.freq) {
return value.freq;
}
return getFreq(value.note || value.n || value.value);
}
if (typeof value === 'number' && context.type !== 'frequency') {
value = fromMidi(hap.value);
value = midiToFreq(hap.value);
} else if (typeof value === 'string' && isNote(value)) {
value = fromMidi(toMidi(hap.value));
value = midiToFreq(noteToMidi(hap.value));
} else if (typeof value !== 'number') {
throw new Error('not a note or frequency:' + value);
throw new Error('not a note or frequency: ' + value);
}
return value;
};
@@ -86,9 +144,9 @@ export const constant = (a, b) => a;
export const listRange = (min, max) => Array.from({ length: max - min + 1 }, (_, i) => i + min);
export function curry(func, overload) {
export function curry(func, overload, arity = func.length) {
const fn = function curried(...args) {
if (args.length >= func.length) {
if (args.length >= arity) {
return func.apply(this, args);
} else {
const partial = function (...args2) {
@@ -106,3 +164,110 @@ export function curry(func, overload) {
}
return fn;
}
export function parseNumeral(numOrString) {
const asNumber = Number(numOrString);
if (!isNaN(asNumber)) {
return asNumber;
}
if (isNote(numOrString)) {
return noteToMidi(numOrString);
}
throw new Error(`cannot parse as numeral: "${numOrString}"`);
}
export function mapArgs(fn, mapFn) {
return (...args) => fn(...args.map(mapFn));
}
export function numeralArgs(fn) {
return mapArgs(fn, parseNumeral);
}
export function parseFractional(numOrString) {
const asNumber = Number(numOrString);
if (!isNaN(asNumber)) {
return asNumber;
}
const specialValue = {
pi: Math.PI,
w: 1,
h: 0.5,
q: 0.25,
e: 0.125,
s: 0.0625,
t: 1 / 3,
f: 0.2,
x: 1 / 6,
}[numOrString];
if (typeof specialValue !== 'undefined') {
return specialValue;
}
throw new Error(`cannot parse as fractional: "${numOrString}"`);
}
export const fractionalArgs = (fn) => mapArgs(fn, parseFractional);
export const splitAt = function (index, value) {
return [value.slice(0, index), value.slice(index)];
};
export const zipWith = (f, xs, ys) => xs.map((n, i) => f(n, ys[i]));
export const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
/* solmization, not used yet */
const solfeggio = ['Do', 'Reb', 'Re', 'Mib', 'Mi', 'Fa', 'Solb', 'Sol', 'Lab', 'La', 'Sib', 'Si']; /*solffegio notes*/
const indian = [
'Sa',
'Re',
'Ga',
'Ma',
'Pa',
'Dha',
'Ni',
]; /*indian musical notes, seems like they do not use flats or sharps*/
const german = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Hb', 'H']; /*german & dutch musical notes*/
const byzantine = [
'Ni',
'Pab',
'Pa',
'Voub',
'Vou',
'Ga',
'Dib',
'Di',
'Keb',
'Ke',
'Zob',
'Zo',
]; /*byzantine musical notes*/
const japanese = [
'I',
'Ro',
'Ha',
'Ni',
'Ho',
'He',
'To',
]; /*traditional japanese musical notes, seems like they do not use falts or sharps*/
const english = ['C', 'Db', 'D', 'Eb', 'E', 'F', 'Gb', 'G', 'Ab', 'A', 'Bb', 'B'];
export const sol2note = (n, notation = 'letters') => {
const pc =
notation === 'solfeggio'
? solfeggio /*check if its is any of the following*/
: notation === 'indian'
? indian
: notation === 'german'
? german
: notation === 'byzantine'
? byzantine
: notation === 'japanese'
? japanese
: english; /*if not use standard version*/
const note = pc[n % 12]; /*calculating the midi value to the note*/
const oct = Math.floor(n / 12) - 1;
return note + oct;
};
+7
View File
@@ -7,6 +7,13 @@ This program is free software: you can redistribute it and/or modify it under th
import { curry } from './util.mjs';
export function unionWithObj(a, b, func) {
if (typeof b?.value === 'number') {
// https://github.com/tidalcycles/strudel/issues/262
const numKeys = Object.keys(a).filter((k) => typeof a[k] === 'number');
const numerals = Object.fromEntries(numKeys.map((k) => [k, b.value]));
b = Object.assign(b, numerals);
delete b.value;
}
const common = Object.keys(a).filter((k) => Object.keys(b).includes(k));
return Object.assign({}, a, b, Object.fromEntries(common.map((k) => [k, func(a[k], b[k])])));
}
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import { dependencies } from './package.json';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [],
build: {
lib: {
entry: resolve(__dirname, 'index.mjs'),
formats: ['es', 'cjs'],
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]),
},
rollupOptions: {
external: [...Object.keys(dependencies)],
},
target: 'esnext',
},
});
+49
View File
@@ -0,0 +1,49 @@
// will move to https://github.com/felixroos/zyklus
// TODO: started flag
function createClock(
getTime,
callback, // called slightly before each cycle
duration = 0.05, // duration of each cycle
interval = 0.1, // interval between callbacks
overlap = 0.1, // overlap between callbacks
) {
let tick = 0; // counts callbacks
let phase = 0; // next callback time
let precision = 10 ** 4; // used to round phase
let minLatency = 0.01;
const setDuration = (setter) => (duration = setter(duration));
overlap = overlap || interval / 2;
const onTick = () => {
const t = getTime();
const lookahead = t + interval + overlap; // the time window for this tick
if (phase === 0) {
phase = t + minLatency;
}
// callback as long as we're inside the lookahead
while (phase < lookahead) {
phase = Math.round(phase * precision) / precision;
phase >= t && callback(phase, duration, tick);
phase < t && console.log('TOO LATE', phase); // what if latency is added from outside?
phase += duration; // increment phase by duration
tick++;
}
};
let intervalID;
const start = () => {
clear(); // just in case start was called more than once
onTick();
intervalID = setInterval(onTick, interval * 1000);
};
const clear = () => intervalID !== undefined && clearInterval(intervalID);
const pause = () => clear();
const stop = () => {
tick = 0;
phase = 0;
clear();
};
const getPhase = () => phase;
// setCallback
return { setDuration, start, stop, pause, duration, interval, getPhase, minLatency };
}
export default createClock;
+169
View File
@@ -0,0 +1,169 @@
import { getFrequency, logger, register } from '@strudel.cycles/core';
import { getAudioContext } from '@strudel.cycles/webaudio';
import csd from './project.csd?raw';
// import livecodeOrc from './livecode.orc?raw';
import presetsOrc from './presets.orc?raw';
let csoundLoader, _csound;
// initializes csound + can be used to reevaluate given instrument code
export async function loadCSound(code = '') {
await init();
if (code) {
code = `${code}`;
// ^ ^
// wrapping in backticks makes sure it works when calling as templated function
await _csound?.evalCode(code);
}
}
export const loadcsound = loadCSound;
export const loadCsound = loadCSound;
export const csound = register('csound', (instrument, pat) => {
instrument = instrument || 'triangle';
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
// TODO: find a alternative way to wait for csound to load (to wait with first time playback)
return pat.onTrigger((time, hap) => {
if (!_csound) {
logger('[csound] not loaded yet', 'warning');
return;
}
hap.ensureObjectValue();
let { gain = 0.8 } = hap.value;
gain *= 0.2;
const freq = Math.round(getFrequency(hap));
const controls = Object.entries({ ...hap.value, freq })
.flat()
.join('/');
// TODO: find out how to send a precise ctx based time
// http://www.csounds.com/manual/html/i.html
const params = [
`"${instrument}"`, // p1: instrument name
time - getAudioContext().currentTime, //.toFixed(precision), // p2: starting time in arbitrary unit called beats
hap.duration + 0, // p3: duration in beats
// instrument specific params:
freq, //.toFixed(precision), // p4: frequency
gain, // p5: gain
`"${controls}"`, // p6 controls as string (like superdirt osc message)
];
const msg = `i ${params.join(' ')}`;
_csound.inputMessage(msg);
});
});
function eventLogger(type, args) {
const [msg] = args;
if (
type === 'message' &&
(['[commit: HEAD]'].includes(msg) ||
msg.startsWith('--Csound version') ||
msg.startsWith('libsndfile') ||
msg.startsWith('sr =') ||
msg.startsWith('0dBFS') ||
msg.startsWith('audio buffered') ||
msg.startsWith('writing') ||
msg.startsWith('SECTION 1:'))
) {
// ignore
return;
}
let logType = 'info';
if (msg.startsWith('error:')) {
logType = 'error';
}
logger(`[csound] ${msg || ''}`, logType);
}
async function load() {
if (window.__csound__) {
// Allows using some other csound instance.
// In that case, the external Csound is responsible
// for compiling an orchestra and starting to perform.
logger('[load] Using external Csound', 'warning');
_csound = window.__csound__;
return _csound;
} else {
const { Csound } = await import('@csound/browser');
_csound = await Csound({ audioContext: getAudioContext() });
_csound.removeAllListeners('message');
['message'].forEach((k) => _csound.on(k, (...args) => eventLogger(k, args)));
await _csound.setOption('-m0d'); // see -m flag https://csound.com/docs/manual/CommandFlags.html
await _csound.setOption('--sample-accurate');
await _csound.setOption('-odac');
await _csound.compileCsdText(csd);
// await _csound.compileOrc(livecodeOrc);
await _csound.compileOrc(presetsOrc);
await _csound.start();
return _csound;
}
}
async function init() {
csoundLoader = csoundLoader || load();
return csoundLoader;
}
let orcCache = {};
export async function loadOrc(url) {
await init();
if (typeof url !== 'string') {
throw new Error('loadOrc: expected url string');
}
if (url.startsWith('github:')) {
const [_, path] = url.split('github:');
url = `https://raw.githubusercontent.com/${path}`;
}
if (!orcCache[url]) {
orcCache[url] = fetch(url)
.then((res) => res.text())
.then((code) => _csound.compileOrc(code));
}
await orcCache[url];
}
/**
* Sends notes to Csound for rendering with MIDI semantics. The hap value is
* translated to these Csound pfields:
*
* p1 -- Csound instrument either as a number (1-based, can be a fraction),
* or as a string name.
* p2 -- time in beats (usually seconds) from start of performance.
* p3 -- duration in beats (usually seconds).
* p4 -- MIDI key number (as a real number, not an integer but in [0, 127].
* p5 -- MIDI velocity (as a real number, not an integer but in [0, 127].
* p6 -- Strudel controls, as a string.
*/
export const csoundm = register('csoundm', (instrument, pat) => {
let p1 = instrument;
if (typeof instrument === 'string') {
p1 = `"{instrument}"`;
}
init(); // not async to support csound inside other patterns + to be able to call pattern methods after it
return pat.onTrigger((tidal_time, hap) => {
if (!_csound) {
logger('[csound] not loaded yet', 'warning');
return;
}
if (typeof hap.value !== 'object') {
throw new Error('csound only support objects as hap values');
}
// Time in seconds counting from now.
const p2 = tidal_time - getAudioContext().currentTime;
const p3 = hap.duration.valueOf() + 0;
const frequency = getFrequency(hap);
// Translate frequency to MIDI key number _without_ rounding.
const C4 = 261.62558;
let octave = Math.log(frequency / C4) / Math.log(2.0) + 8.0;
const p4 = octave * 12.0 - 36.0;
// We prefer floating point precision, but over the MIDI range [0, 127].
const p5 = 127 * (hap.context?.velocity ?? 0.9);
// The Strudel controls as a string.
const p6 = Object.entries({ ...hap.value, frequency })
.flat()
.join('/');
const i_statement = `i ${p1} ${p2} ${p3} ${p4} ${p5} "${p6}"`;
console.log('[csoundm]:', i_statement);
_csound.inputMessage(i_statement);
});
});
File diff suppressed because it is too large Load Diff
+42
View File
@@ -0,0 +1,42 @@
{
"name": "@strudel.cycles/csound",
"version": "0.8.0",
"description": "csound bindings for strudel",
"main": "index.mjs",
"publishConfig": {
"main": "dist/index.js",
"module": "dist/index.mjs"
},
"scripts": {
"build": "vite build",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tidalcycles/strudel.git"
},
"keywords": [
"tidalcycles",
"strudel",
"pattern",
"livecoding",
"algorave"
],
"author": "Felix Roos <flix91@gmail.com>",
"contributors": [
"Alex McLean <alex@slab.org>"
],
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@csound/browser": "6.18.7",
"@strudel.cycles/core": "workspace:*",
"@strudel.cycles/webaudio": "workspace:*"
},
"devDependencies": {
"vite": "^4.3.3"
}
}
+96
View File
@@ -0,0 +1,96 @@
; returns value of given key in given "string map"
; keymap("freq", "note/c3/freq/220/gain/0.5")
; yields "220"
opcode keymap, S, SS
Skey, Smap xin
idelimiter = strindex(Smap, strcat(Skey, "/"))
ifrom = idelimiter + strlen(Skey) + 1
Svalue = strsub(Smap, ifrom, strlen(Smap))
Svalue = strsub(Svalue, 0, strindex(Svalue, "/"))
xout Svalue
endop
; TODO add incredibly dope synths
instr organ
iduration = p3
ifreq = p4
igain = p5
ioct = octcps(ifreq)
asig = vco2(igain, ifreq, 12, .5) ; my edit
kpwm = oscili(.1, 5)
asig = vco2(igain, ifreq, 4, .5 + kpwm)
asig += vco2(igain/4, ifreq * 2)
; filter
; idepth = 2
; acut = transegr:a(0, .005, 0, idepth, .06, -4.2, 0.001, .01, -4.2, 0) ; filter envelope
; asig = zdf_2pole(asig, cpsoct(ioct + acut), 0.5)
; amp envelope
iattack = .001
irelease = .05
asig *= linsegr:a(0, iattack, 1, iduration, 1, irelease, 0)
out(asig, asig)
endin
instr triangle
iduration = p3
ifreq = p4
igain = p5
ioct = octcps(ifreq)
asig = vco2(igain, ifreq, 12, .5)
; amp envelope
iattack = .001
irelease = .05
asig *= linsegr:a(0, iattack, 1, iduration, 1, irelease, 0)
out(asig, asig)
endin
instr pad
iduration = p3
ifreq = p4
igain = p5
ioct = octcps(ifreq)
asig = vco2(igain, ifreq, 0)
; amp envelope
iattack = .5
irelease = .1
asig *= linsegr:a(0, iattack, 1, iduration, 1, irelease, 0)
idepth = 2
acut = transegr:a(0, .005, 0, idepth, .06, -4.2, 0.001, .01, -4.2, 0)
asig = zdf_2pole(asig, 1000, 2)
out(asig, asig)
endin
gisine ftgen 0, 0, 4096, 10, 1
instr bow
kpres = 2
krat = 0.16
kvibf = 6.12723
kvib linseg 0, 0.5, 0, 1, 1, p3-0.5, 1
kvamp = kvib * 0.01
asig wgbow .7, p4, kpres, krat, kvibf, kvamp, gisine
asig = asig*p5
outs asig, asig
endin
instr Meta
Smap = strget(p6)
Sinstrument = keymap("s", Smap)
schedule(Sinstrument, 0, p3, p4, p5)
; TODO find a way to pipe Sinstrument through effects
endin
+10
View File
@@ -0,0 +1,10 @@
<CsoundSynthesizer>
<CsInstruments>
sr=48000
ksmps=64
nchnls=2
0dbfs=1
</CsInstruments>
</CsoundSynthesizer>
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import { dependencies } from './package.json';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [],
build: {
lib: {
entry: resolve(__dirname, 'index.mjs'),
formats: ['es', 'cjs'],
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]),
},
rollupOptions: {
external: [...Object.keys(dependencies)],
},
target: 'esnext',
},
});
+16 -10
View File
@@ -10,16 +10,22 @@ Either install with `npm i @strudel.cycles/embed` or just use a cdn to import th
<script src="https://unpkg.com/@strudel.cycles/embed@latest"></script>
<strudel-repl>
<!--
"a4 [a3 c3] a3 c3".color('#F9D649')
.sub("<7 12 5 12>".slow(2))
.off(1/4,x=>x.add(7).color("#FFFFFF #0C3AA1 #C63928"))
.off(1/8,x=>x.add(12).color('#215CB6'))
.slow(2)
.legato(sine.range(0.3, 2).slow(28))
.wave("sawtooth square".fast(2))
.filter('lowpass', cosine.range(500,4000).slow(16))
.out()
.pianoroll({minMidi:20,maxMidi:120,background:'#202124'})
note(`[[e5 [b4 c5] d5 [c5 b4]]
[a4 [a4 c5] e5 [d5 c5]]
[b4 [~ c5] d5 e5]
[c5 a4 a4 ~]
[[~ d5] [~ f5] a5 [g5 f5]]
[e5 [~ c5] e5 [d5 c5]]
[b4 [b4 c5] d5 e5]
[c5 a4 a4 ~]],
[[e2 e3]*4]
[[a2 a3]*4]
[[g#2 g#3]*2 [e2 e3]*2]
[a2 a3 a2 a3 a2 a3 b1 c2]
[[d2 d3]*4]
[[c2 c3]*4]
[[b1 b2]*2 [e2 e3]*2]
[[a1 a2]*4]`).slow(16)
-->
</strudel-repl>
```
+16 -10
View File
@@ -2,15 +2,21 @@
<!-- <script src="./embed.js"></script> -->
<strudel-repl>
<!--
"a4 [a3 c3] a3 c3".color('#F9D649')
.sub("<7 12 5 12>".slow(2))
.off(1/4,x=>x.add(7).color("#FFFFFF #0C3AA1 #C63928"))
.off(1/8,x=>x.add(12).color('#215CB6'))
.slow(2)
.legato(sine.range(0.3, 2).slow(28))
.wave("sawtooth square".fast(2))
.filter('lowpass', cosine.range(500,4000).slow(16))
.out()
.pianoroll({minMidi:20,maxMidi:120,background:'#202124'})
note(`[[e5 [b4 c5] d5 [c5 b4]]
[a4 [a4 c5] e5 [d5 c5]]
[b4 [~ c5] d5 e5]
[c5 a4 a4 ~]
[[~ d5] [~ f5] a5 [g5 f5]]
[e5 [~ c5] e5 [d5 c5]]
[b4 [b4 c5] d5 e5]
[c5 a4 a4 ~]],
[[e2 e3]*4]
[[a2 a3]*4]
[[g#2 g#3]*2 [e2 e3]*2]
[a2 a3 a2 a3 a2 a3 b1 c2]
[[d2 d3]*4]
[[c2 c3]*4]
[[b1 b2]*2 [e2 e3]*2]
[[a1 a2]*4]`).slow(16)
-->
</strudel-repl>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/embed",
"version": "0.1.0",
"version": "0.2.0",
"description": "Embeddable Web Component to load a Strudel REPL into an iframe",
"main": "embed.js",
"type": "module",
+10 -5
View File
@@ -3,6 +3,10 @@
This package contains the strudel code transformer and evaluator.
It allows creating strudel patterns from input code that is optimized for minimal keystrokes and human readability.
## Deprecation Note
This package will not be developed further. Consider using `@strudel.cycles/transpiler` as a replacement.
## Install
```sh
@@ -11,13 +15,14 @@ npm i @strudel.cycles/eval --save
## Example
<!-- TODO: -extend +evalScope -->
```js
import { evaluate, extend } from '@strudel.cycles/eval';
import * as strudel from '@strudel.cycles/core';
import { evalScope } from '@strudel.cycles/core';
import { evaluate } from '@strudel.cycles/eval';
extend(strudel); // add strudel to eval scope
evalScope(
import('@strudel.cycles/core'),
// import other strudel packages here
); // add strudel to eval scope
async function run(code) {
const { pattern } = await evaluate(code);
+2 -39
View File
@@ -4,46 +4,9 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { evaluate as _evaluate } from '@strudel.cycles/core';
import shapeshifter from './shapeshifter.mjs';
import * as strudel from '@strudel.cycles/core';
const { isPattern, Pattern } = strudel;
export const extend = (...args) => {
console.warn('@strudel.cycles/eval extend is deprecated, please use evalScope instead');
Object.assign(globalThis, ...args);
};
let scoped = false;
export const evalScope = async (...args) => {
if (scoped) {
console.warn('@strudel.cycles/eval evalScope was called more than once.');
}
scoped = true;
const results = await Promise.allSettled(args);
const modules = results.filter((result) => result.status === 'fulfilled').map((r) => r.value);
results.forEach((result, i) => {
if (result.status === 'rejected') {
console.warn(`evalScope: module with index ${i} could not be loaded:`, result.reason);
}
});
Object.assign(globalThis, ...modules, Pattern.prototype.bootstrap());
};
function safeEval(str) {
return Function('"use strict";return (' + str + ')')();
}
export const evaluate = async (code) => {
if (!scoped) {
await evalScope(); // at least scope Pattern.prototype.boostrap
}
const shapeshifted = shapeshifter(code); // transform syntactically correct js code to semantically usable code
let evaluated = await safeEval(shapeshifted);
if (!isPattern(evaluated)) {
console.log('evaluated', evaluated);
const message = `got "${typeof evaluated}" instead of pattern`;
throw new Error(message + (typeof evaluated === 'function' ? ', did you forget to call a function?' : '.'));
}
return { mode: 'javascript', pattern: evaluated };
return _evaluate(code, shapeshifter);
};
-297
View File
@@ -1,297 +0,0 @@
{
"name": "@strudel.cycles/eval",
"version": "0.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/eval",
"version": "0.0.3",
"license": "GPL-3.0-or-later",
"dependencies": {
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
"shift-codegen": "^7.0.3",
"shift-parser": "^7.0.3",
"shift-spec": "^2018.0.2",
"shift-traverser": "^1.0.0"
}
},
"node_modules/estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
"engines": {
"node": ">=4.0"
}
},
"node_modules/esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/multimap": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz",
"integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw=="
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/shift-ast": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.1.0.tgz",
"integrity": "sha512-Vj4XUIJIFPIh6VcBGJ1hjH/kM88XGer94Pr7Rvxa+idEylDsrwtLw268HoxGo5xReL6T3DdRl/9/Pr1XihZ/8Q=="
},
"node_modules/shift-codegen": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/shift-codegen/-/shift-codegen-7.0.3.tgz",
"integrity": "sha512-dfCVVdBF0qZ6pkajQ3bjxRdNEltyxEITVe7tBJkQt2eCI3znUkSxq0VSe/tTWq1LKHeAS4HuOiqYEuHMFkSq9w==",
"dependencies": {
"esutils": "^2.0.2",
"object-assign": "^4.1.0",
"shift-reducer": "6.0.0"
}
},
"node_modules/shift-parser": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/shift-parser/-/shift-parser-7.0.3.tgz",
"integrity": "sha512-uYX2ORyZfKZrUc4iKKkO9KOhzUSxCrSBk7QK6ZmShId+BOo1gh1IwecVy97ynyOTpmhPWUttjC8BzsnQl65Zew==",
"dependencies": {
"multimap": "^1.0.2",
"shift-ast": "6.0.0",
"shift-reducer": "6.0.0",
"shift-regexp-acceptor": "2.0.3"
}
},
"node_modules/shift-parser/node_modules/shift-ast": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.0.0.tgz",
"integrity": "sha512-XXxDcEBWVBzqWXfNYJlLyJ1/9kMvOXVRXiqPjkOrTCC5qRsBvEMJMRLLFhU3tn8ue56Y7IZyBE6bexFum5QLUw=="
},
"node_modules/shift-reducer": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-reducer/-/shift-reducer-6.0.0.tgz",
"integrity": "sha512-2rJraRP8drIOjvaE/sALa+0tGJmMVUzlmS3wIJerJbaYuCjpFAiF0WjkTOFVtz1144Nm/ECmqeG+7yRhuMVsMg==",
"dependencies": {
"shift-ast": "6.0.0"
}
},
"node_modules/shift-reducer/node_modules/shift-ast": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.0.0.tgz",
"integrity": "sha512-XXxDcEBWVBzqWXfNYJlLyJ1/9kMvOXVRXiqPjkOrTCC5qRsBvEMJMRLLFhU3tn8ue56Y7IZyBE6bexFum5QLUw=="
},
"node_modules/shift-regexp-acceptor": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/shift-regexp-acceptor/-/shift-regexp-acceptor-2.0.3.tgz",
"integrity": "sha512-sxL7e5JNUFxm+gutFRXktX2D6KVgDAHNuDsk5XHB9Z+N5yXooZG6pdZ1GEbo3Jz6lF7ETYLBC4WAjIFm2RKTmA==",
"dependencies": {
"unicode-match-property-ecmascript": "1.0.4",
"unicode-match-property-value-ecmascript": "1.0.2",
"unicode-property-aliases-ecmascript": "1.0.4"
}
},
"node_modules/shift-spec": {
"version": "2018.0.2",
"resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2018.0.2.tgz",
"integrity": "sha512-5CP/cKDEim4rZ6ViCSipTLY2U7HJr8q/kpDuCBmebFqbx/0DeozWO+9ienHmYjgGLDfHrqj+LBAN67FRK2vE6w=="
},
"node_modules/shift-traverser": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shift-traverser/-/shift-traverser-1.0.0.tgz",
"integrity": "sha512-DMY3512wJbdC+IC+nhLH3/Stgr2BbxbNcg7qyZ6+e5qNnNs8TBQJWdMsRgHlX1JXwF4C0ONKS8VUxsPT0Tf7aw==",
"dependencies": {
"estraverse": "4.2.0",
"shift-spec": "2018.0.0"
}
},
"node_modules/shift-traverser/node_modules/estraverse": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
"integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/shift-traverser/node_modules/shift-spec": {
"version": "2018.0.0",
"resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2018.0.0.tgz",
"integrity": "sha512-/aiPOkj7dbe+CV2VZhIMTHQToZmgniofpRG7Yr7x2/0sO6CSVC++py1Wzf+s+rWSTDHKcLvziVAxjRRV4i4EoQ=="
},
"node_modules/unicode-canonical-property-names-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
"integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ==",
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-match-property-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
"integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
"dependencies": {
"unicode-canonical-property-names-ecmascript": "^1.0.4",
"unicode-property-aliases-ecmascript": "^1.0.4"
},
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-match-property-value-ecmascript": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz",
"integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ==",
"engines": {
"node": ">=4"
}
},
"node_modules/unicode-property-aliases-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz",
"integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg==",
"engines": {
"node": ">=4"
}
}
},
"dependencies": {
"estraverse": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="
},
"esutils": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
},
"multimap": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/multimap/-/multimap-1.1.0.tgz",
"integrity": "sha512-0ZIR9PasPxGXmRsEF8jsDzndzHDj7tIav+JUmvIFB/WHswliFnquxECT/De7GR4yg99ky/NlRKJT82G1y271bw=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"shift-ast": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.1.0.tgz",
"integrity": "sha512-Vj4XUIJIFPIh6VcBGJ1hjH/kM88XGer94Pr7Rvxa+idEylDsrwtLw268HoxGo5xReL6T3DdRl/9/Pr1XihZ/8Q=="
},
"shift-codegen": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/shift-codegen/-/shift-codegen-7.0.3.tgz",
"integrity": "sha512-dfCVVdBF0qZ6pkajQ3bjxRdNEltyxEITVe7tBJkQt2eCI3znUkSxq0VSe/tTWq1LKHeAS4HuOiqYEuHMFkSq9w==",
"requires": {
"esutils": "^2.0.2",
"object-assign": "^4.1.0",
"shift-reducer": "6.0.0"
}
},
"shift-parser": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/shift-parser/-/shift-parser-7.0.3.tgz",
"integrity": "sha512-uYX2ORyZfKZrUc4iKKkO9KOhzUSxCrSBk7QK6ZmShId+BOo1gh1IwecVy97ynyOTpmhPWUttjC8BzsnQl65Zew==",
"requires": {
"multimap": "^1.0.2",
"shift-ast": "6.0.0",
"shift-reducer": "6.0.0",
"shift-regexp-acceptor": "2.0.3"
},
"dependencies": {
"shift-ast": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.0.0.tgz",
"integrity": "sha512-XXxDcEBWVBzqWXfNYJlLyJ1/9kMvOXVRXiqPjkOrTCC5qRsBvEMJMRLLFhU3tn8ue56Y7IZyBE6bexFum5QLUw=="
}
}
},
"shift-reducer": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-reducer/-/shift-reducer-6.0.0.tgz",
"integrity": "sha512-2rJraRP8drIOjvaE/sALa+0tGJmMVUzlmS3wIJerJbaYuCjpFAiF0WjkTOFVtz1144Nm/ECmqeG+7yRhuMVsMg==",
"requires": {
"shift-ast": "6.0.0"
},
"dependencies": {
"shift-ast": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/shift-ast/-/shift-ast-6.0.0.tgz",
"integrity": "sha512-XXxDcEBWVBzqWXfNYJlLyJ1/9kMvOXVRXiqPjkOrTCC5qRsBvEMJMRLLFhU3tn8ue56Y7IZyBE6bexFum5QLUw=="
}
}
},
"shift-regexp-acceptor": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/shift-regexp-acceptor/-/shift-regexp-acceptor-2.0.3.tgz",
"integrity": "sha512-sxL7e5JNUFxm+gutFRXktX2D6KVgDAHNuDsk5XHB9Z+N5yXooZG6pdZ1GEbo3Jz6lF7ETYLBC4WAjIFm2RKTmA==",
"requires": {
"unicode-match-property-ecmascript": "1.0.4",
"unicode-match-property-value-ecmascript": "1.0.2",
"unicode-property-aliases-ecmascript": "1.0.4"
}
},
"shift-spec": {
"version": "2018.0.2",
"resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2018.0.2.tgz",
"integrity": "sha512-5CP/cKDEim4rZ6ViCSipTLY2U7HJr8q/kpDuCBmebFqbx/0DeozWO+9ienHmYjgGLDfHrqj+LBAN67FRK2vE6w=="
},
"shift-traverser": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/shift-traverser/-/shift-traverser-1.0.0.tgz",
"integrity": "sha512-DMY3512wJbdC+IC+nhLH3/Stgr2BbxbNcg7qyZ6+e5qNnNs8TBQJWdMsRgHlX1JXwF4C0ONKS8VUxsPT0Tf7aw==",
"requires": {
"estraverse": "4.2.0",
"shift-spec": "2018.0.0"
},
"dependencies": {
"estraverse": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
"integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM="
},
"shift-spec": {
"version": "2018.0.0",
"resolved": "https://registry.npmjs.org/shift-spec/-/shift-spec-2018.0.0.tgz",
"integrity": "sha512-/aiPOkj7dbe+CV2VZhIMTHQToZmgniofpRG7Yr7x2/0sO6CSVC++py1Wzf+s+rWSTDHKcLvziVAxjRRV4i4EoQ=="
}
}
},
"unicode-canonical-property-names-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz",
"integrity": "sha512-jDrNnXWHd4oHiTZnx/ZG7gtUTVp+gCcTTKr8L0HjlwphROEW3+Him+IpvC+xcJEFegapiMZyZe02CyuOnRmbnQ=="
},
"unicode-match-property-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-1.0.4.tgz",
"integrity": "sha512-L4Qoh15vTfntsn4P1zqnHulG0LdXgjSO035fEpdtp6YxXhMT51Q6vgM5lYdG/5X3MjS+k/Y9Xw4SFCY9IkR0rg==",
"requires": {
"unicode-canonical-property-names-ecmascript": "^1.0.4",
"unicode-property-aliases-ecmascript": "^1.0.4"
}
},
"unicode-match-property-value-ecmascript": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-1.0.2.tgz",
"integrity": "sha512-Rx7yODZC1L/T8XKo/2kNzVAQaRE88AaMvI1EF/Xnj3GW2wzN6fop9DDWuFAKUVFH7vozkz26DzP0qyWLKLIVPQ=="
},
"unicode-property-aliases-ecmascript": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-1.0.4.tgz",
"integrity": "sha512-2WSLa6OdYd2ng8oqiGIWnJqyFArvhn+5vgx5GTxMbUYjCYKUcuKS62YLFF0R/BDGlB1yzXjQOLtPAfHsgirEpg=="
}
}
}
+20 -9
View File
@@ -1,15 +1,21 @@
{
"name": "@strudel.cycles/eval",
"version": "0.1.1",
"version": "0.8.0",
"description": "Code evaluator for strudel",
"main": "index.mjs",
"publishConfig": {
"main": "dist/index.js",
"module": "dist/index.mjs"
},
"scripts": {
"build": "vite build",
"test": "vitest run",
"prepublishOnly": "npm run build"
},
"type": "module",
"directories": {
"test": "test"
},
"scripts": {
"test": "mocha --colors"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tidalcycles/strudel.git"
@@ -28,12 +34,17 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/core": "workspace:*",
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
"shift-codegen": "^7.0.3",
"shift-parser": "^7.0.3",
"shift-spec": "^2018.0.2",
"shift-ast": "^7.0.0",
"shift-codegen": "^8.1.0",
"shift-parser": "^8.0.0",
"shift-spec": "^2019.0.0",
"shift-traverser": "^1.0.0"
},
"devDependencies": {
"@strudel.cycles/mini": "workspace:*",
"vite": "^4.3.3",
"vitest": "^0.28.0"
}
}
+20 -8
View File
@@ -30,11 +30,12 @@ const isNote = (name) => /^[a-gC-G][bs]?[0-9]$/.test(name);
const addLocations = true;
export const addMiniLocations = true;
export const minifyStrings = true;
export const wrappedAsync = true;
export const wrappedAsync = false; // this is now handled by core evaluate by default
export const shouldAddReturn = true;
export default (_code) => {
const { code, addReturn } = wrapAsync(_code);
const ast = parseScriptWithLocation(code);
const ast = parseScriptWithLocation(disguiseImports(code));
const artificialNodes = [];
const parents = [];
const shifted = replace(ast.tree, {
@@ -125,13 +126,25 @@ export default (_code) => {
},
});
// add return to last statement (because it's wrapped in an async function artificially)
if (wrappedAsync) {
if (shouldAddReturn) {
addReturn(shifted);
}
const generated = codegen(shifted);
const generated = undisguiseImports(codegen(shifted));
return generated;
};
// renames all import statements to "_mport" as Shift doesn't support dynamic import.
// there shouldn't be any side-effects from this as this change does not affect
// the syntax & will be undone by the equivalent replace in "undisguiseImports".
function disguiseImports(code) {
return code.replaceAll('import', '_mport'); // Must be the same length!
}
// Rename the renamed import statements back to "import"
function undisguiseImports(code) {
return code.replaceAll('_mport', 'import');
}
function wrapAsync(code) {
// wrap code in async to make await work on top level => this will create 1 line offset to locations
// this is why line offset is -1 in getLocationObject calls below
@@ -141,7 +154,7 @@ ${code}
})()`;
}
const addReturn = (ast) => {
const body = ast.statements[0].expression.callee.body; // actual code ast inside async function body
const body = wrappedAsync ? ast.statements[0].expression.callee.body : ast;
body.statements = body.statements
.slice(0, -1)
.concat([new ReturnStatement({ expression: body.statements.slice(-1)[0] })]);
@@ -212,9 +225,8 @@ function isPatternArg(parents) {
function hasModifierCall(parent) {
// TODO: modifiers are more than composables, for example every is not composable but should be seen as modifier..
// need all prototypes of Pattern
return (
parent?.type === 'StaticMemberExpression' && Object.keys(Pattern.prototype.composable).includes(parent.property)
);
return parent?.type === 'StaticMemberExpression';
// && Object.keys(Pattern.prototype.composable).includes(parent.property)
}
const factories = Object.keys(Pattern.prototype.factories).concat(['mini']);
+17 -19
View File
@@ -4,31 +4,29 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { strict as assert } from 'assert';
import { evaluate, extend } from '../evaluate.mjs';
import { expect, describe, it } from 'vitest';
import { evaluate } from '../evaluate.mjs';
import { mini } from '@strudel.cycles/mini';
import * as strudel from '@strudel.cycles/core';
const { fastcat, evalScope } = strudel;
const { fastcat } = strudel;
extend({ mini }, strudel);
// TODO: test evalScope
describe('evaluate', () => {
const ev = async (code) => (await evaluate(code)).pattern._firstCycleValues;
describe('evaluate', async () => {
await evalScope({ mini }, strudel);
const ev = async (code) => (await evaluate(code)).pattern.firstCycleValues;
it('Should evaluate strudel functions', async () => {
assert.deepStrictEqual(await ev("pure('c3')"), ['c3']);
assert.deepStrictEqual(await ev('cat(c3)'), ['c3']);
assert.deepStrictEqual(await ev('fastcat(c3, d3)'), ['c3', 'd3']);
assert.deepStrictEqual(await ev('slowcat(c3, d3)'), ['c3']);
expect(await ev('pure("c3")')).toEqual(['c3']);
expect(await ev('cat("c3")')).toEqual(['c3']);
expect(await ev('fastcat("c3", "d3")')).toEqual(['c3', 'd3']);
expect(await ev('slowcat("c3", "d3")')).toEqual(['c3']);
});
it('Should be extendable', async () => {
extend({ myFunction: (...x) => fastcat(...x) });
assert.deepStrictEqual(await ev('myFunction(c3, d3)'), ['c3', 'd3']);
it('Scope should be extendable', async () => {
await evalScope({ myFunction: (...x) => fastcat(...x) });
expect(await ev('myFunction("c3", "d3")')).toEqual(['c3', 'd3']);
});
it('Should evaluate simple double quoted mini notation', async () => {
assert.deepStrictEqual(await ev('"c3"'), ['c3']);
assert.deepStrictEqual(await ev('"c3 d3"'), ['c3', 'd3']);
assert.deepStrictEqual(await ev('"<c3 d3>"'), ['c3']);
expect(await ev('"c3"')).toEqual(['c3']);
expect(await ev('"c3 d3"')).toEqual(['c3', 'd3']);
expect(await ev('"<c3 d3>"')).toEqual(['c3']);
});
});
+14 -3
View File
@@ -4,11 +4,22 @@ Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/st
This 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/>.
*/
import { strict as assert } from 'assert';
import shapeshifter from '../shapeshifter.mjs';
import { describe, it, expect } from 'vitest';
import shapeshifter, { wrappedAsync } from '../shapeshifter.mjs';
describe('shapeshifter', () => {
it('Should shift simple double quote string', () => {
assert.equal(shapeshifter('"c3"'), '(async()=>{return mini("c3").withMiniLocation([1,0,15],[1,4,19])})()');
if (wrappedAsync) {
expect(shapeshifter('"c3"')).toEqual('(async()=>{return mini("c3").withMiniLocation([1,0,15],[1,4,19])})()');
} else {
expect(shapeshifter('"c3"')).toEqual('return mini("c3").withMiniLocation([1,0,0],[1,4,4])');
}
});
if (wrappedAsync) {
it('Should handle dynamic imports', () => {
expect(shapeshifter('const { default: foo } = await import(\'https://bar.com/foo.js\');"c3"')).toEqual(
'const{default:foo}=await import("https://bar.com/foo.js");return mini("c3").withMiniLocation([1,64,79],[1,68,83])',
);
});
}
});
+19
View File
@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import { dependencies } from './package.json';
import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [],
build: {
lib: {
entry: resolve(__dirname, 'index.mjs'),
formats: ['es', 'cjs'],
fileName: (ext) => ({ es: 'index.mjs', cjs: 'index.js' }[ext]),
},
rollupOptions: {
external: [...Object.keys(dependencies)],
},
target: 'esnext',
},
});
-4
View File
@@ -7,7 +7,3 @@ This package adds midi functionality to strudel Patterns.
```sh
npm i @strudel.cycles/midi --save
```
## Dev Notes
- is this package really necessary? currently, /tone also depends on webmidi through @tonejs/piano. Either move piano out of /tone or merge /midi into /tone...

Some files were not shown because too many files have changed in this diff Show More