Compare commits

...

182 Commits

Author SHA1 Message Date
Felix Roos 684216bf8c strudel cli poc 2022-07-19 23:42:33 +02:00
Felix Roos ac564000b1 ignore samples 2022-07-19 23:29:11 +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 fb8dd537e0 node 16 compat 2022-06-15 21:34:56 +02:00
alex affce4a4a1 re-add serial 2022-06-15 16:21:56 +01:00
alex a479a5740b declare from/to with let, as they can be changed 2022-06-15 16:15:57 +01:00
Felix Roos 8e68b4e001 fix: WebDirt import 2022-06-14 08:39:22 +02:00
Felix Roos d10b6f04cf Merge pull request #110 from tidalcycles/create-param
add createParam + createParams
2022-06-13 21:28:27 +02:00
Felix Roos 052f2db0ea Merge pull request #131 from tidalcycles/pianoroll-enhancements
Pianoroll enhancements
2022-06-13 21:27:08 +02:00
Felix Roos 4b9a6ffee5 ignore samples 2022-06-13 21:24:40 +02:00
Felix Roos 6d6784d429 remove old comments 2022-06-05 23:59:44 +02:00
Felix Roos b3d2d3028c disable autorange by default 2022-06-05 23:47:24 +02:00
Felix Roos 68814dd97c pianoroll: hideNegative flag 2022-06-05 23:38:33 +02:00
Felix Roos ac39a609d7 pianoroll: flipTime + flipValues 2022-06-05 23:38:22 +02:00
Felix Roos ba5cf5ba83 replace from to with cycles / playhead 2022-06-05 23:38:07 +02:00
Felix Roos 394e77c152 pianoroll: autorange + fold + vertical 2022-06-05 23:37:49 +02:00
Felix Roos c7fdf5245a more flexible pianoroll 2022-06-05 23:37:24 +02:00
Felix Roos 6d91b2d984 Merge pull request #129 from stephendwolff/main
Fix link to contributing to tutorial docs
2022-06-05 13:06:02 +02:00
Stephen Wolff 36a401c6a7 Update CONTRIBUTING.md 2022-06-04 13:40:30 +01:00
Stephen Wolff cbb59eafc8 Update CONTRIBUTING.md
fix link
2022-06-04 13:35:06 +01:00
Felix Roos 5cd80b5817 fix: #122 was still not fixed for async patterns 2022-06-02 00:58:20 +02:00
Felix Roos 6306cc9c34 delete doc.json (build artifact) 2022-06-02 00:23:53 +02:00
Felix Roos e335b07efe Merge pull request #121 from tidalcycles/webdirt
Webdirt
2022-06-02 00:20:45 +02:00
Felix Roos e86144255c Merge remote-tracking branch 'origin/HEAD' into webdirt 2022-06-02 00:19:10 +02:00
Felix Roos e2c4a3b591 Merge pull request #124 from tidalcycles/ctrl-enter-fix
fix: #122 ctrl enter would add newline
2022-06-01 23:56:04 +02:00
Felix Roos 81c20e6792 fix: #122 ctrl enter would add newline 2022-06-01 23:53:30 +02:00
Felix Roos 204941c1e4 Merge pull request #123 from tidalcycles/tab-switch-bug
fix: #108
2022-06-01 18:21:56 +02:00
Felix Roos 307afa5c52 fix: #108 2022-06-01 18:19:57 +02:00
Felix Roos 92dc50e348 minor style tweaks 2022-05-30 23:34:56 +02:00
Felix Roos 5c6c5c9608 add samples helper
+ dont play samples after load
2022-05-30 23:33:49 +02:00
Felix Roos e27b8aeb66 fix cache + add cache reset 2022-05-29 22:44:26 +02:00
Felix Roos 7274a455a8 save sample list to local storage 2022-05-29 22:18:07 +02:00
Felix Roos 91dfef52ea basic sample loader from github 2022-05-29 21:06:07 +02:00
Felix Roos 9147b4e39f Update README.md 2022-05-29 18:13:07 +02:00
Felix Roos 052159ce6f rename readme 2022-05-29 18:10:04 +02:00
Felix Roos ea6d728b89 link webdirt - superdirt controls 2022-05-29 15:07:01 +02:00
Felix Roos 093049a1f8 hopefully fix sample folder for deployed version 2022-05-29 12:27:25 +02:00
Felix Roos 17fa8d904e support webdirt in minirepl
+ add section in tutorial
2022-05-29 11:51:26 +02:00
Felix Roos a996a7043d remove splitLanes from branch 2022-05-29 09:58:04 +02:00
Felix Roos 822659f7fd Merge commit 'd132a9bec58f40ccdea411ec971a0343aa1b0743' into webdirt 2022-05-29 09:56:38 +02:00
Felix Roos e1fb0acff7 pass all value props to webdirt + list available 2022-05-29 09:55:58 +02:00
Felix Roos d132a9bec5 Merge pull request #117 from tidalcycles/in-source-doc
In source doc
2022-05-29 09:54:59 +02:00
Felix Roos f9f1b55185 add webdirt with some default samples 2022-05-29 00:50:01 +02:00
Felix Roos 15b32abadf add dummy function with todo 2022-05-28 23:45:42 +02:00
Felix Roos 93e565f8df document non random signal functions 2022-05-28 23:43:42 +02:00
Felix Roos 69703072df hotfix: add missing osc import 2022-05-25 22:37:39 +02:00
Felix Roos 8a812dd853 reorder stuff 2022-05-24 22:48:49 +02:00
Felix Roos 7250824e6b add superdirt params 2022-05-24 22:35:06 +02:00
Felix Roos cc1a61d607 use nunjucks filters 2022-05-24 20:40:12 +02:00
Felix Roos e7fe1ab567 delete old mdx 2022-05-24 20:37:53 +02:00
Felix Roos cad24714d4 use tutorial.mdx with nunjucks 2022-05-24 20:37:29 +02:00
Felix Roos 4acdabe439 can now generate mdx from nunjucks 2022-05-24 00:03:59 +02:00
Felix Roos b5b0fbbd38 small fixes 2022-05-24 00:03:50 +02:00
Felix Roos 2680eed681 hide api doc by default 2022-05-22 21:57:04 +02:00
Felix Roos 1b8a12dd2a doc 2022-05-22 21:52:46 +02:00
Felix Roos b0c6236c24 even more doc 2022-05-22 21:42:30 +02:00
Felix Roos 8646410e6f add n + todos 2022-05-22 16:23:51 +02:00
Felix Roos b2743108f1 dont render attack yet 2022-05-22 16:01:17 +02:00
Felix Roos 4be798d15a more doc 2022-05-22 15:59:56 +02:00
Felix Roos 4c4d0b426e even more control doc + more logical grouping 2022-05-22 12:26:45 +02:00
Felix Roos 58104b5a3a document more controls 2022-05-22 11:53:29 +02:00
Felix Roos 68a3842c8c document more controls 2022-05-22 08:35:45 +02:00
Felix Roos 987cc63764 test control doc 2022-05-21 22:51:56 +02:00
Felix Roos a8672ec432 fix repl imports 2022-05-21 22:51:42 +02:00
Felix Roos a9f5bd679d jsdoc voicings 2022-05-21 21:57:37 +02:00
Felix Roos f2b5dcf466 tonal jsdoc 2022-05-21 21:52:45 +02:00
Felix Roos 6b26f999e4 autogenerate doc on build tutorial 2022-05-20 22:15:05 +02:00
Felix Roos f2a70396d1 add autogenerated api doc to bottom of tutorial 2022-05-20 21:56:55 +02:00
Felix Roos b50daed0d0 Merge remote-tracking branch 'origin/main' into in-source-doc 2022-05-20 21:46:14 +02:00
Felix Roos e664834fd9 Merge pull request #116 from tidalcycles/repl-package
react package + vite build
2022-05-20 11:49:10 +02:00
Felix Roos 4c49e30763 delete docs as now deploying to gh-pages branch 2022-05-20 11:47:34 +02:00
Felix Roos 2d2c671e6f Publish
- @strudel.cycles/eval@0.1.1
 - @strudel.cycles/midi@0.1.1
 - @strudel.cycles/mini@0.1.1
 - @strudel.cycles/react@0.1.2
 - @strudel.cycles/tonal@0.1.1
 - @strudel.cycles/tone@0.1.1
 - @strudel.cycles/webaudio@0.1.1
 - @strudel.cycles/xen@0.1.1
2022-05-20 11:45:07 +02:00
Felix Roos d2f47262de bump core deps 2022-05-20 11:43:39 +02:00
Felix Roos cb13eb7f3b remove now redundant style 2022-05-20 00:15:10 +02:00
Felix Roos 96825f9fcc Publish
- @strudel.cycles/react@0.1.1
2022-05-20 00:09:30 +02:00
Felix Roos 7eeae4292c add missing styles + fix demo 2022-05-20 00:08:50 +02:00
Felix Roos a29c5f1bd8 Publish
- @strudel.cycles/eval@0.1.0
 - @strudel.cycles/midi@0.1.0
 - @strudel.cycles/mini@0.1.0
 - @strudel.cycles/react@0.1.0
 - @strudel.cycles/tonal@0.1.0
 - @strudel.cycles/tone@0.1.0
 - @strudel.cycles/webaudio@0.1.0
 - @strudel.cycles/xen@0.1.0
2022-05-19 19:42:22 +02:00
Felix Roos b7a2386874 messed up everything 2022-05-19 19:40:47 +02:00
Felix Roos 43a0c7e604 fix cp error 2022-05-19 19:36:00 +02:00
Felix Roos 73d8afd61b revert unpublished versions 2022-05-19 19:34:02 +02:00
Felix Roos 608283ba65 doc: euclid 2022-05-07 10:29:16 +02:00
Felix Roos f5e5ef8662 doc: drawLine 2022-05-07 10:27:14 +02:00
alex d5a1832f31 document some mathematical pattern methods 2022-05-06 15:42:48 +02:00
Felix Roos e7def57c5b add createParam + createParams 2022-05-05 20:54:49 +02:00
226 changed files with 12805 additions and 3010 deletions
+5 -1
View File
@@ -30,4 +30,8 @@ mytunes.ts
doc
out
.parcel-cache
repl_old
repl_old
tutorial.rendered.mdx
doc.json
talk/public/EmuSP12
talk/public/samples
+3 -1
View File
@@ -32,7 +32,9 @@ Use one of the Communication Channels listed above.
## Improve the Tutorial
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/repl/src/tutorial/tutorial.mdx).
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.
## Propose a Feature
+1 -1
View File
@@ -2,7 +2,7 @@
[![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/>
-1037
View File
File diff suppressed because it is too large Load Diff
View File
-1
View File
@@ -1 +0,0 @@
strudel.tidalcycles.org
-16
View File
@@ -1,16 +0,0 @@
{
"files": {
"main.css": "/static/css/main.35f2ca4c.css",
"main.js": "/static/js/main.f848d51e.js",
"static/js/787.1c52cb78.chunk.js": "/static/js/787.1c52cb78.chunk.js",
"static/media/logo.svg": "/static/media/logo.ac95051720b3dccfe511e0e02d8e1029.svg",
"index.html": "/index.html",
"main.35f2ca4c.css.map": "/static/css/main.35f2ca4c.css.map",
"main.f848d51e.js.map": "/static/js/main.f848d51e.js.map",
"787.1c52cb78.chunk.js.map": "/static/js/787.1c52cb78.chunk.js.map"
},
"entrypoints": [
"static/css/main.35f2ca4c.css",
"static/js/main.f848d51e.js"
]
}
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

-1
View File
@@ -1 +0,0 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Strudel REPL"/><title>Strudel REPL</title><script defer="defer" src="/static/js/main.f848d51e.js"></script><link href="/static/css/main.35f2ca4c.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
-15
View File
@@ -1,15 +0,0 @@
{
"short_name": "Strudel REPL",
"name": "Strudel REPL - Tidal Patterns in JavaScript",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
-3
View File
@@ -1,3 +0,0 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-2
View File
@@ -1,2 +0,0 @@
"use strict";(self.webpackChunk_strudel_cycles_repl=self.webpackChunk_strudel_cycles_repl||[]).push([[787],{787:function(e,t,n){n.r(t),n.d(t,{getCLS:function(){return y},getFCP:function(){return g},getFID:function(){return C},getLCP:function(){return P},getTTFB:function(){return D}});var i,r,a,o,u=function(e,t){return{name:e,value:void 0===t?-1:t,delta:0,entries:[],id:"v2-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12)}},c=function(e,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){if("first-input"===e&&!("PerformanceEventTiming"in self))return;var n=new PerformanceObserver((function(e){return e.getEntries().map(t)}));return n.observe({type:e,buffered:!0}),n}}catch(e){}},f=function(e,t){var n=function n(i){"pagehide"!==i.type&&"hidden"!==document.visibilityState||(e(i),t&&(removeEventListener("visibilitychange",n,!0),removeEventListener("pagehide",n,!0)))};addEventListener("visibilitychange",n,!0),addEventListener("pagehide",n,!0)},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&e(t)}),!0)},m=function(e,t,n){var i;return function(r){t.value>=0&&(r||n)&&(t.delta=t.value-(i||0),(t.delta||void 0===i)&&(i=t.value,e(t)))}},v=-1,p=function(){return"hidden"===document.visibilityState?0:1/0},d=function(){f((function(e){var t=e.timeStamp;v=t}),!0)},l=function(){return v<0&&(v=p(),d(),s((function(){setTimeout((function(){v=p(),d()}),0)}))),{get firstHiddenTime(){return v}}},g=function(e,t){var n,i=l(),r=u("FCP"),a=function(e){"first-contentful-paint"===e.name&&(f&&f.disconnect(),e.startTime<i.firstHiddenTime&&(r.value=e.startTime,r.entries.push(e),n(!0)))},o=window.performance&&performance.getEntriesByName&&performance.getEntriesByName("first-contentful-paint")[0],f=o?null:c("paint",a);(o||f)&&(n=m(e,r,t),o&&a(o),s((function(i){r=u("FCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,n(!0)}))}))})))},h=!1,T=-1,y=function(e,t){h||(g((function(e){T=e.value})),h=!0);var n,i=function(t){T>-1&&e(t)},r=u("CLS",0),a=0,o=[],v=function(e){if(!e.hadRecentInput){var t=o[0],i=o[o.length-1];a&&e.startTime-i.startTime<1e3&&e.startTime-t.startTime<5e3?(a+=e.value,o.push(e)):(a=e.value,o=[e]),a>r.value&&(r.value=a,r.entries=o,n())}},p=c("layout-shift",v);p&&(n=m(i,r,t),f((function(){p.takeRecords().map(v),n(!0)})),s((function(){a=0,T=-1,r=u("CLS",0),n=m(i,r,t)})))},E={passive:!0,capture:!0},w=new Date,L=function(e,t){i||(i=t,r=e,a=new Date,F(removeEventListener),S())},S=function(){if(r>=0&&r<a-w){var e={entryType:"first-input",name:i.type,target:i.target,cancelable:i.cancelable,startTime:i.timeStamp,processingStart:i.timeStamp+r};o.forEach((function(t){t(e)})),o=[]}},b=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,t){var n=function(){L(e,t),r()},i=function(){r()},r=function(){removeEventListener("pointerup",n,E),removeEventListener("pointercancel",i,E)};addEventListener("pointerup",n,E),addEventListener("pointercancel",i,E)}(t,e):L(t,e)}},F=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(t){return e(t,b,E)}))},C=function(e,t){var n,a=l(),v=u("FID"),p=function(e){e.startTime<a.firstHiddenTime&&(v.value=e.processingStart-e.startTime,v.entries.push(e),n(!0))},d=c("first-input",p);n=m(e,v,t),d&&f((function(){d.takeRecords().map(p),d.disconnect()}),!0),d&&s((function(){var a;v=u("FID"),n=m(e,v,t),o=[],r=-1,i=null,F(addEventListener),a=p,o.push(a),S()}))},k={},P=function(e,t){var n,i=l(),r=u("LCP"),a=function(e){var t=e.startTime;t<i.firstHiddenTime&&(r.value=t,r.entries.push(e),n())},o=c("largest-contentful-paint",a);if(o){n=m(e,r,t);var v=function(){k[r.id]||(o.takeRecords().map(a),o.disconnect(),k[r.id]=!0,n(!0))};["keydown","click"].forEach((function(e){addEventListener(e,v,{once:!0,capture:!0})})),f(v,!0),s((function(i){r=u("LCP"),n=m(e,r,t),requestAnimationFrame((function(){requestAnimationFrame((function(){r.value=performance.now()-i.timeStamp,k[r.id]=!0,n(!0)}))}))}))}},D=function(e){var t,n=u("TTFB");t=function(){try{var t=performance.getEntriesByType("navigation")[0]||function(){var e=performance.timing,t={entryType:"navigation",startTime:0};for(var n in e)"navigationStart"!==n&&"toJSON"!==n&&(t[n]=Math.max(e[n]-e.navigationStart,0));return t}();if(n.value=n.delta=t.responseStart,n.value<0||n.value>performance.now())return;n.entries=[t],e(n)}catch(e){}},"complete"===document.readyState?setTimeout(t,0):addEventListener("load",(function(){return setTimeout(t,0)}))}}}]);
//# sourceMappingURL=787.1c52cb78.chunk.js.map
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-96
View File
@@ -1,96 +0,0 @@
/*
Strudel - javascript-based environment for live coding algorithmic (musical) patterns
https://strudel.tidalcycles.org / https://github.com/tidalcycles/strudel/
Copyright (C) Strudel contributors
https://github.com/tidalcycles/strudel/graphs/contributors
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/>.
*/
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! @license ReactCodeMirror - MIT License - Tom Golden (8162045+tbjgolden@users.noreply.github.com) */
/**
* @license Fraction.js v4.2.0 05/03/2022
* https://www.xarg.org/2014/03/rational-numbers-in-javascript/
*
* Copyright (c) 2021, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
/**
* Tone.js
* @author Yotam Mann
* @license http://opensource.org/licenses/MIT MIT License
* @copyright 2014-2019 Yotam Mann
*/
/** @license React v0.20.2
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/** @license React v17.0.2
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><link rel="icon" href="/tutorial/favicon.e3ab9dd9.ico"><link rel="stylesheet" type="text/css" href="/tutorial/index.a3acddda.css"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="description" content="Strudel REPL"><title>Strudel Tutorial</title></head><body> <div id="root"></div> <noscript>You need to enable JavaScript to run this app.</noscript> <script src="/tutorial/index.55306425.js" defer></script> </body></html>
+300 -45
View File
@@ -2243,6 +2243,10 @@
"resolved": "packages/serial",
"link": true
},
"node_modules/@strudel.cycles/soundfonts": {
"resolved": "packages/soundfonts",
"link": true
},
"node_modules/@strudel.cycles/tonal": {
"resolved": "packages/tonal",
"link": true
@@ -2255,6 +2259,10 @@
"resolved": "packages/webaudio",
"link": true
},
"node_modules/@strudel.cycles/webdirt": {
"resolved": "packages/webdirt",
"link": true
},
"node_modules/@strudel.cycles/xen": {
"resolved": "packages/xen",
"link": true
@@ -3943,6 +3951,15 @@
"node": ">=0.10"
}
},
"node_modules/data-uri-to-buffer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz",
"integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==",
"dev": true,
"engines": {
"node": ">= 12"
}
},
"node_modules/dateformat": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
@@ -4951,6 +4968,29 @@
"reusify": "^1.0.4"
}
},
"node_modules/fetch-blob": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.5.tgz",
"integrity": "sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "paypal",
"url": "https://paypal.me/jimmywarting"
}
],
"dependencies": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
},
"engines": {
"node": "^12.20 || >= 14.13"
}
},
"node_modules/figures": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
@@ -5130,6 +5170,18 @@
"node": ">= 0.12"
}
},
"node_modules/formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"dev": true,
"dependencies": {
"fetch-blob": "^3.1.2"
},
"engines": {
"node": ">=12.20.0"
}
},
"node_modules/fraction.js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz",
@@ -7015,9 +7067,9 @@
}
},
"node_modules/marked": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz",
"integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ==",
"version": "4.0.17",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz",
"integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA==",
"bin": {
"marked": "bin/marked.js"
},
@@ -7578,6 +7630,25 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
"node_modules/node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/jimmywarting"
},
{
"type": "github",
"url": "https://paypal.me/jimmywarting"
}
],
"engines": {
"node": ">=10.5.0"
}
},
"node_modules/node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@@ -8433,6 +8504,31 @@
"node": ">=8"
}
},
"node_modules/peggy": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/peggy/-/peggy-2.0.1.tgz",
"integrity": "sha512-mBqfmdUAOVn7RILpXTbcRBhLfTR4Go0SresSnivGDdRylBOyVFJncFiVyCNNpPWq8HmgeRleXHs/Go4o8kQVXA==",
"dev": true,
"dependencies": {
"commander": "^9.3.0",
"source-map-generator": "0.8.0"
},
"bin": {
"peggy": "bin/peggy.js"
},
"engines": {
"node": ">=10"
}
},
"node_modules/peggy/node_modules/commander": {
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.3.0.tgz",
"integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==",
"dev": true,
"engines": {
"node": "^12.20.0 || >=14"
}
},
"node_modules/performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
@@ -9830,6 +9926,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/source-map-generator": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/source-map-generator/-/source-map-generator-0.8.0.tgz",
"integrity": "sha512-psgxdGMwl5MZM9S3FWee4EgsEaIjahYV5AzGnwUvPhWeITz/j6rKpysQHlQ4USdxvINlb8lKfWGIXwfkrgtqkA==",
"dev": true,
"engines": {
"node": ">= 10"
}
},
"node_modules/source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
@@ -10815,6 +10920,20 @@
"defaults": "^1.0.3"
}
},
"node_modules/web-streams-polyfill": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
"integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
"dev": true,
"engines": {
"node": ">= 8"
}
},
"node_modules/WebDirt": {
"version": "1.0.0",
"resolved": "git+ssh://git@github.com/dktr0/WebDirt.git#425dc8fd023440d9c61ffdb8642e44e2710faea0",
"license": "ISC"
},
"node_modules/webidl-conversions": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
@@ -11254,7 +11373,7 @@
},
"packages/core": {
"name": "@strudel.cycles/core",
"version": "0.0.5",
"version": "0.1.2",
"license": "AGPL-3.0-or-later",
"dependencies": {
"bjork": "^0.0.1",
@@ -11266,15 +11385,15 @@
},
"packages/embed": {
"name": "@strudel.cycles/embed",
"version": "0.0.2",
"version": "0.1.1",
"license": "AGPL-3.0-or-later"
},
"packages/eval": {
"name": "@strudel.cycles/eval",
"version": "0.0.5",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
"shift-codegen": "^7.0.3",
@@ -11298,27 +11417,30 @@
},
"packages/midi": {
"name": "@strudel.cycles/midi",
"version": "0.0.6",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/tone": "^0.0.6",
"@strudel.cycles/tone": "^0.1.3",
"tone": "^14.7.77",
"webmidi": "^2.5.2"
}
},
"packages/mini": {
"name": "@strudel.cycles/mini",
"version": "0.0.7",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/eval": "^0.0.5",
"@strudel.cycles/tone": "^0.0.6"
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3"
},
"devDependencies": {
"peggy": "^2.0.1"
}
},
"packages/osc": {
"name": "@strudel.cycles/osc",
"version": "0.0.2",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"osc-js": "^2.3.2"
@@ -11326,14 +11448,14 @@
},
"packages/react": {
"name": "@strudel.cycles/react",
"version": "0.0.1",
"version": "0.1.4",
"license": "AGPL-3.0-or-later",
"peer": true,
"dependencies": {
"@codemirror/lang-javascript": "^0.19.0",
"@strudel.cycles/core": "*",
"@strudel.cycles/eval": "*",
"@strudel.cycles/tone": "*",
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3",
"react-codemirror6": "^1.1.0",
"react-hook-inview": "^4.5.0"
},
@@ -11402,15 +11524,45 @@
},
"packages/serial": {
"name": "@strudel.cycles/serial",
"version": "0.0.6",
"version": "0.1.3",
"license": "AGPL-3.0-or-later"
},
"packages/soundfonts": {
"name": "@strudel.cycles/soundfonts",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "*",
"@strudel.cycles/webaudio": "^0.1.4"
},
"devDependencies": {
"node-fetch": "^3.2.6"
}
},
"packages/soundfonts/node_modules/node-fetch": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.6.tgz",
"integrity": "sha512-LAy/HZnLADOVkVPubaxHDft29booGglPFDr2Hw0J1AercRh01UiVFm++KMDnJeH9sHgNB4hsXPii7Sgym/sTbw==",
"dev": true,
"dependencies": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/node-fetch"
}
},
"packages/tonal": {
"name": "@strudel.cycles/tonal",
"version": "0.0.5",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"@tonaljs/tonal": "^4.6.5",
"webmidi": "^3.0.15"
}
@@ -11432,10 +11584,10 @@
},
"packages/tone": {
"name": "@strudel.cycles/tone",
"version": "0.0.6",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"@tonejs/piano": "^0.2.1",
"chord-voicings": "^0.0.1",
"tone": "^14.7.77"
@@ -11443,18 +11595,27 @@
},
"packages/webaudio": {
"name": "@strudel.cycles/webaudio",
"version": "0.0.6",
"version": "0.1.4",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5"
"@strudel.cycles/core": "^0.1.2"
}
},
"packages/webdirt": {
"name": "@strudel.cycles/webdirt",
"version": "0.1.2",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.1.2",
"WebDirt": "github:dktr0/WebDirt"
}
},
"packages/xen": {
"name": "@strudel.cycles/xen",
"version": "0.0.5",
"version": "0.1.3",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@strudel.cycles/core": "^0.0.5"
"@strudel.cycles/core": "^0.1.2"
}
}
},
@@ -13269,7 +13430,7 @@
"@strudel.cycles/eval": {
"version": "file:packages/eval",
"requires": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
"shift-codegen": "^7.0.3",
@@ -13281,7 +13442,7 @@
"@strudel.cycles/midi": {
"version": "file:packages/midi",
"requires": {
"@strudel.cycles/tone": "^0.0.6",
"@strudel.cycles/tone": "^0.1.3",
"tone": "^14.7.77",
"webmidi": "^2.5.2"
}
@@ -13289,9 +13450,10 @@
"@strudel.cycles/mini": {
"version": "file:packages/mini",
"requires": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/eval": "^0.0.5",
"@strudel.cycles/tone": "^0.0.6"
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3",
"peggy": "^2.0.1"
}
},
"@strudel.cycles/osc": {
@@ -13304,9 +13466,9 @@
"version": "file:packages/react",
"requires": {
"@codemirror/lang-javascript": "^0.19.0",
"@strudel.cycles/core": "*",
"@strudel.cycles/eval": "*",
"@strudel.cycles/tone": "*",
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@vitejs/plugin-react": "^1.3.0",
@@ -13366,10 +13528,31 @@
"@strudel.cycles/serial": {
"version": "file:packages/serial"
},
"@strudel.cycles/soundfonts": {
"version": "file:packages/soundfonts",
"requires": {
"@strudel.cycles/core": "*",
"@strudel.cycles/webaudio": "^0.1.4",
"node-fetch": "^3.2.6"
},
"dependencies": {
"node-fetch": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.2.6.tgz",
"integrity": "sha512-LAy/HZnLADOVkVPubaxHDft29booGglPFDr2Hw0J1AercRh01UiVFm++KMDnJeH9sHgNB4hsXPii7Sgym/sTbw==",
"dev": true,
"requires": {
"data-uri-to-buffer": "^4.0.0",
"fetch-blob": "^3.1.4",
"formdata-polyfill": "^4.0.10"
}
}
}
},
"@strudel.cycles/tonal": {
"version": "file:packages/tonal",
"requires": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"@tonaljs/tonal": "^4.6.5",
"webmidi": "^3.0.15"
},
@@ -13389,7 +13572,7 @@
"@strudel.cycles/tone": {
"version": "file:packages/tone",
"requires": {
"@strudel.cycles/core": "^0.0.5",
"@strudel.cycles/core": "^0.1.2",
"@tonejs/piano": "^0.2.1",
"chord-voicings": "^0.0.1",
"tone": "^14.7.77"
@@ -13398,13 +13581,20 @@
"@strudel.cycles/webaudio": {
"version": "file:packages/webaudio",
"requires": {
"@strudel.cycles/core": "^0.0.5"
"@strudel.cycles/core": "^0.1.2"
}
},
"@strudel.cycles/webdirt": {
"version": "file:packages/webdirt",
"requires": {
"@strudel.cycles/core": "^0.1.2",
"WebDirt": "github:dktr0/WebDirt"
}
},
"@strudel.cycles/xen": {
"version": "file:packages/xen",
"requires": {
"@strudel.cycles/core": "^0.0.5"
"@strudel.cycles/core": "^0.1.2"
}
},
"@tonaljs/abc-notation": {
@@ -14783,6 +14973,12 @@
"assert-plus": "^1.0.0"
}
},
"data-uri-to-buffer": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.0.tgz",
"integrity": "sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==",
"dev": true
},
"dateformat": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz",
@@ -15456,6 +15652,16 @@
"reusify": "^1.0.4"
}
},
"fetch-blob": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.1.5.tgz",
"integrity": "sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg==",
"dev": true,
"requires": {
"node-domexception": "^1.0.0",
"web-streams-polyfill": "^3.0.3"
}
},
"figures": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
@@ -15584,6 +15790,15 @@
"mime-types": "^2.1.12"
}
},
"formdata-polyfill": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
"dev": true,
"requires": {
"fetch-blob": "^3.1.2"
}
},
"fraction.js": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz",
@@ -17033,9 +17248,9 @@
"requires": {}
},
"marked": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz",
"integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ=="
"version": "4.0.17",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz",
"integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA=="
},
"mdurl": {
"version": "1.0.1",
@@ -17460,6 +17675,12 @@
"integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==",
"dev": true
},
"node-domexception": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
"dev": true
},
"node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@@ -18109,6 +18330,24 @@
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"dev": true
},
"peggy": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/peggy/-/peggy-2.0.1.tgz",
"integrity": "sha512-mBqfmdUAOVn7RILpXTbcRBhLfTR4Go0SresSnivGDdRylBOyVFJncFiVyCNNpPWq8HmgeRleXHs/Go4o8kQVXA==",
"dev": true,
"requires": {
"commander": "^9.3.0",
"source-map-generator": "0.8.0"
},
"dependencies": {
"commander": {
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-9.3.0.tgz",
"integrity": "sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==",
"dev": true
}
}
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
@@ -18361,9 +18600,9 @@
"version": "file:packages/react",
"requires": {
"@codemirror/lang-javascript": "^0.19.0",
"@strudel.cycles/core": "*",
"@strudel.cycles/eval": "*",
"@strudel.cycles/tone": "*",
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.2",
"@vitejs/plugin-react": "^1.3.0",
@@ -19227,6 +19466,12 @@
"is-plain-obj": "^2.0.0"
}
},
"source-map-generator": {
"version": "0.8.0",
"resolved": "https://registry.npmjs.org/source-map-generator/-/source-map-generator-0.8.0.tgz",
"integrity": "sha512-psgxdGMwl5MZM9S3FWee4EgsEaIjahYV5AzGnwUvPhWeITz/j6rKpysQHlQ4USdxvINlb8lKfWGIXwfkrgtqkA==",
"dev": true
},
"source-map-js": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
@@ -20004,6 +20249,16 @@
"defaults": "^1.0.3"
}
},
"web-streams-polyfill": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
"integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==",
"dev": true
},
"WebDirt": {
"version": "git+ssh://git@github.com/dktr0/WebDirt.git#425dc8fd023440d9c61ffdb8642e44e2710faea0",
"from": "WebDirt@github:dktr0/WebDirt"
},
"webidl-conversions": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
+2 -1
View File
@@ -6,7 +6,8 @@
"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",
"setup": "npm i && npm run bootstrap && cd repl && npm i && cd ../tutorial && npm i",
"snapshot": "cd repl && npm run snapshot",
"repl": "cd repl && npm run dev",
"osc": "cd packages/osc && npm run server",
"build": "rm -rf out && cd repl && npm run build && cd ../tutorial && npm run build",
+592 -109
View File
@@ -8,100 +8,433 @@ import { Pattern, sequence } from './pattern.mjs';
const controls = {};
const generic_params = [
/**
* Select a sound / sample by name.
*
* <details>
* <summary>show all sounds</summary>
*
* 808 (6) 808bd (25) 808cy (25) 808hc (5) 808ht (5) 808lc (5) 808lt (5) 808mc (5) 808mt (5) 808oh (5) 808sd (25) 909 (1) ab (12) ade (10) ades2 (9) ades3 (7) ades4 (6) alex (2) alphabet (26) amencutup (32) armora (7) arp (2) arpy (11) auto (11) baa (7) baa2 (7) bass (4) bass0 (3) bass1 (30) bass2 (5) bass3 (11) bassdm (24) bassfoo (3) battles (2) bd (24) bend (4) bev (2) bin (2) birds (10) birds3 (19) bleep (13) blip (2) blue (2) bottle (13) breaks125 (2) breaks152 (1) breaks157 (1) breaks165 (1) breath (1) bubble (8) can (14) casio (3) cb (1) cc (6) chin (4) circus (3) clak (2) click (4) clubkick (5) co (4) coins (1) control (2) cosmicg (15) cp (2) cr (6) crow (4) d (4) db (13) diphone (38) diphone2 (12) dist (16) dork2 (4) dorkbot (2) dr (42) dr2 (6) dr55 (4) dr_few (8) drum (6) drumtraks (13) e (8) east (9) electro1 (13) em2 (6) erk (1) f (1) feel (7) feelfx (8) fest (1) fire (1) flick (17) fm (17) foo (27) future (17) gab (10) gabba (4) gabbaloud (4) gabbalouder (4) glasstap (3) glitch (8) glitch2 (8) gretsch (24) gtr (3) h (7) hand (17) hardcore (12) hardkick (6) haw (6) hc (6) hh (13) hh27 (13) hit (6) hmm (1) ho (6) hoover (6) house (8) ht (16) if (5) ifdrums (3) incoming (8) industrial (32) insect (3) invaders (18) jazz (8) jungbass (20) jungle (13) juno (12) jvbass (13) kicklinn (1) koy (2) kurt (7) latibro (8) led (1) less (4) lighter (33) linnhats (6) lt (16) made (7) made2 (1) mash (2) mash2 (4) metal (10) miniyeah (4) monsterb (6) moog (7) mouth (15) mp3 (4) msg (9) mt (16) mute (28) newnotes (15) noise (1) noise2 (8) notes (15) numbers (9) oc (4) odx (15) off (1) outdoor (6) pad (3) padlong (1) pebbles (1) perc (6) peri (15) pluck (17) popkick (10) print (11) proc (2) procshort (8) psr (30) rave (8) rave2 (4) ravemono (2) realclaps (4) reverbkick (1) rm (2) rs (1) sax (22) sd (2) seawolf (3) sequential (8) sf (18) sheffield (1) short (5) sid (12) sine (6) sitar (8) sn (52) space (18) speakspell (12) speech (7) speechless (10) speedupdown (9) stab (23) stomp (10) subroc3d (11) sugar (2) sundance (6) tabla (26) tabla2 (46) tablex (3) tacscan (22) tech (13) techno (7) tink (5) tok (4) toys (13) trump (11) ul (10) ulgab (5) uxay (3) v (6) voodoo (5) wind (10) wobble (1) world (3) xmas (1) yeah (31)
*
* <a href="https://tidalcycles.org/docs/configuration/Audio%20Samples/default_library" target="_blank">more info</a>
*
* </details>
*
* @name s
* @param {string | Pattern} sound The sound / pattern of sounds to pick
* @example
* s("bd hh").osc()
*
*/
['s', 's', 'sound'],
/**
* The note or sample number to choose for a synth or sampleset
* Note names currently not working yet, but will hopefully soon. Just stick to numbers for now
*
* @name n
* @param {string | number | Pattern} value note name, note number or sample number
* @example
* s('superpiano').n("<0 1 2 3>").osc()
* @example
* s('superpiano').n("<c4 d4 e4 g4>").osc()
* @example
* n("0 1 2 3").s('east').osc()
*/
// TODO: nOut does not work
// TODO: notes don't work as expected
// current "workaround" for notes:
// s('superpiano').n("<c0 d0 e0 g0>"._asNumber()).osc()
// -> .n or .osc (or .superdirt) would need to convert note strings to numbers
// also see https://github.com/tidalcycles/strudel/pull/63
['f', 'n', 'The note or sample number to choose for a synth or sampleset'],
['f', 'note', 'The note or pitch to play a sound or synth with'],
//['s', 'toArg', 'for internal sound routing'],
// ["f", "from", "for internal sound routing"),
//['f', 'to', 'for internal sound routing'],
/**
* A pattern of numbers that speed up (or slow down) samples while they play. Currently only supported by osc / superdirt.
*
* @name accelerate
* @param {number | Pattern} amount acceleration.
* @example
* s("sax").accelerate("<0 1 2 4 8 16>").slow(2).osc()
*
*/
['f', 'accelerate', 'a pattern of numbers that speed up (or slow down) samples while they play.'],
['f', 'amp', 'like @gain@, but linear.'],
[
'f',
'attack',
'a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample.',
],
['f', 'bandf', 'a pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'],
['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'],
[
'f',
'begin',
'a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.',
],
['f', 'legato', 'controls the amount of overlap between two adjacent sounds'],
// ['f', 'clhatdecay', ''],
[
'f',
'crush',
'bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).',
],
[
'f',
'coarse',
'fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on.',
],
['i', 'channel', 'choose the channel the pattern is sent to in superdirt'],
[
'i',
'cut',
'In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.',
],
['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'],
// ['f', 'cutoffegint', ''],
['f', 'decay', ''],
['f', 'delay', 'a pattern of numbers from 0 to 1. Sets the level of the delay signal.'],
['f', 'delayfeedback', 'a pattern of numbers from 0 to 1. Sets the amount of delay feedback.'],
['f', 'delaytime', 'a pattern of numbers from 0 to 1. Sets the length of the delay.'],
['f', 'detune', ''],
['f', 'djf', 'DJ filter, below 0.5 is low pass filter, above is high pass filter.'],
[
'f',
'dry',
'when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb.',
],
[
'f',
'end',
'the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample.',
],
[
'f',
'fadeTime',
"Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope.",
],
[
'f',
'fadeInTime',
'As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample.',
],
['f', 'freq', ''],
/**
* Like {@link amp}, but exponential.
*
* @name gain
* @param {number | Pattern} amount gain.
* @example
* s("bd*8").gain(".7*2 1 .7*2 1 .7 1").osc()
*
*/
[
'f',
'gain',
'a pattern of numbers that specify volume. Values less than 1 make the sound quieter. Values greater than 1 make the sound louder. For the linear equivalent, see @amp@.',
],
['f', 'gate', ''],
// ['f', 'hatgrain', ''],
/**
* Like {@link gain}, but linear.
*
* @name amp
* @param {number | Pattern} amount gain.
* @example
* s("bd*8").amp(".1*2 .5 .1*2 .5 .1 .5").osc()
*
*/
['f', 'amp', 'like @gain@, but linear.'],
// TODO: find out why 0 does not work, and it generally seems not right
/*
* A pattern of numbers to specify the attack time of an envelope applied to each sample.
*
* @name attack
* @param {number | Pattern} attack time in seconds.
* @example
* n("c5 e5").s('superpiano').attack("<0 .1>").osc()
*
*/
[
'f',
'hcutoff',
'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@',
'attack',
'a pattern of numbers to specify the attack time (in seconds) of an envelope applied to each sample.',
],
// TODO: find out how this works?
/*
* Envelope decay time = the time it takes after the attack time to reach the sustain level.
*
* @name decay
* @param {number | Pattern} time decay time in seconds
* @example
* s("sax").cut(1).decay("<.1 .2 .3 .4>").sustain(0).osc()
*
*/
['f', 'decay', ''],
['f', 'sustain', ''],
[
'f',
'release',
'a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample.',
],
[
'f',
'hold',
'a pattern of numbers to specify the hold time (in seconds) of an envelope applied to each sample. Only takes effect if `attack` and `release` are also specified.',
],
// TODO: in tidal, it seems to be normalized
/**
* Sets the center frequency of the band-pass filter.
*
* @name bandf
* @param {number | Pattern} frequency center frequency
* @example
* s("bd sd").bandf("<1000 2000 4000 8000>").osc()
*
*/
['f', 'bandf', 'A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'],
// TODO: in tidal, it seems to be normalized
/**
* Sets the q-factor of the band-pass filter
*
* @name bandq
* @param {number | Pattern} q q factor
* @example
* s("bd sd").bandf(2000).bandq("<.2 .9>").osc()
*
*/
['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'],
/**
* a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
*
* @name begin
* @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample
* @example
* s("rave").begin("<0 .25 .5 .75>").osc()
*
*/
[
'f',
'begin',
'a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.',
],
/**
* The same as {@link begin}, but cuts off the end off each sample.
*
* @name end
* @param {number | Pattern} length 1 = whole sample, .5 = half sample, .25 = quarter sample etc..
* @example
* s("bd*2,ho*4").end("<.1 .2 .5 1>").osc()
*
*/
[
'f',
'end',
'the same as `begin`, but cuts the end off samples, shortening them; e.g. `0.75` to cut off the last quarter of each sample.',
],
/**
* Loops the sample (from `begin` to `end`) the specified number of times.
* Note that the tempo of the loop is not synced with the cycle tempo.
*
* @name loop
* @param {number | Pattern} times How often the sample is looped
* @example
* s("bd").loop("<1 2 3 4>").osc()
*
*/
['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'],
// TODO: currently duplicated with "native" legato
// TODO: superdirt legato will do more: https://youtu.be/dQPmE1WaD1k?t=419
/**
* a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample.
*
* @name legato
* @param {number | Pattern} duration between 0 and 1, where 1 is the length of the whole hap time
* @example
* "c4 eb4 g4 bb4".legato("<0.125 .25 .5 .75 1 2 4>")
*
*/
['f', 'legato', 'controls the amount of overlap between two adjacent sounds'],
// ['f', 'clhatdecay', ''],
/**
* bit crusher effect.
*
* @name crush
* @param {number | Pattern} depth between 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).
* @example
* s("<bd sd>,hh*3,jvbass*2").fast(2).crush("<16 8 7 6 5 4 3 2>").osc()
*
*/
[
'f',
'crush',
'bit crushing, a pattern of numbers from 1 (for drastic reduction in bit-depth) to 16 (for barely no reduction).',
],
/**
* fake-resampling for lowering the sample rate
*
* @name coarse
* @param {number | Pattern} factor 1 for original 2 for half, 3 for a third and so on.
* @example
* s("xmas").coarse("<1 4 8 16 32>").osc()
*
*/
[
'f',
'coarse',
'fake-resampling, a pattern of numbers for lowering the sample rate, i.e. 1 for original 2 for half, 3 for a third and so on.',
],
/**
* choose the channel the pattern is sent to in superdirt
*
* @name channel
* @param {number | Pattern} channel channel number
*
*/
['i', 'channel', 'choose the channel the pattern is sent to in superdirt'],
/**
* In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.
*
* @name cut
* @param {number | Pattern} group cut group number
* @example
* s("bd sax").cut(1).osc()
*
*/
[
'i',
'cut',
'In the style of classic drum-machines, `cut` will stop a playing sample as soon as another samples with in same cutgroup is to be played. An example would be an open hi-hat followed by a closed one, essentially muting the open.',
],
/**
* Applies the cutoff frequency of the low-pass filter.
*
* @name cutoff
* @param {number | Pattern} frequency audible between 0 and 20000
* @example
* s("bd,hh*2,<~ sd>").fast(2).cutoff("<4000 2000 1000 500 200 100>").osc()
*
*/
// TODO: add lpf synonym
['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'],
/**
* Applies the cutoff frequency of the high-pass filter.
*
* @name hcutoff
* @param {number | Pattern} frequency audible between 0 and 20000
* @example
* s("bd,hh*2,<~ sd>").fast(2).hcutoff("<4000 2000 1000 500 200 100>").osc()
*
*/
// TODO: add hpf synonym
[
'f',
'hcutoff',
'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@',
],
/**
* Applies the cutoff frequency of the high-pass filter.
*
* @name hresonance
* @param {number | Pattern} q resonance factor between 0 and 1
* @example
* s("bd,hh*2,<~ sd>").fast(2).hcutoff(2000).hresonance("<0 .2 .4 .6>").osc()
*
*/
[
'f',
'hresonance',
'a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@',
],
// TODO: add hpq synonym
/**
* Applies the cutoff frequency of the low-pass filter.
*
* @name resonance
* @param {number | Pattern} q resonance factor between 0 and 1
* @example
* s("bd,hh*2,<~ sd>").fast(2).cutoff(2000).resonance("<0 .2 .4 .6>").osc()
*
*/
['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'],
// TODO: add lpq synonym?
/**
* Set detune of oscillators. Works only with some synths, see <a target="_blank" href="https://tidalcycles.org/docs/patternlib/tutorials/synthesizers">tidal doc</a>
*
* @name djf
* @param {number | Pattern} cutoff below 0.5 is low pass filter, above is high pass filter
* @example
* n("0 3 7 [10,24]").s('superzow').octave(3).djf("<.5 .25 .5 .75>").osc()
*
*/
['f', 'djf', 'DJ filter, below 0.5 is low pass filter, above is high pass filter.'],
// ['f', 'cutoffegint', ''],
// TODO: does not seem to work
/*
* Sets the level of the delay signal.
*
* @name delay
* @param {number | Pattern} level between 0 and 1
* @example
* s("bd").delay("<0 .5 .75 1>").osc()
*
*/
['f', 'delay', 'a pattern of numbers from 0 to 1. Sets the level of the delay signal.'],
['f', 'delayfeedback', 'a pattern of numbers from 0 to 1. Sets the amount of delay feedback.'],
['f', 'delaytime', 'a pattern of numbers from 0 to 1. Sets the length of the delay.'],
/* // TODO: test
* Specifies whether delaytime is calculated relative to cps.
*
* @name lock
* @param {number | Pattern} enable When set to 1, delaytime is a direct multiple of a cycle.
* @example
* s("sd").delay().lock(1).osc()
*
*/
[
'f',
'lock',
'A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle.',
],
/**
* Set detune of oscillators. Works only with some synths, see <a target="_blank" href="https://tidalcycles.org/docs/patternlib/tutorials/synthesizers">tidal doc</a>
*
* @name detune
* @param {number | Pattern} amount between 0 and 1
* @example
* n("0 3 7").s('superzow').octave(3).detune("<0 .25 .5 1 2>").osc()
*
*/
['f', 'detune', ''],
/**
* Set dryness of reverb. See {@link room} and {@link size} for more information about reverb.
*
* @name dry
* @param {number | Pattern} dry 0 = wet, 1 = dry
* @example
* n("[0,3,7](3,8)").s("superpiano").room(.7).dry("<0 .5 .75 1>").osc()
*
*/
[
'f',
'dry',
'when set to `1` will disable all reverb for this pattern. See `room` and `size` for more information about reverb.',
],
// TODO: does not seem to do anything
/*
* Used when using {@link begin}/{@link end} or {@link chop}/{@link striate} and friends, to change the fade out time of the 'grain' envelope.
*
* @name fadeTime
* @param {number | Pattern} time between 0 and 1
* @example
* s("ho*4").end(.1).fadeTime("<0 .2 .4 .8>").osc()
*
*/
[
'f',
'fadeTime',
"Used when using begin/end or chop/striate and friends, to change the fade out time of the 'grain' envelope.",
],
// TODO: see above
[
'f',
'fadeInTime',
'As with fadeTime, but controls the fade in time of the grain envelope. Not used if the grain begins at position 0 in the sample.',
],
/**
* Set frequency of sound.
*
* @name freq
* @param {number | Pattern} frequency in Hz. the audible range is between 20 and 20000 Hz
* @example
* freq("220 110 440 110").s("superzow").osc()
* @example
* freq("110".mulOut(".5 1.5 .6 [2 3]")).s("superzow").osc()
*
*/
['f', 'freq', ''],
// TODO: https://tidalcycles.org/docs/configuration/MIDIOSC/control-voltage/#gate
['f', 'gate', ''],
// ['f', 'hatgrain', ''],
// ['f', 'lagogo', ''],
// ['f', 'lclap', ''],
// ['f', 'lclaves', ''],
// ['f', 'lclhat', ''],
// ['f', 'lcrash', ''],
// TODO:
// https://tidalcycles.org/docs/reference/audio_effects/#leslie-1
// https://tidalcycles.org/docs/reference/audio_effects/#leslie
/**
* Emulation of a Leslie speaker: speakers rotating in a wooden amplified cabinet.
*
* @name leslie
* @param {number | Pattern} wet between 0 and 1
* @example
* n("0,4,7").s("supersquare").leslie("<0 .4 .6 1>").osc()
*
*/
['f', 'leslie', ''],
/**
* Rate of modulation / rotation for leslie effect
*
* @name lrate
* @param {number | Pattern} rate 6.7 for fast, 0.7 for slow
* @example
* n("0,4,7").s("supersquare").leslie(1).lrate("<1 2 4 8>").osc()
*
*/
// TODO: the rate seems to "lag" (in the example, 1 will be fast)
['f', 'lrate', ''],
/**
* Physical size of the cabinet in meters. Be careful, it might be slightly larger than your computer. Affects the Doppler amount (pitch warble)
*
* @name lsize
* @param {number | Pattern} meters somewhere between 0 and 1
* @example
* n("0,4,7").s("supersquare").leslie(1).lrate(2).lsize("<.1 .5 1>").osc()
*
*/
['f', 'lsize', ''],
// ['f', 'lfo', ''],
// ['f', 'lfocutoffint', ''],
@@ -113,47 +446,86 @@ const generic_params = [
// ['f', 'lhitom', ''],
// ['f', 'lkick', ''],
// ['f', 'llotom', ''],
[
'f',
'lock',
'A pattern of numbers. Specifies whether delaytime is calculated relative to cps. When set to 1, delaytime is a direct multiple of a cycle.',
],
['f', 'loop', 'loops the sample (from `begin` to `end`) the specified number of times.'],
// ['f', 'lophat', ''],
// ['f', 'lsnare', ''],
['f', 'n', 'The note or sample number to choose for a synth or sampleset'],
['f', 'note', 'The note or pitch to play a sound or synth with'],
['f', 'degree', ''],
['f', 'mtranspose', ''],
['f', 'ctranspose', ''],
['f', 'harmonic', ''],
['f', 'stepsPerOctave', ''],
['f', 'octaveR', ''],
['f', 'degree', ''], // TODO: what is this? not found in tidal doc
['f', 'mtranspose', ''], // TODO: what is this? not found in tidal doc
['f', 'ctranspose', ''], // TODO: what is this? not found in tidal doc
['f', 'harmonic', ''], // TODO: what is this? not found in tidal doc
['f', 'stepsPerOctave', ''], // TODO: what is this? not found in tidal doc
['f', 'octaveR', ''], // TODO: what is this? not found in tidal doc
// TODO: why is this needed? what's the difference to late / early?
[
'f',
'nudge',
'Nudges events into the future by the specified number of seconds. Negative numbers work up to a point as well (due to internal latency)',
],
// TODO: the following doc is just a guess, it's not documented in tidal doc.
/**
* Sets the default octave of a synth.
*
* @name octave
* @param {number | Pattern} octave octave number
* @example
* n("0,4,7").s('supersquare').octave("<3 4 5 6>").osc()
*/
['i', 'octave', ''],
['f', 'offset', ''],
['f', 'offset', ''], // TODO: what is this? not found in tidal doc
// ['f', 'ophatdecay', ''],
// TODO: example
/**
* a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.
*
* @name orbit
* @param {number | Pattern} number
*
*/
[
'i',
'orbit',
'a pattern of numbers. An `orbit` is a global parameter context for patterns. Patterns with the same orbit will share hardware output bus offset and global effects, e.g. reverb and delay. The maximum number of orbits is specified in the superdirt startup, numbers higher than maximum will wrap around.',
],
['f', 'overgain', ''],
['f', 'overshape', ''],
['f', 'overgain', ''], // TODO: what is this? not found in tidal doc
['f', 'overshape', ''], // TODO: what is this? not found in tidal doc
/**
* Sets position in stereo.
*
* @name pan
* @param {number | Pattern} pan between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)
* @example
* s("[bd hh]*2").pan("<.5 1 .5 0>").osc()
*
*/
[
'f',
'pan',
'a pattern of numbers between 0 and 1, from left to right (assuming stereo), once round a circle (assuming multichannel)',
],
// TODO: this has no effect (see example)
/*
* Controls how much multichannel output is fanned out
*
* @name panspan
* @param {number | Pattern} span between -inf and inf, negative is backwards ordering
* @example
* s("[bd hh]*2").pan("<.5 1 .5 0>").panspan("<0 .5 1>").osc()
*
*/
[
'f',
'panspan',
'a pattern of numbers between -inf and inf, which controls how much multichannel output is fanned out (negative is backwards ordering)',
],
// TODO: this has no effect (see example)
/*
* Controls how much multichannel output is spread
*
* @name pansplay
* @param {number | Pattern} spread between 0 and 1
* @example
* s("[bd hh]*2").pan("<.5 1 .5 0>").pansplay("<0 .5 1>").osc()
*
*/
[
'f',
'pansplay',
@@ -173,68 +545,163 @@ const generic_params = [
// ['f', 'pitch2', ''],
// ['f', 'pitch3', ''],
// ['f', 'portamento', ''],
// TODO: LFO rate see https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
['f', 'rate', "used in SuperDirt softsynths as a control rate or 'speed'"],
[
'f',
'release',
'a pattern of numbers to specify the release time (in seconds) of an envelope applied to each sample.',
],
['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'],
['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'],
// ['f', 'sagogo', ''],
// ['f', 'sclap', ''],
// ['f', 'sclaves', ''],
// ['f', 'scrash', ''],
// TODO: slide param for certain synths
['f', 'slide', ''],
// TODO: detune? https://tidalcycles.org/docs/patternlib/tutorials/synthesizers/#supersquare
['f', 'semitone', ''],
[
'f',
'shape',
'wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion.',
],
// TODO: dedup with synth param, see https://tidalcycles.org/docs/reference/synthesizers/#superpiano
['f', 'velocity', ''],
['f', 'voice', ''], // TODO: synth param
/**
* Sets the level of reverb.
*
* @name room
* @param {number | Pattern} level between 0 and 1
* @example
* s("bd sd").room("<0 .2 .4 .6 .8 1>").osc()
*
*/
['f', 'room', 'a pattern of numbers from 0 to 1. Sets the level of reverb.'],
/**
* Sets the room size of the reverb, see {@link room}.
*
* @name size
* @param {number | Pattern} size between 0 and 1
* @example
* s("bd sd").room(.8).size("<0 .2 .4 .6 .8 1>").osc()
*
*/
// TODO: find out why :
// s("bd sd").room(.8).size("<0 .2 .4 .6 .8 [1,0]>").osc()
// .. does not work. Is it because room is only one effect?
[
'f',
'size',
'a pattern of numbers from 0 to 1. Sets the perceptual size (reverb time) of the `room` to be used in reverb.',
],
['f', 'slide', ''],
// ['f', 'sagogo', ''],
// ['f', 'sclap', ''],
// ['f', 'sclaves', ''],
// ['f', 'scrash', ''],
/**
* Wave shaping distortion. CAUTION: it might get loud
*
* @name shape
* @param {number | Pattern} distortion between 0 and 1
* @example
* s("bd sd").shape("<0 .2 .4 .6 .8 1>").osc()
*
*/
[
'f',
'shape',
'wave shaping distortion, a pattern of numbers from 0 for no distortion up to 1 for loads of distortion.',
],
/**
* Changes the speed of sample playback, i.e. a cheap way of changing pitch.
*
* @name speed
* @param {number | Pattern} speed -inf to inf, negative numbers play the sample backwards.
* @example
* s("bd").speed("<1 2 4 1 -2 -4>").osc()
* @example
* speed("1 1.5*2 [2 1.1]").s("sax").cut(1).osc()
*
*/
[
'f',
'speed',
'a pattern of numbers which changes the speed of sample playback, i.e. a cheap way of changing pitch. Negative values will play the sample backwards!',
],
['f', 'squiz', ''],
['f', 'stutterdepth', ''],
['f', 'stuttertime', ''],
['f', 'sustain', ''],
['f', 'timescale', ''],
['f', 'timescalewin', ''],
// ['f', 'tomdecay', ''],
/**
* Used in conjunction with {@link speed}, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.
*
* @name unit
* @param {number | string | Pattern} unit see description above
* @example
* speed("1 2 .5 3").s("bd").unit("c").osc()
*
*/
[
's',
'unit',
'used in conjunction with `speed`, accepts values of "r" (rate, default behavior), "c" (cycles), or "s" (seconds). Using `unit "c"` means `speed` will be interpreted in units of cycles, e.g. `speed "1"` means samples will be stretched to fill a cycle. Using `unit "s"` means the playback speed will be adjusted so that the duration is the number of seconds specified by `speed`.',
],
['f', 'velocity', ''],
/**
* Made by Calum Gunn. Reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter. The SuperCollider manual defines Squiz as:
*
* "A simplistic pitch-raising algorithm. It's not meant to sound natural; its sound is reminiscent of some weird mixture of filter, ring-modulator and pitch-shifter, depending on the input. The algorithm works by cutting the signal into fragments (delimited by upwards-going zero-crossings) and squeezing those fragments in the time domain (i.e. simply playing them back faster than they came in), leaving silences inbetween. All the parameters apart from memlen can be modulated."
*
* @name squiz
* @param {number | Pattern} squiz Try passing multiples of 2 to it - 2, 4, 8 etc.
* @example
* squiz("2 4/2 6 [8 16]").s("bd").osc()
*
*/
['f', 'squiz', ''],
['f', 'stutterdepth', ''], // TODO: what is this? not found in tidal doc
['f', 'stuttertime', ''], // TODO: what is this? not found in tidal doc
['f', 'timescale', ''], // TODO: what is this? not found in tidal doc
['f', 'timescalewin', ''], // TODO: what is this? not found in tidal doc
// ['f', 'tomdecay', ''],
// ['f', 'vcfegint', ''],
// ['f', 'vcoegint', ''],
['f', 'voice', ''],
/**
*
* Formant filter to make things sound like vowels.
*
* @name vowel
* @param {string | Pattern} vowel You can use a e i o u. Use a rest (~) to override the effect
* @example
* vowel("a e i [o u]").slow(2)
* .n("<[0,7]!4 [2,7]!4>")
* .s('supersquare').osc()
*
*/
[
's',
'vowel',
'formant filter to make things sound like vowels, a pattern of either `a`, `e`, `i`, `o` or `u`. Use a rest (`~`) for no effect.',
],
/* // TODO: find out how it works
* Made by Calum Gunn. Divides an audio stream into tiny segments, using the signal's zero-crossings as segment boundaries, and discards a fraction of them. Takes a number between 1 and 100, denoted the percentage of segments to drop. The SuperCollider manual describes the Waveloss effect this way:
*
* Divide an audio stream into tiny segments, using the signal's zero-crossings as segment boundaries, and discard a fraction of them (i.e. replace them with silence of the same length). The technique was described by Trevor Wishart in a lecture. Parameters: the filter drops drop out of out of chunks. mode can be 1 to drop chunks in a simple deterministic fashion (e.g. always dropping the first 30 out of a set of 40 segments), or 2 to drop chunks randomly but in an appropriate proportion.)
*
* mode: ?
* waveloss: ?
*
* @name waveloss
*/
['f', 'waveloss', ''],
// TODO: midi effects?
['f', 'dur', ''],
// ['f', 'modwheel', ''],
['f', 'expression', ''],
['f', 'sustainpedal', ''],
/* // TODO: doesn't seem to do anything
*
* Tremolo Audio DSP effect
*
* @name tremolodepth
* @param {number | Pattern} depth between 0 and 1
* @example
* n("0,4,7").tremolodepth("<0 .3 .6 .9>").osc()
*
*/
// TODO: tremdp alias
['f', 'tremolodepth', "Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],
['f', 'tremolorate', "Tremolo Audio DSP effect | params are 'tremolorate' and 'tremolodepth'"],
// TODO: doesn't seem to do anything
['f', 'phaserdepth', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],
['f', 'phaserrate', "Phaser Audio DSP effect | params are 'phaserrate' and 'phaserdepth'"],
['f', 'fshift', 'frequency shifter'],
['f', 'fshiftnote', 'frequency shifter'],
['f', 'fshiftphase', 'frequency shifter'],
['f', 'triode', 'tube distortion'],
['f', 'krush', 'shape/bass enhancer'],
['f', 'kcutoff', ''],
@@ -277,18 +744,34 @@ const generic_params = [
['f', 'uid', ''],
['f', 'val', ''],
['f', 'cps', ''],
['f', 'clip', ''],
];
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
const _name = (name, ...pats) => sequence(...pats).withValue((x) => ({ [name]: x }));
const _setter = (func) =>
const _setter = (func, name) =>
function (...pats) {
if (!pats.length) {
return this.fmap((value) => ({ [name]: value }));
}
return this.set(func(...pats));
};
generic_params.forEach(([type, name, description]) => {
controls[name] = (...pats) => _name(name, ...pats);
Pattern.prototype[name] = _setter(controls[name]);
Pattern.prototype[name] = _setter(controls[name], name);
});
// create custom param
controls.createParam = (name) => {
const func = (...pats) => _name(name, ...pats);
Pattern.prototype[name] = _setter(func, name);
return (...pats) => _name(name, ...pats);
};
controls.createParams = (...names) =>
names.reduce((acc, name) => Object.assign(acc, { [name]: createParam(name) }), {});
export default controls;
+16
View File
@@ -6,6 +6,22 @@ This program is free software: you can redistribute it and/or modify it under th
import Fraction, { gcd } from './fraction.mjs';
/**
* Intended for a debugging, drawLine renders the pattern as a string, where each character represents the same time span.
* Should only be used with single characters as values, otherwise the character slots will be messed up.
* Character legend:
*
* - "|" cycle separator
* - "-" hold previous value
* - "." silence
*
* @param {Pattern} pattern the pattern to use
* @param {number} chars max number of characters (approximately)
* @returns string
* @example
* const line = drawLine("0 [1 2 3]", 10); // |0--123|0--123
* console.log(line);
*/
function drawLine(pat, chars = 60) {
let cycle = 0;
let pos = Fraction(0);
+60
View File
@@ -17,10 +17,70 @@ const euclid = (pulses, steps, rotation = 0) => {
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));
};
/**
* Similar to {@link Pattern#euclid}, but each pulse is held until the next pulse, so there will be no gaps.
*/
Pattern.prototype.euclidLegato = function (pulses, steps, rotation = 0) {
const bin_pat = euclid(pulses, steps, rotation);
const firstOne = bin_pat.indexOf(1);
+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));
+3 -5
View File
@@ -86,11 +86,9 @@ export class Hap {
}
showWhole() {
return `${this.whole == undefined ? '~' : this.whole.show()}: ${this.value}`;
}
showWhole() {
return `${this.whole == undefined ? '~' : this.whole.show()}: ${this.value}`;
return `${this.whole == undefined ? '~' : this.whole.show()}: ${
typeof this.value === 'object' ? JSON.stringify(this.value) : this.value
}`;
}
combineContext(b) {
+16 -2
View File
@@ -15,5 +15,19 @@ 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 { 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; */
console.log(
'%c // 🌀 @strudel.cycles/core loaded 🌀', // keep "//" for runnable snapshot source..
'background-color: black;color:white;padding:4px;border-radius:15px',
);
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;
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/core",
"version": "0.1.0",
"version": "0.1.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/core",
"version": "0.0.3",
"license": "GPL-3.0-or-later",
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
"bjork": "^0.0.1",
"fraction.js": "^4.2.0"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/core",
"version": "0.1.0",
"version": "0.1.2",
"description": "Port of Tidal Cycles to JavaScript",
"main": "index.mjs",
"type": "module",
+101 -16
View File
@@ -15,9 +15,11 @@ import drawLine from './drawLine.mjs';
/** @class Class representing a pattern. */
export class Pattern {
_Pattern = true; // this property is used to detect if a pattern that fails instanceof Pattern is an instance of another Pattern
/**
* Create a pattern.
* @param {function} query - The function that maps a State to Haps .
* Create a pattern. As an end user, you will most likely not create a Pattern directly.
*
* @param {function} query - The function that maps a {@link State} to an array of {@link Hap}.
*/
constructor(query) {
this.query = query;
@@ -62,7 +64,7 @@ export class Pattern {
}
/**
* As with {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to both the
* As with {@link Pattern#withQuerySpan}, but the function is applied to both the
* begin and end time of the query timespan.
* @param {Function} func the function to apply
* @returns Pattern
@@ -72,7 +74,7 @@ export class Pattern {
}
/**
* Similar to {@link Pattern#withQuerySpan|withQuerySpan}, but the function is applied to the timespans
* Similar to {@link Pattern#withQuerySpan}, but the function is applied to the timespans
* of all haps returned by pattern queries (both `part` timespans, and where
* present, `whole` timespans).
* @param {Function} func
@@ -83,7 +85,7 @@ export class Pattern {
}
/**
* As with {@link Pattern#withHapSpan|withHapSpan}, but the function is applied to both the
* As with {@link Pattern#withHapSpan}, but the function is applied to both the
* begin and end time of the hap timespans.
* @param {Function} func the function to apply
* @returns Pattern
@@ -182,7 +184,7 @@ export class Pattern {
/**
* Returns a new pattern, with the function applied to the value of
* each hap. It has the alias {@link Pattern#fmap|fmap}.
* each hap. It has the alias {@link Pattern#fmap}.
* @param {Function} func
* @returns Pattern
*/
@@ -191,7 +193,7 @@ export class Pattern {
}
/**
* see {@link Pattern#withValue|withValue}
* see {@link Pattern#withValue}
*/
fmap(func) {
return this.withValue(func);
@@ -298,7 +300,7 @@ export class Pattern {
}
/**
* As with {@link Pattern#appBoth|appBoth}, but the `whole` timespan is not the intersection,
* As with {@link Pattern#appBoth}, but the `whole` timespan is not the intersection,
* but the timespan from the function of patterns that this method is called
* on. In practice, this means that the pattern structure, including onsets,
* are preserved from the pattern of functions (often referred to as the left
@@ -330,7 +332,7 @@ export class Pattern {
}
/**
* As with {@link Pattern#appLeft|appLeft}, but `whole` timespans are instead taken from the
* As with {@link Pattern#appLeft}, but `whole` timespans are instead taken from the
* pattern of values, i.e. structure is preserved from the right hand/outer
* pattern.
* @param {Pattern} pat_val
@@ -463,35 +465,83 @@ export class Pattern {
});
}
/**
* Assumes a numerical pattern. Returns a new pattern with all values rounded
* to the nearest integer.
* @returns Pattern
*/
round() {
return this._asNumber().fmap((v) => Math.round(v));
}
/**
* Assumes a numerical pattern. Returns a new pattern with all values set to
* their mathematical floor. E.g. `3.7` replaced with to `3`, and `-4.2`
* replaced with `-5`.
* @returns Pattern
*/
floor() {
return this._asNumber().fmap((v) => Math.floor(v));
}
/**
* Assumes a numerical pattern. Returns a new pattern with all values set to
* their mathematical ceiling. E.g. `3.2` replaced with `4`, and `-4.2`
* replaced with `-4`.
* @returns Pattern
*/
ceil() {
return this._asNumber().fmap((v) => Math.ceil(v));
}
/**
* Assumes a numerical pattern, containing unipolar values in the range 0 ..
* 1. Returns a new pattern with values scaled to the bipolar range -1 .. 1
* @returns Pattern
*/
_toBipolar() {
return this.fmap((x) => x * 2 - 1);
}
/**
* Assumes a numerical pattern, containing bipolar values in the range -1 ..
* 1. Returns a new pattern with values scaled to the unipolar range 0 .. 1
* @returns Pattern
*/
_fromBipolar() {
return this.fmap((x) => (x + 1) / 2);
}
// Assumes source pattern of numbers in range 0..1
/**
* Assumes a numerical pattern, containing unipolar values in the range 0 ..
* 1. Returns a new pattern with values scaled to the given min/max range.
* @param {Number} min
* @param {Number} max
* @returns Pattern
*/
range(min, max) {
return this.mul(max - min).add(min);
}
/**
* Assumes a numerical pattern, containing unipolar values in the range 0 ..
* 1. Returns a new pattern with values scaled to the given min/max range,
* following an exponential curve.
* @param {Number} min
* @param {Number} max
* @returns Pattern
*/
rangex(min, max) {
return this.range(Math.log(min), Math.log(max)).fmap(Math.exp);
}
// Assumes source pattern of numbers in range -1..1
/**
* Assumes a numerical pattern, containing bipolar values in the range -1 ..
* 1. Returns a new pattern with values scaled to the given min/max range.
* @param {Number} min
* @param {Number} max
* @returns Pattern
*/
range2(min, max) {
return this._fromBipolar().range(min, max);
}
@@ -683,11 +733,31 @@ export class Pattern {
return this._compress(span.begin, span.end);
}
/**
* Speed up a pattern by the given factor.
*
* @name fast
* @memberof Pattern
* @param {number | Pattern} factor speed up factor
* @returns Pattern
* @example
* seq(e5, b4, d5, c5).fast(2)
*/
_fast(factor) {
const fastQuery = this.withQueryTime((t) => t.mul(factor));
return fastQuery.withHapTime((t) => t.div(factor));
}
/**
* Slow down a pattern over the given number of cycles.
*
* @name slow
* @memberof Pattern
* @param {number | Pattern} factor slow down factor
* @returns Pattern
* @example
* seq(e5, b4, d5, c5).slow(2)
*/
_slow(factor) {
return this._fast(Fraction(1).div(factor));
}
@@ -974,8 +1044,14 @@ export class Pattern {
return this._withContext((context) => ({ ...context, velocity: (context.velocity || 1) * velocity }));
}
_loopAt(factor,cps=1) {
return this.speed((1/factor)*cps).unit("c").slow(factor)
// move this to controls? (speed and unit are controls)
_loopAt(factor, cps = 1) {
return this.speed((1 / factor) * cps)
.unit('c')
.slow(factor);
}
onTrigger(onTrigger) {
return this._withHap((hap) => hap.setContext({ ...hap.context, onTrigger }));
}
}
@@ -1137,7 +1213,15 @@ export function pure(value) {
export function isPattern(thing) {
// thing?.constructor?.name !== 'Pattern' // <- this will fail when code is mangled
return thing instanceof Pattern;
const is = thing instanceof Pattern || thing._Pattern;
if (!thing instanceof Pattern) {
console.warn(
`Found Pattern that fails "instanceof Pattern" check.
This may happen if you are using multiple versions of @strudel.cycles/core.
Please check by running "npm ls @strudel.cycles/core".`,
);
}
return is;
}
export function reify(thing) {
@@ -1215,8 +1299,8 @@ export function slowcatPrime(...pats) {
* @return {Pattern}
* @example
* fastcat(e5, b4, [d5, c5])
* sequence(e5, b4, [d5, c5])
* seq(e5, b4, [d5, c5])
* // sequence(e5, b4, [d5, c5])
* // seq(e5, b4, [d5, c5])
*/
export function fastcat(...pats) {
return slowcat(...pats)._fast(pats.length);
@@ -1314,6 +1398,7 @@ export function pr(args) {
}
export const add = curry((a, pat) => pat.add(a));
export const chop = curry((a, pat) => pat.chop(a));
export const chunk = curry((a, pat) => pat.chunk(a));
export const chunkBack = curry((a, pat) => pat.chunkBack(a));
export const div = curry((a, pat) => pat.div(a));
+46
View File
@@ -22,17 +22,63 @@ export const signal = (func) => {
export const isaw = signal((t) => 1 - (t % 1));
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))
* @example
* saw.range(0,8).segment(8).scale('C major').slow(4)
*
*/
export const saw = signal((t) => t % 1);
export const saw2 = saw._toBipolar();
export const sine2 = signal((t) => Math.sin(Math.PI * 2 * t));
/**
* A sine signal between 0 and 1.
*
* @return {Pattern}
* @example
* sine.segment(16).range(0,15).slow(2).scale('C minor')
*
*/
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')
*
*/
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')
*
*/
export const square = signal((t) => Math.floor((t * 2) % 2));
export const square2 = square._toBipolar();
/**
* A triangle signal between 0 and 1.
*
* @return {Pattern}
* @example
* triangle.segment(2).range(0,7).scale('C minor')
*
*/
export const tri = fastcat(isaw, saw);
export const tri2 = fastcat(isaw2, saw2);
+2 -2
View File
@@ -10,7 +10,7 @@ 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])([#bs]*)([0-9])?$/)?.slice(1) || [];
if (!pc) {
return [];
}
@@ -24,7 +24,7 @@ export const toMidi = (note) => {
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 }[char], 0) || 0;
return (Number(oct) + 1) * 12 + chroma + offset;
};
export const fromMidi = (n) => {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/embed",
"version": "0.1.0",
"version": "0.1.1",
"description": "Embeddable Web Component to load a Strudel REPL into an iframe",
"main": "embed.js",
"type": "module",
+4 -2
View File
@@ -15,9 +15,11 @@ npm i @strudel.cycles/eval --save
```js
import { evaluate, extend } from '@strudel.cycles/eval';
import * as strudel from '@strudel.cycles/core';
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);
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/eval",
"version": "0.1.0",
"version": "0.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/eval",
"version": "0.0.3",
"license": "GPL-3.0-or-later",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/eval",
"version": "0.1.0",
"version": "0.1.3",
"description": "Code evaluator for strudel",
"main": "index.mjs",
"type": "module",
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/core": "^0.1.2",
"estraverse": "^5.3.0",
"shift-ast": "^6.1.0",
"shift-codegen": "^7.0.3",
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/midi",
"version": "0.1.0",
"version": "0.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/midi",
"version": "0.0.4",
"license": "GPL-3.0-or-later",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"tone": "^14.7.77",
"webmidi": "^2.5.2"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/midi",
"version": "0.1.0",
"version": "0.1.3",
"description": "Midi API for strudel",
"main": "index.mjs",
"repository": {
@@ -21,7 +21,7 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/tone": "^0.1.0",
"@strudel.cycles/tone": "^0.1.3",
"tone": "^14.7.77",
"webmidi": "^2.5.2"
}
+164 -158
View File
@@ -1,10 +1,4 @@
/*
krill-parser.js - <short description TODO>
Copyright (C) 2022 Strudel contributors - see <https://github.com/tidalcycles/strudel/blob/main/packages/mini/krill-parser.js>
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/>.
*/
// Generated by Peggy 1.2.0.
// Generated by Peggy 2.0.1.
//
// https://peggyjs.org/
@@ -16,6 +10,7 @@ function peg$subclass(child, parent) {
function peg$SyntaxError(message, expected, found, location) {
var self = Error.call(this, message);
// istanbul ignore next Check is a necessary evil to support older environments
if (Object.setPrototypeOf) {
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
}
@@ -51,14 +46,15 @@ peg$SyntaxError.prototype.format = function(sources) {
var loc = this.location.source + ":" + s.line + ":" + s.column;
if (src) {
var e = this.location.end;
var filler = peg$padEnd("", s.line.toString().length);
var filler = peg$padEnd("", s.line.toString().length, ' ');
var line = src[s.line - 1];
var last = s.line === e.line ? e.column : line.length + 1;
var hatLen = (last - s.column) || 1;
str += "\n --> " + loc + "\n"
+ filler + " |\n"
+ s.line + " | " + line + "\n"
+ filler + " | " + peg$padEnd("", s.column - 1)
+ peg$padEnd("", last - s.column, "^");
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
+ peg$padEnd("", hatLen, "^");
} else {
str += "\n at " + loc;
}
@@ -79,7 +75,7 @@ peg$SyntaxError.buildMessage = function(expected, found) {
: classEscape(part);
});
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
},
any: function() {
@@ -185,31 +181,32 @@ function peg$parse(input, options) {
var peg$c7 = "#";
var peg$c8 = "^";
var peg$c9 = "_";
var peg$c10 = "[";
var peg$c11 = "]";
var peg$c12 = "<";
var peg$c13 = ">";
var peg$c14 = "@";
var peg$c15 = "!";
var peg$c16 = "(";
var peg$c17 = ")";
var peg$c18 = "/";
var peg$c19 = "*";
var peg$c20 = "%";
var peg$c21 = "struct";
var peg$c22 = "target";
var peg$c23 = "euclid";
var peg$c24 = "slow";
var peg$c25 = "rotL";
var peg$c26 = "rotR";
var peg$c27 = "fast";
var peg$c28 = "scale";
var peg$c29 = "//";
var peg$c30 = "cat";
var peg$c31 = "$";
var peg$c32 = "setcps";
var peg$c33 = "setbpm";
var peg$c34 = "hush";
var peg$c10 = ":";
var peg$c11 = "[";
var peg$c12 = "]";
var peg$c13 = "<";
var peg$c14 = ">";
var peg$c15 = "@";
var peg$c16 = "!";
var peg$c17 = "(";
var peg$c18 = ")";
var peg$c19 = "/";
var peg$c20 = "*";
var peg$c21 = "%";
var peg$c22 = "struct";
var peg$c23 = "target";
var peg$c24 = "euclid";
var peg$c25 = "slow";
var peg$c26 = "rotL";
var peg$c27 = "rotR";
var peg$c28 = "fast";
var peg$c29 = "scale";
var peg$c30 = "//";
var peg$c31 = "cat";
var peg$c32 = "$";
var peg$c33 = "setcps";
var peg$c34 = "setbpm";
var peg$c35 = "hush";
var peg$r0 = /^[1-9]/;
var peg$r1 = /^[eE]/;
@@ -235,32 +232,33 @@ function peg$parse(input, options) {
var peg$e14 = peg$literalExpectation("#", false);
var peg$e15 = peg$literalExpectation("^", false);
var peg$e16 = peg$literalExpectation("_", false);
var peg$e17 = peg$literalExpectation("[", false);
var peg$e18 = peg$literalExpectation("]", false);
var peg$e19 = peg$literalExpectation("<", false);
var peg$e20 = peg$literalExpectation(">", false);
var peg$e21 = peg$literalExpectation("@", false);
var peg$e22 = peg$literalExpectation("!", false);
var peg$e23 = peg$literalExpectation("(", false);
var peg$e24 = peg$literalExpectation(")", false);
var peg$e25 = peg$literalExpectation("/", false);
var peg$e26 = peg$literalExpectation("*", false);
var peg$e27 = peg$literalExpectation("%", false);
var peg$e28 = peg$literalExpectation("struct", false);
var peg$e29 = peg$literalExpectation("target", false);
var peg$e30 = peg$literalExpectation("euclid", false);
var peg$e31 = peg$literalExpectation("slow", false);
var peg$e32 = peg$literalExpectation("rotL", false);
var peg$e33 = peg$literalExpectation("rotR", false);
var peg$e34 = peg$literalExpectation("fast", false);
var peg$e35 = peg$literalExpectation("scale", false);
var peg$e36 = peg$literalExpectation("//", false);
var peg$e37 = peg$classExpectation(["\n"], true, false);
var peg$e38 = peg$literalExpectation("cat", false);
var peg$e39 = peg$literalExpectation("$", false);
var peg$e40 = peg$literalExpectation("setcps", false);
var peg$e41 = peg$literalExpectation("setbpm", false);
var peg$e42 = peg$literalExpectation("hush", false);
var peg$e17 = peg$literalExpectation(":", false);
var peg$e18 = peg$literalExpectation("[", false);
var peg$e19 = peg$literalExpectation("]", false);
var peg$e20 = peg$literalExpectation("<", false);
var peg$e21 = peg$literalExpectation(">", false);
var peg$e22 = peg$literalExpectation("@", false);
var peg$e23 = peg$literalExpectation("!", false);
var peg$e24 = peg$literalExpectation("(", false);
var peg$e25 = peg$literalExpectation(")", false);
var peg$e26 = peg$literalExpectation("/", false);
var peg$e27 = peg$literalExpectation("*", false);
var peg$e28 = peg$literalExpectation("%", false);
var peg$e29 = peg$literalExpectation("struct", false);
var peg$e30 = peg$literalExpectation("target", false);
var peg$e31 = peg$literalExpectation("euclid", false);
var peg$e32 = peg$literalExpectation("slow", false);
var peg$e33 = peg$literalExpectation("rotL", false);
var peg$e34 = peg$literalExpectation("rotR", false);
var peg$e35 = peg$literalExpectation("fast", false);
var peg$e36 = peg$literalExpectation("scale", false);
var peg$e37 = peg$literalExpectation("//", false);
var peg$e38 = peg$classExpectation(["\n"], true, false);
var peg$e39 = peg$literalExpectation("cat", false);
var peg$e40 = peg$literalExpectation("$", false);
var peg$e41 = peg$literalExpectation("setcps", false);
var peg$e42 = peg$literalExpectation("setbpm", false);
var peg$e43 = peg$literalExpectation("hush", false);
var peg$f0 = function() { return parseFloat(text()); };
var peg$f1 = function(chars) { return chars.join("") };
@@ -294,7 +292,6 @@ function peg$parse(input, options) {
var peg$f29 = function(v) { return new CommandStub("setcps", { value: v})};
var peg$f30 = function(v) { return new CommandStub("setcps", { value: (v/120/2)})};
var peg$f31 = function() { return new CommandStub("hush")};
var peg$currPos = 0;
var peg$savedPos = 0;
var peg$posDetailsCache = [{ line: 1, column: 1 }];
@@ -810,6 +807,15 @@ function peg$parse(input, options) {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e16); }
}
if (s0 === peg$FAILED) {
if (input.charCodeAt(peg$currPos) === 58) {
s0 = peg$c10;
peg$currPos++;
} else {
s0 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e17); }
}
}
}
}
}
@@ -852,11 +858,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
s1 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 91) {
s2 = peg$c10;
s2 = peg$c11;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e17); }
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsews();
@@ -864,11 +870,11 @@ function peg$parse(input, options) {
if (s4 !== peg$FAILED) {
s5 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 93) {
s6 = peg$c11;
s6 = peg$c12;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e18); }
if (peg$silentFails === 0) { peg$fail(peg$e19); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parsews();
@@ -896,11 +902,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
s1 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 60) {
s2 = peg$c12;
s2 = peg$c13;
peg$currPos++;
} else {
s2 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e19); }
if (peg$silentFails === 0) { peg$fail(peg$e20); }
}
if (s2 !== peg$FAILED) {
s3 = peg$parsews();
@@ -908,11 +914,11 @@ function peg$parse(input, options) {
if (s4 !== peg$FAILED) {
s5 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 62) {
s6 = peg$c13;
s6 = peg$c14;
peg$currPos++;
} else {
s6 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e20); }
if (peg$silentFails === 0) { peg$fail(peg$e21); }
}
if (s6 !== peg$FAILED) {
s7 = peg$parsews();
@@ -976,11 +982,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 64) {
s1 = peg$c14;
s1 = peg$c15;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e21); }
if (peg$silentFails === 0) { peg$fail(peg$e22); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
@@ -1004,11 +1010,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 33) {
s1 = peg$c15;
s1 = peg$c16;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e22); }
if (peg$silentFails === 0) { peg$fail(peg$e23); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
@@ -1032,11 +1038,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 40) {
s1 = peg$c16;
s1 = peg$c17;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e23); }
if (peg$silentFails === 0) { peg$fail(peg$e24); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1060,11 +1066,11 @@ function peg$parse(input, options) {
}
s12 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 41) {
s13 = peg$c17;
s13 = peg$c18;
peg$currPos++;
} else {
s13 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e24); }
if (peg$silentFails === 0) { peg$fail(peg$e25); }
}
if (s13 !== peg$FAILED) {
peg$savedPos = s0;
@@ -1098,11 +1104,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 47) {
s1 = peg$c18;
s1 = peg$c19;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e25); }
if (peg$silentFails === 0) { peg$fail(peg$e26); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
@@ -1126,11 +1132,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 42) {
s1 = peg$c19;
s1 = peg$c20;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e26); }
if (peg$silentFails === 0) { peg$fail(peg$e27); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
@@ -1154,11 +1160,11 @@ function peg$parse(input, options) {
s0 = peg$currPos;
if (input.charCodeAt(peg$currPos) === 37) {
s1 = peg$c20;
s1 = peg$c21;
peg$currPos++;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e27); }
if (peg$silentFails === 0) { peg$fail(peg$e28); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsenumber();
@@ -1332,12 +1338,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c21) {
s1 = peg$c21;
if (input.substr(peg$currPos, 6) === peg$c22) {
s1 = peg$c22;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e28); }
if (peg$silentFails === 0) { peg$fail(peg$e29); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1361,12 +1367,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c22) {
s1 = peg$c22;
if (input.substr(peg$currPos, 6) === peg$c23) {
s1 = peg$c23;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e29); }
if (peg$silentFails === 0) { peg$fail(peg$e30); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1402,12 +1408,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3, s4, s5, s6, s7;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c23) {
s1 = peg$c23;
if (input.substr(peg$currPos, 6) === peg$c24) {
s1 = peg$c24;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e30); }
if (peg$silentFails === 0) { peg$fail(peg$e31); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1443,12 +1449,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c24) {
s1 = peg$c24;
if (input.substr(peg$currPos, 4) === peg$c25) {
s1 = peg$c25;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e31); }
if (peg$silentFails === 0) { peg$fail(peg$e32); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1472,12 +1478,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c25) {
s1 = peg$c25;
if (input.substr(peg$currPos, 4) === peg$c26) {
s1 = peg$c26;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e32); }
if (peg$silentFails === 0) { peg$fail(peg$e33); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1501,12 +1507,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c26) {
s1 = peg$c26;
if (input.substr(peg$currPos, 4) === peg$c27) {
s1 = peg$c27;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e33); }
if (peg$silentFails === 0) { peg$fail(peg$e34); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1530,12 +1536,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c27) {
s1 = peg$c27;
if (input.substr(peg$currPos, 4) === peg$c28) {
s1 = peg$c28;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e34); }
if (peg$silentFails === 0) { peg$fail(peg$e35); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1559,12 +1565,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3, s4, s5;
s0 = peg$currPos;
if (input.substr(peg$currPos, 5) === peg$c28) {
s1 = peg$c28;
if (input.substr(peg$currPos, 5) === peg$c29) {
s1 = peg$c29;
peg$currPos += 5;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e35); }
if (peg$silentFails === 0) { peg$fail(peg$e36); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1609,12 +1615,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 2) === peg$c29) {
s1 = peg$c29;
if (input.substr(peg$currPos, 2) === peg$c30) {
s1 = peg$c30;
peg$currPos += 2;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e36); }
if (peg$silentFails === 0) { peg$fail(peg$e37); }
}
if (s1 !== peg$FAILED) {
s2 = [];
@@ -1623,7 +1629,7 @@ function peg$parse(input, options) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e37); }
if (peg$silentFails === 0) { peg$fail(peg$e38); }
}
while (s3 !== peg$FAILED) {
s2.push(s3);
@@ -1632,7 +1638,7 @@ function peg$parse(input, options) {
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e37); }
if (peg$silentFails === 0) { peg$fail(peg$e38); }
}
}
s1 = [s1, s2];
@@ -1649,21 +1655,21 @@ function peg$parse(input, options) {
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
s0 = peg$currPos;
if (input.substr(peg$currPos, 3) === peg$c30) {
s1 = peg$c30;
if (input.substr(peg$currPos, 3) === peg$c31) {
s1 = peg$c31;
peg$currPos += 3;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e38); }
if (peg$silentFails === 0) { peg$fail(peg$e39); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 91) {
s3 = peg$c10;
s3 = peg$c11;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e17); }
if (peg$silentFails === 0) { peg$fail(peg$e18); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsews();
@@ -1705,11 +1711,11 @@ function peg$parse(input, options) {
}
s7 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 93) {
s8 = peg$c11;
s8 = peg$c12;
peg$currPos++;
} else {
s8 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e18); }
if (peg$silentFails === 0) { peg$fail(peg$e19); }
}
if (s8 !== peg$FAILED) {
peg$savedPos = s0;
@@ -1770,11 +1776,11 @@ function peg$parse(input, options) {
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
if (input.charCodeAt(peg$currPos) === 36) {
s3 = peg$c31;
s3 = peg$c32;
peg$currPos++;
} else {
s3 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e39); }
if (peg$silentFails === 0) { peg$fail(peg$e40); }
}
if (s3 !== peg$FAILED) {
s4 = peg$parsews();
@@ -1852,12 +1858,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c32) {
s1 = peg$c32;
if (input.substr(peg$currPos, 6) === peg$c33) {
s1 = peg$c33;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e40); }
if (peg$silentFails === 0) { peg$fail(peg$e41); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1881,12 +1887,12 @@ function peg$parse(input, options) {
var s0, s1, s2, s3;
s0 = peg$currPos;
if (input.substr(peg$currPos, 6) === peg$c33) {
s1 = peg$c33;
if (input.substr(peg$currPos, 6) === peg$c34) {
s1 = peg$c34;
peg$currPos += 6;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e41); }
if (peg$silentFails === 0) { peg$fail(peg$e42); }
}
if (s1 !== peg$FAILED) {
s2 = peg$parsews();
@@ -1910,12 +1916,12 @@ function peg$parse(input, options) {
var s0, s1;
s0 = peg$currPos;
if (input.substr(peg$currPos, 4) === peg$c34) {
s1 = peg$c34;
if (input.substr(peg$currPos, 4) === peg$c35) {
s1 = peg$c35;
peg$currPos += 4;
} else {
s1 = peg$FAILED;
if (peg$silentFails === 0) { peg$fail(peg$e42); }
if (peg$silentFails === 0) { peg$fail(peg$e43); }
}
if (s1 !== peg$FAILED) {
peg$savedPos = s0;
@@ -1938,35 +1944,34 @@ function peg$parse(input, options) {
}
var PatternStub = function(source, alignment)
{
this.type_ = "pattern";
this.arguments_ = { alignment : alignment};
this.source_ = source;
}
var PatternStub = function(source, alignment)
{
this.type_ = "pattern";
this.arguments_ = { alignment : alignment};
this.source_ = source;
}
var OperatorStub = function(name, args, source)
{
this.type_ = name;
this.arguments_ = args;
this.source_ = source;
}
var OperatorStub = function(name, args, source)
{
this.type_ = name;
this.arguments_ = args;
this.source_ = source;
}
var ElementStub = function(source, options)
{
this.type_ = "element";
this.source_ = source;
this.options_ = options;
this.location_ = location();
}
var CommandStub = function(name, options)
{
this.type_ = "command";
this.name_ = name;
this.options_ = options;
}
var ElementStub = function(source, options)
{
this.type_ = "element";
this.source_ = source;
this.options_ = options;
this.location_ = location();
}
var CommandStub = function(name, options)
{
this.type_ = "command";
this.name_ = name;
this.options_ = options;
}
peg$result = peg$startRuleFunction();
@@ -1990,5 +1995,6 @@ function peg$parse(input, options) {
export {
peg$SyntaxError as SyntaxError,
peg$parse as parse
};
+1 -1
View File
@@ -87,7 +87,7 @@ quote = '"' / "'"
// ------------------ steps and cycles ---------------------------
// single step definition (e.g bd)
step_char = [0-9a-zA-Z~] / "-" / "#" / "." / "^" / "_"
step_char = [0-9a-zA-Z~] / "-" / "#" / "." / "^" / "_" / ":"
step = ws chars:step_char+ ws { return chars.join("") }
// define a sub cycle e.g. [1 2, 3 [4]]
+1031
View File
File diff suppressed because it is too large Load Diff
+9 -5
View File
@@ -1,11 +1,12 @@
{
"name": "@strudel.cycles/mini",
"version": "0.1.0",
"version": "0.1.3",
"description": "Mini notation for strudel",
"main": "index.mjs",
"type": "module",
"scripts": {
"test": "mocha --colors"
"test": "mocha --colors",
"build:parser": "peggy -o krill-parser.js --format es ./krill.pegjs"
},
"repository": {
"type": "git",
@@ -25,8 +26,11 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/eval": "^0.1.0",
"@strudel.cycles/tone": "^0.1.0"
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3"
},
"devDependencies": {
"peggy": "^2.0.1"
}
}
+14 -4
View File
@@ -12,17 +12,27 @@ comm.open();
const latency = 0.1;
let startedAt = -1;
/**
*
* Sends each hap as an OSC message, which can be picked up by SuperCollider or any other OSC-enabled software.
*
* @name osc
* @memberof Pattern
* @returns Pattern
*/
Pattern.prototype.osc = function () {
return this._withHap((hap) => {
const onTrigger = (time, hap, currentTime, cps, cycle, delta) => {
const onTrigger = (time, hap, currentTime, cps) => {
const cycle = hap.wholeOrPart().begin.valueOf();
const delta = hap.duration.valueOf();
// time should be audio time of onset
// currentTime should be current time of audio context (slightly before time)
if (startedAt < 0) {
startedAt = Date.now() - (currentTime * 1000);
startedAt = Date.now() - currentTime * 1000;
}
const controls = Object.assign({}, { cps: cps, cycle: cycle, delta: delta }, hap.value);
const controls = Object.assign({}, { cps, cycle, delta }, hap.value);
const keyvals = Object.entries(controls).flat();
const ts = Math.floor(startedAt + ((time + latency) * 1000));
const ts = Math.floor(startedAt + (time + latency) * 1000);
const message = new OSC.Message('/dirt/play', ...keyvals);
const bundle = new OSC.Bundle([message], ts);
bundle.timestamp(ts); // workaround for https://github.com/adzialocha/osc-js/issues/60
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/osc",
"version": "0.1.0",
"version": "0.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/osc",
"version": "0.0.1",
"license": "GPL-3.0-or-later",
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
"osc-js": "^2.3.2"
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/osc",
"version": "0.1.0",
"version": "0.1.1",
"description": "OSC messaging for strudel",
"main": "osc.mjs",
"scripts": {
+2 -2
View File
File diff suppressed because one or more lines are too long
+45 -14
View File
@@ -26,7 +26,7 @@ const ivory = '#abb2bf',
// background = '#292d3e',
background = 'transparent',
tooltipBackground = '#353a42',
selection = 'rgba(128, 203, 196, 0.2)',
selection = 'rgba(128, 203, 196, 0.5)',
cursor = '#ffcc00';
/// The editor theme styles for Material Palenight.
@@ -50,7 +50,8 @@ const materialPalenightTheme = EditorView.theme(
},
// done
'&.cm-focused .cm-cursor': {
borderLeftColor: cursor,
backgroundColor: cursor,
width: '3px',
},
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
@@ -80,7 +81,7 @@ const materialPalenightTheme = EditorView.theme(
// done
'.cm-gutters': {
background: '#2C323699',
background: 'transparent',
color: '#676e95',
border: 'none',
},
@@ -144,6 +145,37 @@ const materialPalenightHighlightStyle = HighlightStyle.define([
// : Extension
const materialPalenight = [materialPalenightTheme, materialPalenightHighlightStyle];
const setFlash = StateEffect.define();
const flashField = StateField.define({
create() {
return Decoration.none;
},
update(flash2, tr) {
try {
for (let e of tr.effects) {
if (e.is(setFlash)) {
if (e.value) {
const mark = Decoration.mark({ attributes: { style: `background-color: #FFCA2880` } });
flash2 = Decoration.set([mark.range(0, tr.newDoc.length)]);
} else {
flash2 = Decoration.set([]);
}
}
}
return flash2;
} catch (err) {
console.warn("flash error", err);
return flash2;
}
},
provide: (f) => EditorView.decorations.from(f)
});
const flash = (view) => {
view.dispatch({ effects: setFlash.of(true) });
setTimeout(() => {
view.dispatch({ effects: setFlash.of(false) });
}, 200);
};
const setHighlights = StateEffect.define();
const highlightField = StateField.define({
create() {
@@ -186,7 +218,8 @@ function CodeMirror({ value, onChange, onViewChanged, onCursor, options, editorD
extensions: [
javascript(),
materialPalenight,
highlightField
highlightField,
flashField
]
}));
}
@@ -339,14 +372,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw: onDrawP
/* console.warn('no instrument chosen', event);
throw new Error(`no instrument chosen for ${JSON.stringify(event)}`); */
} else {
onTrigger(
time,
event,
currentTime,
1 /* cps */,
event.wholeOrPart().begin.valueOf(),
event.duration.valueOf(),
);
onTrigger(time, event, currentTime, 1 /* cps */);
}
} catch (err) {
console.warn(err);
@@ -464,7 +490,10 @@ function useHighlighting({ view, pattern, active }) {
function updateHighlights() {
try {
const audioTime = Tone.getTransport().seconds;
const span = [lastEnd || audioTime, audioTime + 1 / 60];
// force min framerate of 10 fps => fixes crash on tab refocus, where lastEnd could be far away
// see https://github.com/tidalcycles/strudel/issues/108
const begin = Math.max(lastEnd || audioTime, audioTime - 1 / 10);
const span = [begin, audioTime + 1 / 60];
lastEnd = audioTime + 1 / 60;
highlights = highlights.filter((hap) => hap.whole.end > audioTime); // keep only highlights that are still active
const haps = pattern.queryArc(...span).filter((hap) => hap.hasOnset());
@@ -490,6 +519,8 @@ function useHighlighting({ view, pattern, active }) {
var tailwind = '';
var style = '';
const container = "_container_10e1g_1";
const header = "_header_10e1g_5";
const buttons = "_buttons_10e1g_9";
@@ -617,4 +648,4 @@ function useWebMidi(props) {
return { loading, outputs, outputByName };
}
export { CodeMirror, MiniRepl, cx, useCycle, useHighlighting, usePostMessage, useRepl, useWebMidi };
export { CodeMirror, MiniRepl, cx, flash, useCycle, useHighlighting, usePostMessage, useRepl, useWebMidi };
+1 -1
View File
@@ -1 +1 @@
*,:before,:after{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sc-h-5{height:1.25rem}.sc-w-5{width:1.25rem}@keyframes sc-pulse{50%{opacity:.5}}.sc-animate-pulse{animation:sc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}._container_10e1g_1{overflow:hidden;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(68 76 87 / var(--tw-bg-opacity))}._header_10e1g_5{display:flex;justify-content:space-between;border-top-width:1px;--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}._buttons_10e1g_9{display:flex}._button_10e1g_9{display:flex;width:4rem;cursor:pointer;align-items:center;justify-content:center;border-right-width:1px;--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity));padding:.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}._button_10e1g_9:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}._buttonDisabled_10e1g_17{display:flex;width:4rem;cursor:pointer;cursor:not-allowed;align-items:center;justify-content:center;--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity));padding:.25rem;--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}._error_10e1g_21{padding:.25rem;text-align:right;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity))}._body_10e1g_25{position:relative;overflow:auto}
*,:before,:after{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sc-h-5{height:1.25rem}.sc-w-5{width:1.25rem}@keyframes sc-pulse{50%{opacity:.5}}.sc-animate-pulse{animation:sc-pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cm-editor{background-color:transparent!important}._container_10e1g_1{overflow:hidden;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(68 76 87 / var(--tw-bg-opacity))}._header_10e1g_5{display:flex;justify-content:space-between;border-top-width:1px;--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}._buttons_10e1g_9{display:flex}._button_10e1g_9{display:flex;width:4rem;cursor:pointer;align-items:center;justify-content:center;border-right-width:1px;--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity));padding:.25rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}._button_10e1g_9:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}._buttonDisabled_10e1g_17{display:flex;width:4rem;cursor:pointer;cursor:not-allowed;align-items:center;justify-content:center;--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity));padding:.25rem;--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}._error_10e1g_21{padding:.25rem;text-align:right;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity))}._body_10e1g_25{position:relative;overflow:auto}
+3984
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/react",
"version": "0.1.0",
"version": "0.1.4",
"description": "React components for strudel",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
@@ -38,9 +38,9 @@
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@codemirror/lang-javascript": "^0.19.0",
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/eval": "^0.1.0",
"@strudel.cycles/tone": "^0.1.0",
"@strudel.cycles/core": "^0.1.2",
"@strudel.cycles/eval": "^0.1.3",
"@strudel.cycles/tone": "^0.1.3",
"react-codemirror6": "^1.1.0",
"react-hook-inview": "^4.5.0"
},
+16 -1
View File
@@ -1,11 +1,26 @@
import React from 'react';
import { MiniRepl } from './components/MiniRepl';
import 'tailwindcss/tailwind.css';
import { Tone, getDefaultSynth } from '@strudel.cycles/tone';
import { evalScope } from '@strudel.cycles/eval';
const defaultSynth = getDefaultSynth();
evalScope(
Tone,
import('@strudel.cycles/core'),
import('@strudel.cycles/tone'),
import('@strudel.cycles/tonal'),
import('@strudel.cycles/mini'),
import('@strudel.cycles/midi'),
import('@strudel.cycles/xen'),
import('@strudel.cycles/webaudio'),
);
function App() {
return (
<div>
<MiniRepl tune={`"c3"`} />
<MiniRepl tune={`"c3"`} defaultSynth={defaultSynth} />
</div>
);
}
@@ -7,6 +7,39 @@ import { javascript } from '@codemirror/lang-javascript';
// import { materialPalenight } from 'codemirror6-themes';
import { materialPalenight } from '../themes/material-palenight';
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) => {
view.dispatch({ effects: setFlash.of(true) });
setTimeout(() => {
view.dispatch({ effects: setFlash.of(false) });
}, 200);
};
export const setHighlights = StateEffect.define();
const highlightField = StateField.define({
create() {
@@ -61,6 +94,7 @@ export default function CodeMirror({ value, onChange, onViewChanged, onCursor, o
javascript(),
materialPalenight,
highlightField,
flashField,
// theme, language, ...
]}
/>
@@ -5,6 +5,7 @@ import cx from '../cx';
import useHighlighting from '../hooks/useHighlighting.mjs';
import CodeMirror6 from './CodeMirror6';
import 'tailwindcss/tailwind.css';
import './style.css';
import styles from './MiniRepl.module.css';
import { Icon } from './Icon';
+3
View File
@@ -0,0 +1,3 @@
.cm-editor {
background-color: transparent !important;
}
+4 -1
View File
@@ -14,7 +14,10 @@ function useHighlighting({ view, pattern, active }) {
function updateHighlights() {
try {
const audioTime = Tone.getTransport().seconds;
const span = [lastEnd || audioTime, audioTime + 1 / 60];
// force min framerate of 10 fps => fixes crash on tab refocus, where lastEnd could be far away
// see https://github.com/tidalcycles/strudel/issues/108
const begin = Math.max(lastEnd || audioTime, audioTime - 1 / 10);
const span = [begin, audioTime + 1 / 60];
lastEnd = audioTime + 1 / 60;
highlights = highlights.filter((hap) => hap.whole.end > audioTime); // keep only highlights that are still active
const haps = pattern.queryArc(...span).filter((hap) => hap.hasOnset());
+1 -8
View File
@@ -57,14 +57,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw: onDrawP
/* console.warn('no instrument chosen', event);
throw new Error(`no instrument chosen for ${JSON.stringify(event)}`); */
} else {
onTrigger(
time,
event,
currentTime,
1 /* cps */,
event.wholeOrPart().begin.valueOf(),
event.duration.valueOf(),
);
onTrigger(time, event, currentTime, 1 /* cps */);
}
} catch (err) {
console.warn(err);
+1 -1
View File
@@ -1,6 +1,6 @@
// import 'tailwindcss/tailwind.css';
export { default as CodeMirror } from './components/CodeMirror6';
export { default as CodeMirror, flash } from './components/CodeMirror6';
export * from './components/MiniRepl';
export { default as useCycle } from './hooks/useCycle';
export { default as useHighlighting } from './hooks/useHighlighting';
@@ -16,7 +16,7 @@ const ivory = '#abb2bf',
// background = '#292d3e',
background = 'transparent',
tooltipBackground = '#353a42',
selection = 'rgba(128, 203, 196, 0.2)',
selection = 'rgba(128, 203, 196, 0.5)',
cursor = '#ffcc00';
/// The editor theme styles for Material Palenight.
@@ -40,7 +40,8 @@ export const materialPalenightTheme = EditorView.theme(
},
// done
'&.cm-focused .cm-cursor': {
borderLeftColor: cursor,
backgroundColor: cursor,
width: '3px',
},
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
@@ -70,7 +71,7 @@ export const materialPalenightTheme = EditorView.theme(
// done
'.cm-gutters': {
background: '#2C323699',
background: 'transparent',
color: '#676e95',
border: 'none',
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/serial",
"version": "0.1.0",
"version": "0.1.3",
"description": "Webserial API for strudel",
"main": "serial.mjs",
"repository": {
+23 -5
View File
@@ -9,7 +9,7 @@ import { Pattern, isPattern } from '@strudel.cycles/core';
var serialWriter;
var choosing = false;
export async function getWriter(br=115200) {
export async function getWriter(br=38400) {
if (choosing) {
return;
}
@@ -34,8 +34,7 @@ export async function getWriter(br=115200) {
const latency = 0.1;
// Pattern.prototype.midi = function (output: string | number, channel = 1) {
Pattern.prototype.serial = async function (...args) {
Pattern.prototype.serial = function (...args) {
return this._withHap((hap) => {
if (!serialWriter) {
getWriter(...args);
@@ -43,8 +42,27 @@ Pattern.prototype.serial = async function (...args) {
const onTrigger = (time, hap, currentTime) => {
var message = "";
if (typeof hap.value === 'object') {
for (const [key, val] of Object.entries(hap.value).flat()) {
message += `${key}:${val};`
if ('action' in hap.value) {
message += hap.value['action'] + '(';
var first = true;
for (const [key, val] of Object.entries(hap.value)) {
if (key === 'action') {
continue;
}
if (first) {
first = false;
}
else {
message +=',';
}
message += `${key}:${val}`
}
message += ')';
}
else {
for (const [key, val] of Object.entries(hap.value)) {
message += `${key}:${val};`
}
}
}
else {
+13
View File
@@ -0,0 +1,13 @@
// this script converts a soundfont into a json file, it has not been not used yet
import fetch from 'node-fetch';
const name = '0000_JCLive';
const js = await fetch(`https://felixroos.github.io/webaudiofontdata/sound/${name}_sf2_file.js`).then((res) =>
res.text(),
);
// console.log(js);
let [_, data] = js.split('_sf2_file=');
data = eval(data);
console.log(JSON.stringify(data));
+114
View File
@@ -0,0 +1,114 @@
let loadCache = {};
async function loadFont(name) {
if (loadCache[name]) {
return loadCache[name];
}
const load = async () => {
// TODO: make soundfont source configurable
const url = `https://felixroos.github.io/webaudiofontdata/sound/${name}.js`;
console.log('load font', name, url);
const preset = await fetch(url).then((res) => res.text());
let [_, data] = preset.split('={');
return eval('{' + data);
};
loadCache[name] = load();
return loadCache[name];
}
export async function getFontBufferSource(name, pitch, ac) {
if (typeof pitch === 'string') {
pitch = toMidi(pitch);
}
const { buffer, zone } = await getFontPitch(name, pitch, ac);
const src = ac.createBufferSource();
src.buffer = buffer;
const baseDetune = zone.originalPitch - 100.0 * zone.coarseTune - zone.fineTune;
const playbackRate = 1.0 * Math.pow(2, (100.0 * pitch - baseDetune) / 1200.0);
// src detune?
src.playbackRate.value = playbackRate;
const loop = zone.loopStart > 1 && zone.loopStart < zone.loopEnd;
if (!loop) {
/* const waveDuration = duration + this.afterTime;
if (waveDuration > zone.buffer.duration / playbackRate) {
waveDuration = zone.buffer.duration / playbackRate;
// TODO: do sth with waveduration
} */
} else {
src.loop = true;
src.loopStart = zone.loopStart / zone.sampleRate;
src.loopEnd = zone.loopEnd / zone.sampleRate;
//+ (zone.delay ? zone.delay : 0);
}
return src;
}
let bufferCache = {};
export async function getFontPitch(name, pitch, ac) {
const key = `${name}:::${pitch}`;
if (bufferCache[key]) {
return bufferCache[key];
}
// console.log('load buffer', key);
const load = async () => {
const preset = await loadFont(name);
if (!preset) {
throw new Error(`Could not load soundfont ${name}`);
}
const zone = findZone(preset, pitch);
if (!zone) {
throw new Error('no soundfont zone found for preset ', name, 'pitch', pitch);
}
const buffer = await getBuffer(zone, ac);
if (!buffer) {
throw new Error(`no soundfont buffer found for preset ${name}, pitch: ${pitch}`);
}
return { buffer, zone };
};
bufferCache[key] = load(); // dont await here to cache promise immediately!
return bufferCache[key];
}
function findZone(preset, pitch) {
return preset.find((zone) => {
return zone.keyRangeLow <= pitch && zone.keyRangeHigh + 1 >= pitch;
});
}
// promisified version of https://github.com/felixroos/webaudiofont/blob/c6f97249b60dcfafc20fca5bb381294a6b2f8f51/npm/dist/WebAudioFontPlayer.js#L740
async function getBuffer(zone, audioContext) {
if (zone.sample) {
console.warn('zone.sample untested!');
const decoded = atob(zone.sample);
zone.buffer = audioContext.createBuffer(1, decoded.length / 2, zone.sampleRate);
const float32Array = zone.buffer.getChannelData(0);
let b1, b2, n;
for (var i = 0; i < decoded.length / 2; i++) {
b1 = decoded.charCodeAt(i * 2);
b2 = decoded.charCodeAt(i * 2 + 1);
if (b1 < 0) {
b1 = 256 + b1;
}
if (b2 < 0) {
b2 = 256 + b2;
}
n = b2 * 256 + b1;
if (n >= 65536 / 2) {
n = n - 65536;
}
float32Array[i] = n / 65536.0;
}
} else {
if (zone.file) {
const datalen = zone.file.length;
const arraybuffer = new ArrayBuffer(datalen);
const view = new Uint8Array(arraybuffer);
const decoded = atob(zone.file);
let b;
for (let i = 0; i < decoded.length; i++) {
b = decoded.charCodeAt(i);
view[i] = b;
}
return new Promise((resolve) => audioContext.decodeAudioData(arraybuffer, resolve));
}
}
}
+6
View File
@@ -0,0 +1,6 @@
import { getFontBufferSource } from './fontloader.mjs';
import * as soundfontList from './list.mjs';
globalThis.getFontBufferSource = getFontBufferSource;
globalThis.soundfontList = soundfontList;
globalThis.soundfontList = soundfontList;
File diff suppressed because it is too large Load Diff
+301
View File
@@ -0,0 +1,301 @@
{
"name": "@strudel.cycles/soundfonts",
"version": "0.1.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/soundfonts",
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
"webaudiofont": "^3.0.1"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"node_modules/brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"dependencies": {
"balanced-match": "^1.0.0"
}
},
"node_modules/fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"node_modules/glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
"integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/jsonc-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA=="
},
"node_modules/lunr": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz",
"integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow=="
},
"node_modules/marked": {
"version": "4.0.17",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz",
"integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA==",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/minimatch": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
"integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
"dependencies": {
"brace-expansion": "^2.0.1"
},
"engines": {
"node": ">=10"
}
},
"node_modules/once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dependencies": {
"wrappy": "1"
}
},
"node_modules/shiki": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz",
"integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==",
"dependencies": {
"jsonc-parser": "^3.0.0",
"vscode-oniguruma": "^1.6.1",
"vscode-textmate": "5.2.0"
}
},
"node_modules/typedoc": {
"version": "0.22.17",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.17.tgz",
"integrity": "sha512-h6+uXHVVCPDaANzjwzdsj9aePBjZiBTpiMpBBeyh1zcN2odVsDCNajz8zyKnixF93HJeGpl34j/70yoEE5BfNg==",
"dependencies": {
"glob": "^8.0.3",
"lunr": "^2.3.9",
"marked": "^4.0.16",
"minimatch": "^5.1.0",
"shiki": "^0.10.1"
},
"bin": {
"typedoc": "bin/typedoc"
},
"engines": {
"node": ">= 12.10.0"
},
"peerDependencies": {
"typescript": "4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x || 4.6.x || 4.7.x"
}
},
"node_modules/typescript": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/vscode-oniguruma": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz",
"integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA=="
},
"node_modules/vscode-textmate": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz",
"integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ=="
},
"node_modules/webaudiofont": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webaudiofont/-/webaudiofont-3.0.1.tgz",
"integrity": "sha512-PwqbR4OdvzbW8/TLTitSU/rw4mxMKyAGTKV42mePCgMoUGLJoQj8HDLWVqtNOpUZ0ghPNhNE6cRFEv6HFFEBQA==",
"dependencies": {
"typedoc": "^0.22.14"
}
},
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
},
"dependencies": {
"balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
},
"brace-expansion": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",
"integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",
"requires": {
"balanced-match": "^1.0.0"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
},
"glob": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz",
"integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^5.0.1",
"once": "^1.3.0"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"jsonc-parser": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz",
"integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA=="
},
"lunr": {
"version": "2.3.9",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz",
"integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow=="
},
"marked": {
"version": "4.0.17",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.17.tgz",
"integrity": "sha512-Wfk0ATOK5iPxM4ptrORkFemqroz0ZDxp5MWfYA7H/F+wO17NRWV5Ypxi6p3g2Xmw2bKeiYOl6oVnLHKxBA0VhA=="
},
"minimatch": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz",
"integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==",
"requires": {
"brace-expansion": "^2.0.1"
}
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"requires": {
"wrappy": "1"
}
},
"shiki": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/shiki/-/shiki-0.10.1.tgz",
"integrity": "sha512-VsY7QJVzU51j5o1+DguUd+6vmCmZ5v/6gYu4vyYAhzjuNQU6P/vmSy4uQaOhvje031qQMiW0d2BwgMH52vqMng==",
"requires": {
"jsonc-parser": "^3.0.0",
"vscode-oniguruma": "^1.6.1",
"vscode-textmate": "5.2.0"
}
},
"typedoc": {
"version": "0.22.17",
"resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.22.17.tgz",
"integrity": "sha512-h6+uXHVVCPDaANzjwzdsj9aePBjZiBTpiMpBBeyh1zcN2odVsDCNajz8zyKnixF93HJeGpl34j/70yoEE5BfNg==",
"requires": {
"glob": "^8.0.3",
"lunr": "^2.3.9",
"marked": "^4.0.16",
"minimatch": "^5.1.0",
"shiki": "^0.10.1"
}
},
"typescript": {
"version": "4.7.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz",
"integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==",
"peer": true
},
"vscode-oniguruma": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.6.2.tgz",
"integrity": "sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA=="
},
"vscode-textmate": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-5.2.0.tgz",
"integrity": "sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ=="
},
"webaudiofont": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/webaudiofont/-/webaudiofont-3.0.1.tgz",
"integrity": "sha512-PwqbR4OdvzbW8/TLTitSU/rw4mxMKyAGTKV42mePCgMoUGLJoQj8HDLWVqtNOpUZ0ghPNhNE6cRFEv6HFFEBQA==",
"requires": {
"typedoc": "^0.22.14"
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
}
}
}
+31
View File
@@ -0,0 +1,31 @@
{
"name": "@strudel.cycles/soundfonts",
"version": "0.1.1",
"description": "Soundsfont support for strudel",
"main": "index.mjs",
"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>",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "*",
"@strudel.cycles/webaudio": "^0.1.4"
},
"devDependencies": {
"node-fetch": "^3.2.6"
}
}
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/tonal",
"version": "0.1.0",
"version": "0.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/tonal",
"version": "0.0.3",
"license": "GPL-3.0-or-later",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@tonaljs/tonal": "^4.6.5",
"webmidi": "^3.0.15"
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/tonal",
"version": "0.1.0",
"version": "0.1.3",
"description": "Tonal functions for strudel",
"main": "index.mjs",
"type": "module",
@@ -25,7 +25,7 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/core": "^0.1.2",
"@tonaljs/tonal": "^4.6.5",
"webmidi": "^3.0.15"
}
+65
View File
@@ -42,6 +42,38 @@ function scaleOffset(scale, offset, note) {
}
// Pattern.prototype._transpose = function (intervalOrSemitones: string | number) {
/**
* Change the pitch of each value by the given amount. Expects numbers or note strings as values.
* The amount can be given as a number of semitones or as a string in interval short notation.
* If you don't care about enharmonic correctness, just use numbers. Otherwise, pass the interval of
* the form: ST where S is the degree number and T the type of interval with
*
* - M = major
* - m = minor
* - P = perfect
* - A = augmented
* - d = diminished
*
* Examples intervals:
*
* - 1P = unison
* - 3M = major third
* - 3m = minor third
* - 4P = perfect fourth
* - 4A = augmented fourth
* - 5P = perfect fifth
* - 5d = diminished fifth
*
* @param {string | number} amount Either number of semitones or interval string.
* @returns Pattern
* @memberof Pattern
* @name transpose
* @example
* "c2 c3".fast(2).transpose("<0 -2 5 3>".slow(2)).transpose(0)
* @example
* "c2 c3".fast(2).transpose("<1P -2M 4P 3m>".slow(2)).transpose(0)
*/
Pattern.prototype._transpose = function (intervalOrSemitones) {
return this._withHap((hap) => {
const interval = !isNaN(Number(intervalOrSemitones))
@@ -63,6 +95,20 @@ Pattern.prototype._transpose = function (intervalOrSemitones) {
// e.g. `stack(c3).superimpose(transpose(slowcat(7, 5)))` or
// or even `stack(c3).superimpose(transpose.slowcat(7, 5))` or
/**
* Transposes notes inside the scale by the number of steps.
* Expected to be called on a Pattern which already has a {@link Pattern#scale}
*
* @memberof Pattern
* @name scaleTranspose
* @param {offset} offset number of steps inside the scale
* @returns Pattern
* @example
* "-8 [2,4,6]"
* .scale('C4 bebop major')
* .scaleTranspose("<0 -1 -2 -3 -4 -5 -6 -4>")
*/
Pattern.prototype._scaleTranspose = function (offset /* : number | string */) {
return this._withHap((hap) => {
if (!hap.context.scale) {
@@ -74,6 +120,25 @@ Pattern.prototype._scaleTranspose = function (offset /* : number | string */) {
return hap.withValue(() => scaleOffset(hap.context.scale, Number(offset), hap.value));
});
};
/**
* Turns numbers into notes in the scale (zero indexed). Also sets scale for other scale operations, like {@link Pattern#scaleTranspose}.
*
* The scale name has the form "TO? N" wher
*
* - T = Tonic
* - O = Octave (optional, defaults to 3)
* - N = Name of scale, available names can be found [here](https://github.com/tonaljs/tonal/blob/main/packages/scale-type/data.ts).
*
* @memberof Pattern
* @name scale
* @param {string} scale Name of scale
* @returns Pattern
* @example
* "0 2 4 6 4 2"
* .scale(seq('C2 major', 'C2 minor').slow(2))
*/
Pattern.prototype._scale = function (scale /* : string */) {
return this._withHap((hap) => {
let note = hap.value;
+12
View File
@@ -31,6 +31,18 @@ Pattern.prototype.fmapNested = function (func) {
);
};
/**
* Turns chord symbols into voicings, using the smoothest voice leading possible.
* Uses [chord-voicings package](https://github.com/felixroos/chord-voicings#chord-voicings).
*
* @name voicings
* @memberof Pattern
* @param {range} range note range for possible voicings (optional, defaults to `['F3', 'A4']`)
* @returns Pattern
* @example
* stack("<C^7 A7 Dm7 G7>".voicings(), "<C3 A2 D3 G2>")
*/
Pattern.prototype.voicings = function (range) {
let lastVoicing;
if (!range?.length) {
+12 -10
View File
@@ -20,7 +20,7 @@ export const getDrawContext = (id = 'test-canvas') => {
return canvas.getContext('2d');
};
Pattern.prototype.draw = function (callback, cycleSpan, lookaheadCycles = 1) {
Pattern.prototype.draw = function (callback, { from, to, onQuery }) {
if (window.strudelAnimation) {
cancelAnimationFrame(window.strudelAnimation);
}
@@ -29,19 +29,21 @@ Pattern.prototype.draw = function (callback, cycleSpan, lookaheadCycles = 1) {
events = [];
const animate = (time) => {
const t = Tone.getTransport().seconds;
if (cycleSpan) {
const currentCycle = Math.floor(t / cycleSpan);
if (from !== undefined && to !== undefined) {
const currentCycle = Math.floor(t);
if (cycle !== currentCycle) {
cycle = currentCycle;
const begin = currentCycle * cycleSpan;
const end = (currentCycle + lookaheadCycles) * cycleSpan;
events = this._asNumber(true) // true = silent error
.query(new State(new TimeSpan(begin, end)))
.filter(Boolean)
.filter((event) => event.part.begin.equals(event.whole.begin));
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, cycleSpan, time);
callback(ctx, events, t, time);
window.strudelAnimation = requestAnimationFrame(animate);
};
requestAnimationFrame(animate);
+3 -3
View File
@@ -1,13 +1,13 @@
{
"name": "@strudel.cycles/tone",
"version": "0.1.0",
"version": "0.1.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/tone",
"version": "0.0.4",
"license": "GPL-3.0-or-later",
"version": "0.1.1",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@tonejs/piano": "^0.2.1",
"chord-voicings": "^0.0.1",
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/tone",
"version": "0.1.0",
"version": "0.1.3",
"description": "Tone.js API for strudel",
"main": "index.mjs",
"type": "module",
@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0",
"@strudel.cycles/core": "^0.1.2",
"@tonejs/piano": "^0.2.1",
"chord-voicings": "^0.0.1",
"tone": "^14.7.77"
+110 -17
View File
@@ -6,39 +6,132 @@ This program is free software: you can redistribute it and/or modify it under th
import { Pattern } from '@strudel.cycles/core';
const scale = (normalized, min, max) => normalized * (max - min) + min;
const getValue = (e) => {
let value = typeof e.value === 'object' ? e.value.note ?? e.value.n : e.value;
if (typeof value === 'string') {
value = toMidi(value);
}
return value;
};
Pattern.prototype.pianoroll = function ({
timeframe = 10,
cycles = 4,
playhead = 0.5,
overscan = 1,
flipTime = 0,
flipValues = 0,
hideNegative = false,
inactive = '#C9E597',
active = '#FFCA28',
background = '#2A3236',
// background = '#2A3236',
background = 'transparent',
minMidi = 10,
maxMidi = 90,
minMidi = 0,
autorange = 0,
timeframe: timeframeProp,
fold = 0,
vertical = 0,
} = {}) {
const w = window.innerWidth;
const h = window.innerHeight;
const midiRange = maxMidi - minMidi + 1;
const height = h / midiRange;
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;
}
if (!autorange && fold) {
console.warn('disabling autorange has no effect when fold is enabled');
}
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();
const playheadPosition = scale(-from / timeExtent, ...timeRange);
this.draw(
(ctx, events, t) => {
ctx.fillStyle = background;
ctx.clearRect(0, 0, w, h);
ctx.fillRect(0, 0, w, h);
events.forEach((event) => {
const isActive = event.whole.begin <= t && event.whole.end >= t;
const inFrame = (event) =>
(!hideNegative || event.whole.begin >= 0) && event.whole.begin <= t + to && event.whole.end >= t + from;
events.filter(inFrame).forEach((event) => {
const isActive = event.whole.begin <= t && event.whole.end > t;
ctx.fillStyle = event.context?.color || inactive;
ctx.strokeStyle = event.context?.color || active;
ctx.globalAlpha = event.context.velocity ?? 1;
const x = Math.round((event.whole.begin / timeframe) * w);
const width = Math.round(((event.whole.end - event.whole.begin) / timeframe) * w);
const y = Math.round(h - ((Number(event.value) - minMidi) / midiRange) * h);
const offset = (t / timeframe) * w;
const margin = 0;
const coords = [x - offset + margin + 1, y + 1, width - 2, height - 2];
ctx.beginPath();
if (vertical) {
ctx.moveTo(0, playheadPosition);
ctx.lineTo(valueAxis, playheadPosition);
} else {
ctx.moveTo(playheadPosition, 0);
ctx.lineTo(playheadPosition, valueAxis);
}
ctx.stroke();
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);
});
},
timeframe,
2, // lookaheadCycles
{
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) => a - b);
barThickness = fold ? valueAxis / foldValues.length : valueAxis / valueExtent;
},
},
);
return this;
};
+1
View File
@@ -7,3 +7,4 @@ This program is free software: you can redistribute it and/or modify it under th
export * from './clockworker.mjs';
export * from './scheduler.mjs';
export * from './webaudio.mjs';
export * from './sampler.mjs';
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/webaudio",
"version": "0.1.0",
"version": "0.1.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/webaudio",
"version": "0.1.0",
"version": "0.1.4",
"description": "Web Audio helpers for Strudel",
"main": "index.mjs",
"type": "module",
@@ -28,6 +28,6 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0"
"@strudel.cycles/core": "^0.1.2"
}
}
+130
View File
@@ -0,0 +1,130 @@
const bufferCache = {}; // string: Promise<ArrayBuffer>
const loadCache = {}; // string: Promise<ArrayBuffer>
export const getCachedBuffer = (url) => bufferCache[url];
export const loadBuffer = (url, ac) => {
if (!loadCache[url]) {
loadCache[url] = fetch(url)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const decoded = await ac.decodeAudioData(res);
bufferCache[url] = decoded;
return decoded;
});
}
return loadCache[url];
};
export const getLoadedBuffer = (url) => {
return bufferCache[url];
};
/* export const playBuffer = (buffer, time = ac.currentTime, destination = ac.destination) => {
const src = ac.createBufferSource();
src.buffer = buffer;
src.connect(destination);
src.start(time);
};
export const playSample = async (url) => playBuffer(await loadBuffer(url)); */
// https://estuary.mcmaster.ca/samples/resources.json
// Array<{ "url":string, "bank": string, "n": number}>
// ritchse/tidal-drum-machines/tree/main/machines/AkaiLinn
const githubCache = {};
let sampleCache = { current: undefined };
export const loadGithubSamples = async (path, nameFn) => {
const storageKey = 'loadGithubSamples ' + path;
const stored = localStorage.getItem(storageKey);
if (stored) {
console.log('[sampler]: loaded sample list from localstorage', path);
githubCache[path] = JSON.parse(stored);
}
if (githubCache[path]) {
sampleCache.current = githubCache[path];
return githubCache[path];
}
console.log('[sampler]: fetching sample list from github', path);
try {
const [user, repo, ...folders] = path.split('/');
const baseUrl = `https://api.github.com/repos/${user}/${repo}/contents`;
const banks = await fetch(`${baseUrl}/${folders.join('/')}`).then((res) => res.json());
// fetch each subfolder
githubCache[path] = (
await Promise.all(
banks.map(async ({ name, path }) => ({
name,
content: await fetch(`${baseUrl}/${path}`)
.then((res) => res.json())
.catch((err) => {
console.error('could not load path', err);
}),
})),
)
)
.filter(({ content }) => !!content)
.reduce(
(acc, { name, content }) => ({
...acc,
[nameFn?.(name) || name]: content.map(({ download_url }) => download_url),
}),
{},
);
} catch (err) {
console.error('[sampler]: failed to fetch sample list from github', err);
return;
}
sampleCache.current = githubCache[path];
localStorage.setItem(storageKey, JSON.stringify(sampleCache.current));
console.log('[sampler]: loaded samples:', sampleCache.current);
return githubCache[path];
};
/**
* load the given sample map for webdirt
*
* @example
* loadSamples({
* bd: '808bd/BD0000.WAV',
* sd: ['808sd/SD0000.WAV','808sd/SD0010.WAV','808sd/SD0050.WAV']
* }, 'https://raw.githubusercontent.com/tidalcycles/Dirt-Samples/master/');
* s("bd <sd!7 sd(3,4,2)>").n(2).webdirt()
*
*/
export const samples = (sampleMap, baseUrl = sampleMap._base || '') => {
sampleCache.current = {
...sampleCache.current,
...Object.fromEntries(
Object.entries(sampleMap).map(([key, value]) => {
if (typeof value === 'string') {
value = [value];
}
if (typeof value !== 'object') {
throw new Error('wrong sample map format for ' + key);
}
baseUrl = value._base || baseUrl;
const replaceUrl = (v) => (baseUrl + v).replace('github:', 'https://raw.githubusercontent.com/');
if (Array.isArray(value)) {
return [key, value.map(replaceUrl)];
}
// must be object
return [
key,
Object.fromEntries(
Object.entries(value).map(([note, samples]) => {
return [note, (typeof samples === 'string' ? [samples] : samples).map(replaceUrl)];
}),
),
];
}),
),
};
};
export const resetLoadedSamples = () => {
sampleCache.current = undefined;
};
export const getLoadedSamples = () => sampleCache.current;
+6 -4
View File
@@ -10,18 +10,20 @@ import { State, TimeSpan } from '@strudel.cycles/core';
export class Scheduler {
worker;
pattern;
constructor({ audioContext, interval = 0.2, onEvent }) {
constructor({ audioContext, interval = 0.2, onEvent, latency = 0.2 }) {
this.worker = new ClockWorker(
audioContext,
(begin, end) => {
this.pattern.query(new State(new TimeSpan(begin, end))).forEach((e) => {
this.pattern.query(new State(new TimeSpan(begin + latency, end + latency))).forEach((e) => {
if (!e.part.begin.equals(e.whole.begin)) {
return;
}
if (e.context.onTrigger) {
// TODO: kill first param, as it's contained in e
e.context.onTrigger(e.whole.begin, e, audioContext.currentTime, 1 /* cps */);
}
if (onEvent) {
onEvent?.(e);
} else {
console.warn('unplayable event: no audio node nor onEvent callback', e);
}
});
},
+233 -56
View File
@@ -6,8 +6,11 @@ This program is free software: you can redistribute it and/or modify it under th
// import { Pattern, getFrequency, patternify2 } from '@strudel.cycles/core';
import * as strudel from '@strudel.cycles/core';
import { Tone } from '@strudel.cycles/tone';
const { Pattern, getFrequency, patternify2 } = strudel;
import { fromMidi, toMidi } from '@strudel.cycles/core';
import { loadBuffer } from './sampler.mjs';
const { Pattern } = strudel;
// export const getAudioContext = () => Tone.getContext().rawContext;
let audioContext;
export const getAudioContext = () => {
@@ -17,9 +20,15 @@ export const getAudioContext = () => {
return audioContext;
};
const lookahead = 0.2;
const getFilter = (type, frequency, Q) => {
const filter = getAudioContext().createBiquadFilter();
filter.type = type;
filter.frequency.value = frequency;
filter.Q.value = Q;
return filter;
};
const adsr = (attack, decay, sustain, release, velocity, begin, end) => {
const getADSR = (attack, decay, sustain, release, velocity, begin, end) => {
const gainNode = getAudioContext().createGain();
gainNode.gain.setValueAtTime(0, begin);
gainNode.gain.linearRampToValueAtTime(velocity, begin + attack); // attack
@@ -30,65 +39,233 @@ const adsr = (attack, decay, sustain, release, velocity, begin, end) => {
return gainNode;
};
Pattern.prototype.withAudioNode = function (createAudioNode) {
return this._withHap((hap) => {
return hap.setContext({
...hap.context,
createAudioNode: (t, e) => createAudioNode(t, e, hap.context.createAudioNode?.(t, hap)),
});
});
const getOscillator = ({ s, freq, t, duration, release }) => {
// make oscillator
const o = getAudioContext().createOscillator();
o.type = s || 'triangle';
o.frequency.value = Number(freq);
o.start(t);
o.stop(t + duration + release);
return o;
};
Pattern.prototype._wave = function (type) {
return this.withAudioNode((t, e) => {
const osc = getAudioContext().createOscillator();
osc.type = type;
const f = getFrequency(e);
osc.frequency.value = f; // expects frequency..
const begin = t ?? e.whole.begin.valueOf() + lookahead;
const end = begin + e.duration.valueOf();
osc.start(begin);
osc.stop(end); // release?
return osc;
});
};
Pattern.prototype.adsr = function (a = 0.01, d = 0.05, s = 1, r = 0.01) {
return this.withAudioNode((t, e, node) => {
const velocity = e.context?.velocity || 1;
const begin = t ?? e.whole.begin.valueOf() + lookahead;
const end = begin + e.duration.valueOf() + lookahead;
const envelope = adsr(a, d, s, r, velocity, begin, end);
node?.connect(envelope);
return envelope;
});
};
Pattern.prototype._filter = function (type = 'lowpass', frequency = 1000) {
return this.withAudioNode((t, e, node) => {
const filter = getAudioContext().createBiquadFilter();
filter.type = type;
filter.frequency.value = frequency;
node?.connect(filter);
return filter;
});
const getSoundfontKey = (s) => {
if (!globalThis.soundfontList) {
// soundfont package not loaded
return false;
}
if (globalThis.soundfontList?.instruments?.includes(s)) {
return s;
}
// check if s is one of the soundfonts, which are loaded into globalThis, to avoid coupling both packages
const nameIndex = globalThis.soundfontList?.instrumentNames?.indexOf(s);
// convert number nameIndex (0-128) to 3 digit string (001-128)
const name = nameIndex < 10 ? `00${nameIndex}` : nameIndex < 100 ? `0${nameIndex}` : nameIndex;
if (nameIndex !== -1) {
// TODO: indices of instrumentNames do not seem to match instruments
return globalThis.soundfontList.instruments.find((instrument) => instrument.startsWith(name));
}
return;
};
Pattern.prototype.filter = function (type, frequency) {
return patternify2(Pattern.prototype._filter)(reify(type), reify(frequency), this);
const getSampleBufferSource = async (s, n, note) => {
let transpose = 0;
if (note) {
transpose = toMidi(note) - 36; // C3 is middle C
}
const ac = getAudioContext();
// is sample from loaded samples(..)
const samples = getLoadedSamples();
if (!samples) {
throw new Error('no samples loaded');
}
const bank = samples?.[s];
if (!bank) {
throw new Error('sample not found:', s, 'try one of ' + Object.keys(samples));
}
if (typeof bank !== 'object') {
throw new Error('wrong format for sample bank:', s);
}
let sampleUrl;
if (Array.isArray(bank)) {
sampleUrl = bank[n % bank.length];
} else {
if (!note) {
throw new Error('no note(...) set for sound', s);
}
const midiDiff = (noteA) => toMidi(noteA) - toMidi(note);
// object format will expect keys as notes
const closest = Object.keys(bank)
.filter((k) => !k.startsWith('_'))
.reduce(
(closest, key, j) => (!closest || Math.abs(midiDiff(key)) < Math.abs(midiDiff(closest)) ? key : closest),
null,
);
transpose = -midiDiff(closest); // semitones to repitch
sampleUrl = bank[closest][n % bank[closest].length];
}
const buffer = await loadBuffer(sampleUrl, ac);
const bufferSource = ac.createBufferSource();
bufferSource.buffer = buffer;
const playbackRate = 1.0 * Math.pow(2, transpose / 12);
// bufferSource.playbackRate.value = Math.pow(2, transpose / 12);
bufferSource.playbackRate.value = playbackRate;
return bufferSource;
};
const splitSN = (s, n) => {
if (!s.includes(':')) {
return [s, n];
}
let [s2, n2] = s.split(':');
if (isNaN(Number(n2))) {
return [s, n];
}
return [s2, n2];
};
Pattern.prototype.out = function () {
const master = getAudioContext().createGain();
master.gain.value = 0.1;
master.connect(getAudioContext().destination);
return this.withAudioNode((t, e, node) => {
if (!node) {
console.warn('out: no source! call .osc() first');
return this.onTrigger(async (t, hap, ct) => {
const ac = getAudioContext();
// calculate correct time (tone.js workaround)
t = ac.currentTime + t - ct;
// destructure value
let {
freq,
s,
sf,
clip = 0, // if 1, samples will be cut off when the hap ends
n = 0,
note,
gain = 1,
cutoff,
resonance = 1,
hcutoff,
hresonance = 1,
bandf,
bandq = 1,
pan,
attack = 0.001,
decay = 0.05,
sustain = 0.5,
release = 0.001,
speed = 1, // sample playback speed
begin = 0,
end = 1,
} = hap.value;
const { velocity = 1 } = hap.context;
gain *= velocity; // legacy fix for velocity
// the chain will hold all audio nodes that connect to each other
const chain = [];
if (typeof s === 'string') {
[s, n] = splitSN(s, n);
}
node?.connect(master);
})._withHap((hap) => {
const onTrigger = (time, e) => e.context?.createAudioNode?.(time, e);
return hap.setContext({ ...hap.context, onTrigger });
if (typeof note === 'string') {
[note, n] = splitSN(note, n);
}
if (!s || ['sine', 'square', 'triangle', 'sawtooth'].includes(s)) {
// with synths, n and note are the same thing
n = note || n;
if (typeof n === 'string') {
n = toMidi(n); // e.g. c3 => 48
}
// get frequency
if (!freq && typeof n === 'number') {
freq = fromMidi(n); // + 48);
}
// make oscillator
const o = getOscillator({ t, s, freq, duration: hap.duration, release });
chain.push(o);
// level down oscillators as they are really loud compared to samples i've tested
const g = ac.createGain();
g.gain.value = 0.3;
chain.push(g);
// TODO: make adsr work with samples without pops
// envelope
const adsr = getADSR(attack, decay, sustain, release, 1, t, t + hap.duration);
chain.push(adsr);
} else {
// load sample
if (speed === 0) {
// no playback
return;
}
if (!s) {
console.warn('no sample specified');
return;
}
const soundfont = getSoundfontKey(s);
let bufferSource;
try {
if (soundfont) {
// is soundfont
bufferSource = await globalThis.getFontBufferSource(soundfont, note || n, ac);
} else {
// is sample from loaded samples(..)
bufferSource = await getSampleBufferSource(s, n, note);
}
} catch (err) {
console.warn(err);
return;
}
// asny stuff above took too long?
if (ac.currentTime > t) {
console.warn('sample still loading:', s, n);
return;
}
if (!bufferSource) {
console.warn('no buffer source');
return;
}
bufferSource.playbackRate.value = Math.abs(speed) * bufferSource.playbackRate.value;
// TODO: nudge, unit, cut, loop
let duration = soundfont || clip ? hap.duration : bufferSource.buffer.duration;
// let duration = bufferSource.buffer.duration;
const offset = begin * duration;
duration = ((end - begin) * duration) / Math.abs(speed);
if (soundfont || clip) {
bufferSource.start(t, offset); // duration does not work here for some reason
} else {
bufferSource.start(t, offset, duration);
}
chain.push(bufferSource);
if (soundfont || clip) {
const env = ac.createGain();
const releaseLength = 0.1;
env.gain.value = 0.6;
env.gain.setValueAtTime(env.gain.value, t + duration);
env.gain.linearRampToValueAtTime(0, t + duration + releaseLength);
// env.gain.linearRampToValueAtTime(0, t + duration + releaseLength);
chain.push(env);
bufferSource.stop(t + duration + releaseLength);
} else {
bufferSource.stop(t + duration);
}
}
// master out
const master = ac.createGain();
master.gain.value = gain;
chain.push(master);
// filters
cutoff !== undefined && chain.push(getFilter('lowpass', cutoff, resonance));
hcutoff !== undefined && chain.push(getFilter('highpass', hcutoff, hresonance));
bandf !== undefined && chain.push(getFilter('bandpass', bandf, bandq));
// TODO vowel
// TODO delay / delaytime / delayfeedback
// panning
if (pan !== undefined) {
const panner = ac.createStereoPanner();
panner.pan.value = 2 * pan - 1;
chain.push(panner);
}
// master out
/* const master = ac.createGain();
master.gain.value = 0.8 * gain;
chain.push(master); */
chain.push(ac.destination);
// connect chain elements together
chain.slice(1).reduce((last, current) => last.connect(current), chain[0]);
});
};
Pattern.prototype.define('wave', (type, pat) => pat.wave(type), { patternified: true });
+11
View File
@@ -0,0 +1,11 @@
# @strudel.cycles/webdirt
This package adds [webdirt](https://github.com/dktr0/WebDirt) support to strudel!
## Dev Notes
Add default samples to repl:
1. move samples to `repl/public` folder. the samples folder is expected to have subfolders, with samples in it. the subfolders will be the names of the samples.
2. run `./makeSampleMap.sh ../../repl/public/EmuSP12 > ../../repl/public/EmuSP12.json`
3. adapt `loadWebDirt` in App.jsx + MiniRepl.jsx to use the generated json file
+1
View File
@@ -0,0 +1 @@
export * from './webdirt.mjs';
+32
View File
@@ -0,0 +1,32 @@
#/bin/sh
printf "{\n"
dircount=0
# for d in $searchRoot/*; do
find $1 -mindepth 1 -maxdepth 1 -iname "*" | sort | while read d; do
if [ -d "$d" ]
then
if [ $dircount -ne 0 ]
then
printf ",\n"
fi
(( dircount++ ))
dirname=`basename $d`
printf "\"%s\": [" "$dirname"
search2=$searchRoot/$dirname/*.WAV
filecount=0
find "$d" -iname "*.wav" | sort | while read f; do
# for f in $search2; do
filename=$(printf %q "$f")
basename=${f##*/}
if [[ ${basename:0:1} != "." ]]; then
if [ $filecount -ne 0 ]; then
printf ","
fi
(( filecount++ ))
printf "\"%s/%s\"" "$dirname" "$basename"
fi
done
printf "]"
fi
done
printf "\n}\n"
+28
View File
@@ -0,0 +1,28 @@
{
"name": "@strudel.cycles/webdirt",
"version": "0.1.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@strudel.cycles/webdirt",
"version": "0.1.0",
"license": "AGPL-3.0-or-later",
"dependencies": {
"WebDirt": "github:dktr0/WebDirt"
}
},
"node_modules/WebDirt": {
"name": "webdirt",
"version": "1.0.0",
"resolved": "git+ssh://git@github.com/dktr0/WebDirt.git#425dc8fd023440d9c61ffdb8642e44e2710faea0",
"license": "ISC"
}
},
"dependencies": {
"WebDirt": {
"version": "git+ssh://git@github.com/dktr0/WebDirt.git#425dc8fd023440d9c61ffdb8642e44e2710faea0",
"from": "WebDirt@github:dktr0/WebDirt"
}
}
}
+28
View File
@@ -0,0 +1,28 @@
{
"name": "@strudel.cycles/webdirt",
"version": "0.1.2",
"description": "WebDirt integration for Strudel",
"main": "index.mjs",
"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>",
"license": "AGPL-3.0-or-later",
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.2",
"WebDirt": "github:dktr0/WebDirt"
}
}
+98
View File
@@ -0,0 +1,98 @@
import * as strudel from '@strudel.cycles/core';
const { Pattern } = strudel;
import * as WebDirt from 'WebDirt';
import { getLoadedSamples, loadBuffer, getLoadedBuffer } from '@strudel.cycles/webaudio';
let webDirt;
/*
example config:
{
sampleMapUrl: 'EmuSP12.json',
sampleFolder: 'EmuSP12',
}
*/
export function loadWebDirt(config) {
webDirt = new WebDirt.WebDirt(config);
webDirt.initializeWebAudio();
}
/**
*
* Uses [webdirt](https://github.com/dktr0/WebDirt) as output.
*
* <details>
* <summary>show supported Webdirt controls</summary>
*
* - s :: String, -- name of sample bank
* - n :: Int, -- number of sample within a bank
* - {@link gain} :: Number, -- clamped from 0 to 2; 1 is default and full-scale
* - overgain :: Number, -- additional gain added to gain to go past clamp at 2
* - {@link pan} :: Number, -- range: 0 to 1
* - nudge :: Number, -- nudge the time of the sample forwards/backwards in seconds
* - {@link speed} :: Number, -- speed / pitch of the sample
* - {@link unit} :: String
* - note :: Number, -- pitch offset in semitones
* - {@link begin} :: Number, -- cut from sample start, normalized
* - {@link end} :: Number, -- cut from sample end, normalized
* - {@link cut} :: Int, -- samples with same cut number will interupt each other
* - {@link cutoff} :: Number, -- lowpass filter frequency
* - {@link resonance} :: Number, -- lowpass filter resonance
* - {@link hcutoff} :: Number, -- highpass filter frequency
* - {@link hresonance} :: Number, -- highpass filter resonance
* - {@link bandf} :: Number, -- bandpass filter frequency
* - {@link bandq} :: Number, -- bandpass filter resonance
* - {@link vowel} :: String, -- name of vowel ('a' | 'e' | 'i' | 'o' | 'u')
* - delay :: Number, -- delay wet/dry mix
* - delaytime :: Number, -- delay time in seconds
* - delayfeedback :: Number, -- delay feedback
* - {@link loop} :: Number, -- loop sample n times (relative to sample length)
* - {@link crush} :: Number, -- bitcrusher (currently not working)
* - {@link coarse} :: Number, -- coarse effect (currently not working)
* - {@link shape} :: Number, -- (currently not working)
*
* </details>
*
* @name webdirt
* @memberof Pattern
* @returns Pattern
* @example
* s("bd*2 hh sd hh").n("<0 1>").webdirt()
*/
Pattern.prototype.webdirt = function () {
// create a WebDirt object and initialize Web Audio context
return this._withHap((hap) => {
const onTrigger = async (time, e, currentTime) => {
if (!webDirt) {
throw new Error('WebDirt not initialized!');
}
const deadline = time - currentTime;
const { s, n = 0, ...rest } = e.value || {};
if (!s) {
console.warn('Pattern.webdirt: no "s" was set!');
}
const samples = getLoadedSamples();
if (!samples?.[s]) {
// try default samples
webDirt.playSample({ s, n, ...rest }, deadline);
return;
}
if (!samples?.[s]) {
console.warn(`Pattern.webdirt: sample "${s}" not found in loaded samples`, samples);
} else {
const bank = samples[s];
const sampleUrl = bank[n % bank.length];
const buffer = getLoadedBuffer(sampleUrl);
if (!buffer) {
console.log(`Pattern.webdirt: load ${s}:${n} from ${sampleUrl}`);
loadBuffer(sampleUrl, webDirt.ac);
} else {
const msg = { buffer: { buffer }, ...rest };
webDirt.playSample(msg, deadline);
}
}
};
return hap.setContext({ ...hap.context, onTrigger });
});
};
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@strudel.cycles/xen",
"version": "0.1.0",
"version": "0.1.3",
"description": "Xenharmonic API for strudel",
"main": "index.mjs",
"scripts": {
@@ -24,6 +24,6 @@
},
"homepage": "https://github.com/tidalcycles/strudel#readme",
"dependencies": {
"@strudel.cycles/core": "^0.1.0"
"@strudel.cycles/core": "^0.1.2"
}
}
-636
View File
@@ -1,636 +0,0 @@
{
"_info": "Auto-generated by pandoc-url2cite. Feel free to modify, keys will never be overwritten.",
"urls": {
"https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode=rpdm20": {
"fetched": "2022-03-24T12:17:27.481Z",
"bibtex": [
"",
"@article{roberts_code_2016,",
" title = {Code as information and code as spectacle},",
" volume = {12},",
" issn = {1479-4713},",
" url = {https://doi.org/10.1080/14794713.2016.1227602},",
" doi = {10.1080/14794713.2016.1227602},",
" abstract = {In this artist statement, I will discuss the tension between source code as an interactive system for performers and source code as information and entertainment for audiences in live-coding performances. I then describe augmentations I developed for the presentation of source code in the live-coding environment Gibber, including animations and annotations that visually reveal aspects of system state during performances. I briefly describe audience responses to these techniques and, more importantly, how they are critical to my own artistic practice.},",
" number = {2},",
" urldate = {2022-03-24},",
" journal = {International Journal of Performance Arts and Digital Media},",
" author = {Roberts, Charles},",
" month = jul,",
" year = {2016},",
" keywords = {Live coding, psychology of programming, notation, audiences, algorithms},",
" pages = {201--206},",
"}",
""
],
"csl": {
"DOI": "10.1080/14794713.2016.1227602",
"ISSN": "1479-4713",
"URL": "https://doi.org/10.1080/14794713.2016.1227602",
"abstract": "In this artist statement, I will discuss the tension between source code as an interactive system for performers and source code as information and entertainment for audiences in live-coding performances. I then describe augmentations I developed for the presentation of source code in the live-coding environment Gibber, including animations and annotations that visually reveal aspects of system state during performances. I briefly describe audience responses to these techniques and, more importantly, how they are critical to my own artistic practice.",
"accessed": {
"date-parts": [
[
2022,
3,
24
]
]
},
"author": [
{
"family": "Roberts",
"given": "Charles"
}
],
"container-title": "International Journal of Performance Arts and Digital Media",
"id": "https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20",
"issue": "2",
"issued": {
"date-parts": [
[
2016,
7
]
]
},
"keyword": "Live coding, psychology of programming, notation, audiences, algorithms",
"page": "201-206",
"title": "Code as information and code as spectacle",
"type": "article-journal",
"volume": "12"
}
},
"https://zenodo.org/record/5788732": {
"fetched": "2022-03-24T12:20:17.218Z",
"bibtex": [
"",
"@misc{mclean_alternate_2021,",
" address = {Valdivia, Chile},",
" title = {Alternate {Timelines} for {TidalCycles}},",
" url = {https://zenodo.org/record/5788732},",
" abstract = {The TidalCycles (or Tidal for short) live coding environment has been developed since around 2009, via several rewrites of its core representation. Rather than having fixed goals, this development has been guided by use, motivated by the open aim to make music. This development process can be seen as a long-form improvisation, with insights into the nature of Tidal gained through the process of writing it, feeding back to guide the next steps of development. This brings the worrying thought that key insights will have been missed along this development journey, that would otherwise have lead to very different software. Indeed participants at beginners workshops that I have lead or co-lead have often asked questions without good answers, because they made deficiencies or missing features in the software clear. It is well known that a beginners mind is able to see much that an expert has become blind to. Running workshops are an excellent way to find new development ideas, but the present paper explores a different technique the rewrite.},",
" urldate = {2022-03-24},",
" collaborator = {McLean, Alex},",
" month = dec,",
" year = {2021},",
" keywords = {live coding, algorithmic pattern, tidalcycles, haskell, python},",
"}",
""
],
"csl": {
"URL": "https://zenodo.org/record/5788732",
"abstract": "The TidalCycles (or Tidal for short) live coding environment has been developed since around 2009, via several rewrites of its core representation. Rather than having fixed goals, this development has been guided by use, motivated by the open aim to make music. This development process can be seen as a long-form improvisation, with insights into the nature of Tidal gained through the process of writing it, feeding back to guide the next steps of development. This brings the worrying thought that key insights will have been missed along this development journey, that would otherwise have lead to very different software. Indeed participants at beginners workshops that I have lead or co-lead have often asked questions without good answers, because they made deficiencies or missing features in the software clear. It is well known that a beginners mind is able to see much that an expert has become blind to. Running workshops are an excellent way to find new development ideas, but the present paper explores a different technique the rewrite.",
"accessed": {
"date-parts": [
[
2022,
3,
24
]
]
},
"id": "https://zenodo.org/record/5788732",
"issued": {
"date-parts": [
[
2021,
12
]
]
},
"keyword": "live coding, algorithmic pattern, tidalcycles, haskell, python",
"publisher-place": "Valdivia, Chile",
"title": "Alternate Timelines for TidalCycles",
"type": ""
}
},
"https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42": {
"fetched": "2022-04-12T22:47:17.063Z",
"bibtex": [
"",
"@misc{roberts_bringing_2019,",
" title = {Bringing the {TidalCycles} {Mini}-{Notation} to the {Browser}},",
" url = {https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42},",
" abstract = {A JavaScript dialect of its mini-notation for pattern is created, enabling easy integration with creative coding tools and an accompanying technique for visually annotating the playback of TidalCycles patterns over time. TidalCycles has rapidly become the most popular system for many styles of live coding performance, in particular Algoraves. We created a JavaScript dialect of its mini-notation for pattern, enabling easy integration with creative coding tools. Our research pairs a formalism describing the mini-notation with a small JavaScript library for generating events over time; this library is suitable for generating events inside of an AudioWorkletProcessor thread and for assisting with scheduling in JavaScript environments more generally. We describe integrating the library into the two live coding systems, Gibber and Hydra, and discuss an accompanying technique for visually annotating the playback of TidalCycles patterns over time.},",
" language = {en},",
" urldate = {2022-04-12},",
" journal = {www.semanticscholar.org},",
" author = {Roberts, Charles},",
" year = {2019},",
"}",
""
],
"csl": {
"URL": "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42",
"abstract": "A JavaScript dialect of its mini-notation for pattern is created, enabling easy integration with creative coding tools and an accompanying technique for visually annotating the playback of TidalCycles patterns over time. TidalCycles has rapidly become the most popular system for many styles of live coding performance, in particular Algoraves. We created a JavaScript dialect of its mini-notation for pattern, enabling easy integration with creative coding tools. Our research pairs a formalism describing the mini-notation with a small JavaScript library for generating events over time; this library is suitable for generating events inside of an AudioWorkletProcessor thread and for assisting with scheduling in JavaScript environments more generally. We describe integrating the library into the two live coding systems, Gibber and Hydra, and discuss an accompanying technique for visually annotating the playback of TidalCycles patterns over time.",
"accessed": {
"date-parts": [
[
2022,
4,
12
]
]
},
"author": [
{
"family": "Roberts",
"given": "Charles"
}
],
"container-title": "www.semanticscholar.org",
"id": "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42",
"issued": {
"date-parts": [
[
2019
]
]
},
"title": "Bringing the TidalCycles Mini-Notation to the Browser",
"type": ""
}
},
"https://zenodo.org/record/6456380": {
"fetched": "2022-04-14T21:26:21.302Z",
"bibtex": [
"",
"@misc{mclean_tidalvortex_2022,",
" address = {Limerick, Ireland},",
" title = {{TidalVortex} {Zero}},",
" url = {https://zenodo.org/record/6456380},",
" abstract = {In this paper we introduce version zero of TidalVortex, an alternative implementation of the TidalCycles live coding system, using the Python programming language.  This is open-ended work, exploring what happens when we try to extract the 'essence' of a system like TidalCycles and translate it into another programming language, while taking advantage of the affordance of its new host. First, we review the substantial prior art in porting TidalCycles, and in representing musical patterns in Python. We then compare equivalent patterns written in Haskell (TidalCycles) and Python (TidalVortex), and relate implementation details of how functional reactive paradigms have translated from the pure functional, strongly typed Haskell to the more multi-paradigm, dynamically typed Python. Finally, we conclude with reflections and generalisable outcomes.},",
" urldate = {2022-04-14},",
" collaborator = {McLean, Alex and Forment, Raphaël and Le Beux, Sylvain and Silvani, Damián},",
" month = apr,",
" year = {2022},",
"}",
""
],
"csl": {
"URL": "https://zenodo.org/record/6456380",
"abstract": "In this paper we introduce “version zero” of TidalVortex, an alternative implementation of the TidalCycles live coding system, using the Python programming language.  This is open-ended work, exploring what happens when we try to extract the essence of a system like TidalCycles and translate it into another programming language, while taking advantage of the affordance of its new host. First, we review the substantial prior art in porting TidalCycles, and in representing musical patterns in Python. We then compare equivalent patterns written in Haskell (TidalCycles) and Python (TidalVortex), and relate implementation details of how functional reactive paradigms have translated from the pure functional, strongly typed Haskell to the more multi-paradigm, dynamically typed Python. Finally, we conclude with reflections and generalisable outcomes.",
"accessed": {
"date-parts": [
[
2022,
4,
14
]
]
},
"id": "https://zenodo.org/record/6456380",
"issued": {
"date-parts": [
[
2022,
4
]
]
},
"publisher-place": "Limerick, Ireland",
"title": "TidalVortex Zero",
"type": ""
}
},
"https://zenodo.org/record/4299661": {
"fetched": "2022-04-15T07:40:08.702Z",
"bibtex": [
"",
"@misc{mclean_algorithmic_2020,",
" address = {Birmingham UK},",
" title = {Algorithmic {Pattern}},",
" url = {https://zenodo.org/record/4299661},",
" abstract = {This paper brings together two main perspectives on algorithmic pattern. First, the writing of musical patterns in live coding performance, and second, the weaving of patterns in textiles. In both cases, algorithmic pattern is an interface between the human and the outcome, where small changes have far-reaching impact on the results. By bringing contemporary live coding and ancient textile approaches together, we reach a common view of pattern as algorithmic movement (e.g. looping, shifting, reflecting, interfering) in the making of things. This works beyond the usual definition of pattern used in musical interfaces, of mere repeating sequences. We conclude by considering the place of algorithmic pattern in a wider activity of making.},",
" urldate = {2022-04-15},",
" collaborator = {McLean, Alex},",
" month = jul,",
" year = {2020},",
" keywords = {pattern, tidalcycles, algorithmic music, textiles, live coding, algorave},",
"}",
""
],
"csl": {
"URL": "https://zenodo.org/record/4299661",
"abstract": "This paper brings together two main perspectives on algorithmic pattern. First, the writing of musical patterns in live coding performance, and second, the weaving of patterns in textiles. In both cases, algorithmic pattern is an interface between the human and the outcome, where small changes have far-reaching impact on the results. By bringing contemporary live coding and ancient textile approaches together, we reach a common view of pattern as algorithmic movement (e.g. looping, shifting, reflecting, interfering) in the making of things. This works beyond the usual definition of pattern used in musical interfaces, of mere repeating sequences. We conclude by considering the place of algorithmic pattern in a wider activity of making.",
"accessed": {
"date-parts": [
[
2022,
4,
15
]
]
},
"id": "https://zenodo.org/record/4299661",
"issued": {
"date-parts": [
[
2020,
7
]
]
},
"keyword": "pattern, tidalcycles, algorithmic music, textiles, live coding, algorave",
"publisher-place": "Birmingham UK",
"title": "Algorithmic Pattern",
"type": ""
}
},
"https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/gibber-live-coding-audio-in-the-browser?page=root;size=150;view=text": {
"fetched": "2022-04-15T07:40:15.037Z",
"bibtex": [
"",
"@article{charlie_gibber:_2012,",
" title = {{GIBBER}: {LIVE} {CODING} {AUDIO} {IN} {THE} {BROWSER}},",
" volume = {2012},",
" issn = {2223-3881},",
" url = {https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/%E2%80%93gibber-live-coding-audio-in-the-browser?page=root;size=150;view=text},",
" language = {en},",
" urldate = {2022-04-15},",
" journal = {International Computer Music Conference Proceedings},",
" author = {Charlie, , Roberts and Joann, , Kuchera-Morin},",
" year = {2012},",
"}",
""
],
"csl": {
"ISSN": "2223-3881",
"URL": "https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/%E2%80%93gibber-live-coding-audio-in-the-browser?page=root;size=150;view=text",
"accessed": {
"date-parts": [
[
2022,
4,
15
]
]
},
"author": [
{
"family": "Charlie",
"given": "Roberts"
},
{
"family": "Joann",
"given": "Kuchera-Morin"
}
],
"container-title": "International Computer Music Conference Proceedings",
"id": "https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/gibber-live-coding-audio-in-the-browser?page_x61_root;size_x61_150;view_x61_text",
"issued": {
"date-parts": [
[
2012
]
]
},
"title": "GIBBER: LIVE CODING AUDIO IN THE BROWSER",
"title-short": "GIBBER",
"type": "article-journal",
"volume": "2012"
}
},
"https://www.semanticscholar.org/paper/Estuary%3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b": {
"fetched": "2022-04-15T07:40:17.179Z",
"bibtex": [
"",
"@misc{ogborn_estuary:_2017,",
" title = {Estuary: {Browser}-based {Collaborative} {Projectional} {Live} {Coding} of {Musical} {Patterns}},",
" shorttitle = {Estuary},",
" url = {https://www.semanticscholar.org/paper/Estuary%3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b},",
" abstract = {Estuary is a browser-based collaborative projectional editing environment built on top of the popular TidalCycles language for the live coding of musical pattern that includes a strict form of structure editing, a click-only border-free approach to interface design, and explicit notations to modulate the liveness of different parts of the code. This paper describes the initial design and development of Estuary, a browser-based collaborative projectional editing environment built on top of the popular TidalCycles language for the live coding of musical pattern. Key features of Estuary include a strict form of structure editing (making syntactical errors impossible), a click-only border-free approach to interface design, explicit notations to modulate the liveness of different parts of the code, and a server-based network collaboration system that can be used for many simultaneous collaborative live coding performances, as well as to present different views of the same live coding activity. Estuary has been developed using Reflex-DOM, a Haskell-based framework for web development whose strictness promises robustness and security advantages.},",
" language = {en},",
" urldate = {2022-04-15},",
" journal = {www.semanticscholar.org},",
" author = {Ogborn, David and Beverley, J.},",
" year = {2017},",
"}",
""
],
"csl": {
"URL": "https://www.semanticscholar.org/paper/Estuary%3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b",
"abstract": "Estuary is a browser-based collaborative projectional editing environment built on top of the popular TidalCycles language for the live coding of musical pattern that includes a strict form of structure editing, a click-only border-free approach to interface design, and explicit notations to modulate the liveness of different parts of the code. This paper describes the initial design and development of Estuary, a browser-based collaborative projectional editing environment built on top of the popular TidalCycles language for the live coding of musical pattern. Key features of Estuary include a strict form of structure editing (making syntactical errors impossible), a click-only border-free approach to interface design, explicit notations to modulate the liveness of different parts of the code, and a server-based network collaboration system that can be used for many simultaneous collaborative live coding performances, as well as to present different views of the same live coding activity. Estuary has been developed using Reflex-DOM, a Haskell-based framework for web development whose strictness promises robustness and security advantages.",
"accessed": {
"date-parts": [
[
2022,
4,
15
]
]
},
"author": [
{
"family": "Ogborn",
"given": "David"
},
{
"family": "Beverley",
"given": "J."
}
],
"container-title": "www.semanticscholar.org",
"id": "https://www.semanticscholar.org/paper/Estuary_x37_3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b",
"issued": {
"date-parts": [
[
2017
]
]
},
"title": "Estuary: Browser-based Collaborative Projectional Live Coding of Musical Patterns",
"title-short": "Estuary",
"type": ""
}
},
"https://zenodo.org/record/6353969": {
"fetched": "2022-04-15T07:40:20.966Z",
"bibtex": [
"",
"@misc{mclean_feedforward_2020,",
" address = {Birmingham},",
" title = {Feedforward},",
" url = {https://zenodo.org/record/6353969},",
" abstract = {This is an improvised, from-scratch live coding performance. The NIME interface which this performance showcases is the new Feedfoward editor for the TidalCycles live coding environment. Feedforward is written in Haskell using the ncurses library for terminal-based user interfaces. It runs on low-powered hardware including the Raspberry Pi Zero, with formative testing of prototypes conducted with several groups of children between the ages of 8 and 14. Feedforward has a number of features designed to support improvised, multi-pattern live coding. Individual Tidal patterns are addressable with hotkeys for fast mute and unmuting. Each pattern has a stereo VU meter, to aid the quick matching of sound to pattern within a mix. In addition, TidalCycles has been extended to store context with each event, so that source code positions in its polyrhythmic sequence mini-notation are tracked. This allows steps to be highlighted in the source code when- ever they are active. This works even when Tidal combinators have been applied to manipulate the timeline. Formal evaluation has yet to take place, but this feature appears to support learning of how pattern manipulations work in Tidal. Feedforward and TidalCycles is free/open source software under a GPL licence version 3.0.},",
" urldate = {2022-04-15},",
" collaborator = {McLean, Alex},",
" month = jul,",
" year = {2020},",
"}",
""
],
"csl": {
"URL": "https://zenodo.org/record/6353969",
"abstract": "This is an improvised, from-scratch live coding performance. The NIME interface which this performance showcases is the new Feedfoward editor for the TidalCycles live coding environment. Feedforward is written in Haskell using the ncurses library for terminal-based user interfaces. It runs on low-powered hardware including the Raspberry Pi Zero, with formative testing of prototypes conducted with several groups of children between the ages of 8 and 14. Feedforward has a number of features designed to support improvised, multi-pattern live coding. Individual Tidal patterns are addressable with hotkeys for fast mute and unmuting. Each pattern has a stereo VU meter, to aid the quick matching of sound to pattern within a mix. In addition, TidalCycles has been extended to store context with each event, so that source code positions in its polyrhythmic sequence mini-notation are tracked. This allows steps to be highlighted in the source code when- ever they are active. This works even when Tidal combinators have been applied to manipulate the timeline. Formal evaluation has yet to take place, but this feature appears to support learning of how pattern manipulations work in Tidal. Feedforward and TidalCycles is free/open source software under a GPL licence version 3.0.",
"accessed": {
"date-parts": [
[
2022,
4,
15
]
]
},
"id": "https://zenodo.org/record/6353969",
"issued": {
"date-parts": [
[
2020,
7
]
]
},
"publisher-place": "Birmingham",
"title": "Feedforward",
"type": ""
}
},
"https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.1340": {
"fetched": "2022-04-24T21:09:16.724Z",
"bibtex": [
"",
"@inproceedings{toussaint_euclidean_2005,",
" title = {The {Euclidean} algorithm generates traditional musical rhythms},",
" url = {https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.1340},",
" abstract = {The Euclidean algorithm (which comes down to us from Euclids Elements) computes the greatest common divisor of two given integers. It is shown here that the structure of the Euclidean algorithm may be used to automatically generate, very efficiently, a large family of rhythms used as timelines (rhythmic ostinatos), in traditional world music. These rhythms, here dubbed Euclidean rhythms, have the property that their onset patterns are distributed as evenly as possible in a mathematically precise sense, and optimal manner. Euclidean rhythms are closely related to the family of Aksak rhythms studied by ethnomusicologists, and occur in a wide variety of other disciplines as well. For example they characterize algorithms for drawing digital straight lines in computer graphics, as well as algorithms for calculating leap years in calendar design. Euclidean rhythms also find application in nuclear physics accelerators and in computer science, and are closely related to several families of words and sequences of interest in the study of the combinatorics of words, such as mechanical words, Sturmian words, two-distance sequences, and Euclidean strings, to which the Euclidean rhythms are compared. 1.},",
" urldate = {2022-04-24},",
" booktitle = {In {Proceedings} of {BRIDGES}: {Mathematical} {Connections} in {Art}, {Music} and {Science}},",
" author = {Toussaint, Godfried},",
" year = {2005},",
" pages = {47--56},",
"}",
""
],
"csl": {
"URL": "https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.1340",
"abstract": "The Euclidean algorithm (which comes down to us from Euclids Elements) computes the greatest common divisor of two given integers. It is shown here that the structure of the Euclidean algorithm may be used to automatically generate, very efficiently, a large family of rhythms used as timelines (rhythmic ostinatos), in traditional world music. These rhythms, here dubbed Euclidean rhythms, have the property that their onset patterns are distributed as evenly as possible in a mathematically precise sense, and optimal manner. Euclidean rhythms are closely related to the family of Aksak rhythms studied by ethnomusicologists, and occur in a wide variety of other disciplines as well. For example they characterize algorithms for drawing digital straight lines in computer graphics, as well as algorithms for calculating leap years in calendar design. Euclidean rhythms also find application in nuclear physics accelerators and in computer science, and are closely related to several families of words and sequences of interest in the study of the combinatorics of words, such as mechanical words, Sturmian words, two-distance sequences, and Euclidean strings, to which the Euclidean rhythms are compared. 1.",
"accessed": {
"date-parts": [
[
2022,
4,
24
]
]
},
"author": [
{
"family": "Toussaint",
"given": "Godfried"
}
],
"container-title": "In Proceedings of BRIDGES: Mathematical Connections in Art, Music and Science",
"id": "https://citeseerx.ist.psu.edu/viewdoc/summary?doi_x61_10.1.1.72.1340",
"issued": {
"date-parts": [
[
2005
]
]
},
"page": "47-56",
"title": "The Euclidean algorithm generates traditional musical rhythms",
"type": "paper-conference"
}
},
"https://webaudioconf.com/posts/2021_8/": {
"fetched": "2022-04-24T21:14:10.409Z",
"bibtex": [
"",
"@misc{noauthor_wac_nodate,",
" title = {{WAC} {\\textbar} {Glicol}: {A} {Graph}-oriented {Live} {Coding} {Language} {Developed} with {Rust}, {WebAssembly} and {AudioWorklet}},",
" url = {https://webaudioconf.com/posts/2021_8/},",
" urldate = {2022-04-24},",
" journal = {webaudioconf.com},",
"}",
""
],
"csl": {
"URL": "https://webaudioconf.com/posts/2021_8/",
"accessed": {
"date-parts": [
[
2022,
4,
24
]
]
},
"container-title": "webaudioconf.com",
"id": "https://webaudioconf.com/posts/2021_8/",
"title": "WAC Glicol: A Graph-oriented Live Coding Language Developed with Rust, WebAssembly and AudioWorklet",
"title-short": "WAC Glicol",
"type": ""
}
},
"https://webaudioconf.com/posts/2019_38/": {
"fetched": "2022-04-24T21:14:46.954Z",
"bibtex": [
"",
"@misc{noauthor_wac_nodate,",
" title = {{WAC} {\\textbar} {FAUST} online {IDE}: dynamically compile and publish {FAUST} code as {WebAudio} {Plugins}},",
" url = {https://webaudioconf.com/posts/2019_38/},",
" urldate = {2022-04-24},",
" journal = {webaudioconf.com},",
"}",
""
],
"csl": {
"URL": "https://webaudioconf.com/posts/2019_38/",
"accessed": {
"date-parts": [
[
2022,
4,
24
]
]
},
"container-title": "webaudioconf.com",
"id": "https://webaudioconf.com/posts/2019_38/",
"title": "WAC FAUST online IDE: Dynamically compile and publish FAUST code as WebAudio Plugins",
"title-short": "WAC FAUST online IDE",
"type": ""
}
},
"https://strudel.tidalcycles.org": {
"fetched": "2022-04-24T21:14:47.822Z",
"bibtex": [
"",
"@misc{noauthor_strudel_nodate,",
" title = {Strudel {REPL}},",
" url = {https://strudel.tidalcycles.org/},",
" abstract = {Strudel REPL},",
" urldate = {2022-04-24},",
" journal = {strudel.tidalcycles.org},",
"}",
""
],
"csl": {
"URL": "https://strudel.tidalcycles.org/",
"abstract": "Strudel REPL",
"accessed": {
"date-parts": [
[
2022,
4,
24
]
]
},
"container-title": "strudel.tidalcycles.org",
"id": "https://strudel.tidalcycles.org",
"title": "Strudel REPL",
"type": ""
}
},
"https://hydra.ojack.xyz/docs/#/": {
"fetched": "2022-04-25T09:03:25.132Z",
"bibtex": [
"",
"@misc{noauthor_hydra_nodate,",
" title = {Hydra},",
" url = {https://hydra.ojack.xyz/docs/#/},",
" abstract = {Description},",
" urldate = {2022-04-25},",
" journal = {hydra.ojack.xyz},",
"}",
""
],
"csl": {
"URL": "https://hydra.ojack.xyz/docs/#/",
"abstract": "Description",
"accessed": {
"date-parts": [
[
2022,
4,
25
]
]
},
"container-title": "hydra.ojack.xyz",
"id": "https://hydra.ojack.xyz/docs/_x35_/",
"title": "Hydra",
"type": ""
}
},
"https://mikesol.github.io/purescript-wags/": {
"fetched": "2022-04-25T09:03:26.456Z",
"bibtex": [
"",
"@misc{noauthor_wags_nodate,",
" title = {Wags documentation},",
" url = {https://mikesol.github.io/purescript-wags/},",
" urldate = {2022-04-25},",
" journal = {mikesol.github.io},",
"}",
""
],
"csl": {
"URL": "https://mikesol.github.io/purescript-wags/",
"accessed": {
"date-parts": [
[
2022,
4,
25
]
]
},
"container-title": "mikesol.github.io",
"id": "https://mikesol.github.io/purescript-wags/",
"title": "Wags documentation",
"type": ""
}
},
"https://github.com/tidalcycles/strudel": {
"fetched": "2022-04-25T09:15:32.518Z",
"bibtex": [
"",
"@misc{noauthor_strudel_2022,",
" title = {strudel},",
" copyright = {GPL-3.0},",
" url = {https://github.com/tidalcycles/strudel},",
" abstract = {Experimental port of tidalcycles to Javascript},",
" urldate = {2022-04-25},",
" publisher = {TidalCycles},",
" month = apr,",
" year = {2022},",
" note = {original-date: 2022-01-22T20:24:35Z},",
" keywords = {javascript, livecoding, tidal, tidalcycles, algorave, algorithmic-patterns},",
"}",
""
],
"csl": {
"URL": "https://github.com/tidalcycles/strudel",
"abstract": "Experimental port of tidalcycles to Javascript",
"accessed": {
"date-parts": [
[
2022,
4,
25
]
]
},
"id": "https://github.com/tidalcycles/strudel",
"issued": {
"date-parts": [
[
2022,
4
]
]
},
"keyword": "javascript, livecoding, tidal, tidalcycles, algorave, algorithmic-patterns",
"note": "original-date: 2022-01-22T20:24:35Z",
"publisher": "TidalCycles",
"title": "Strudel",
"type": ""
}
}
}
}
File diff suppressed because one or more lines are too long
+68 -406
View File
@@ -1,354 +1,7 @@
---
date: 2022-04-15
references:
- abstract: In this artist statement, I will discuss the tension between
source code as an interactive system for performers and source code
as information and entertainment for audiences in live-coding
performances. I then describe augmentations I developed for the
presentation of source code in the live-coding environment Gibber,
including animations and annotations that visually reveal aspects of
system state during performances. I briefly describe audience
responses to these techniques and, more importantly, how they are
critical to my own artistic practice.
accessed:
date-parts:
- - 2022
- 3
- 24
author:
- family: Roberts
given: Charles
container-title: International Journal of Performance Arts and Digital
Media
DOI: 10.1080/14794713.2016.1227602
id: "https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20"
ISSN: 1479-4713
issue: 2
issued:
date-parts:
- - 2016
- 7
keyword: Live coding, psychology of programming, notation, audiences,
algorithms
page: 201-206
title: Code as information and code as spectacle
type: article-journal
URL: "https://doi.org/10.1080/14794713.2016.1227602"
volume: 12
- abstract: The TidalCycles (or Tidal for short) live coding environment
has been developed since around 2009, via several rewrites of its
core representation. Rather than having fixed goals, this
development has been guided by use, motivated by the open aim to
make music. This development process can be seen as a long-form
improvisation, with insights into the nature of Tidal gained through
the process of writing it, feeding back to guide the next steps of
development. This brings the worrying thought that key insights will
have been missed along this development journey, that would
otherwise have lead to very different software. Indeed participants
at beginners' workshops that I have lead or co-lead have often asked
questions without good answers, because they made deficiencies or
missing features in the software clear. It is well known that a
beginner's mind is able to see much that an expert has become blind
to. Running workshops are an excellent way to find new development
ideas, but the present paper explores a different technique -- the
rewrite.
accessed:
date-parts:
- - 2022
- 3
- 24
id: "https://zenodo.org/record/5788732"
issued:
date-parts:
- - 2021
- 12
keyword: live coding, algorithmic pattern, tidalcycles, haskell,
python
publisher-place: Valdivia, Chile
title: Alternate Timelines for TidalCycles
URL: "https://zenodo.org/record/5788732"
- abstract: A JavaScript dialect of its mini-notation for pattern is
created, enabling easy integration with creative coding tools and an
accompanying technique for visually annotating the playback of
TidalCycles patterns over time. TidalCycles has rapidly become the
most popular system for many styles of live coding performance, in
particular Algoraves. We created a JavaScript dialect of its
mini-notation for pattern, enabling easy integration with creative
coding tools. Our research pairs a formalism describing the
mini-notation with a small JavaScript library for generating events
over time; this library is suitable for generating events inside of
an AudioWorkletProcessor thread and for assisting with scheduling in
JavaScript environments more generally. We describe integrating the
library into the two live coding systems, Gibber and Hydra, and
discuss an accompanying technique for visually annotating the
playback of TidalCycles patterns over time.
accessed:
date-parts:
- - 2022
- 4
- 12
author:
- family: Roberts
given: Charles
container-title: www.semanticscholar.org
id: "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42"
issued:
date-parts:
- - 2019
title: Bringing the TidalCycles Mini-Notation to the Browser
URL: "https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42"
- abstract: In this paper we introduce "version zero" of TidalVortex, an
alternative implementation of the TidalCycles live coding system,
using the Python programming language.  This is open-ended work,
exploring what happens when we try to extract the 'essence' of a
system like TidalCycles and translate it into another programming
language, while taking advantage of the affordance of its new host.
First, we review the substantial prior art in porting TidalCycles,
and in representing musical patterns in Python. We then compare
equivalent patterns written in Haskell (TidalCycles) and Python
(TidalVortex), and relate implementation details of how functional
reactive paradigms have translated from the pure functional,
strongly typed Haskell to the more multi-paradigm, dynamically typed
Python. Finally, we conclude with reflections and generalisable
outcomes.
accessed:
date-parts:
- - 2022
- 4
- 14
id: "https://zenodo.org/record/6456380"
issued:
date-parts:
- - 2022
- 4
publisher-place: Limerick, Ireland
title: TidalVortex Zero
URL: "https://zenodo.org/record/6456380"
- abstract: This paper brings together two main perspectives on
algorithmic pattern. First, the writing of musical patterns in live
coding performance, and second, the weaving of patterns in textiles.
In both cases, algorithmic pattern is an interface between the human
and the outcome, where small changes have far-reaching impact on the
results. By bringing contemporary live coding and ancient textile
approaches together, we reach a common view of pattern as
algorithmic movement (e.g. looping, shifting, reflecting,
interfering) in the making of things. This works beyond the usual
definition of pattern used in musical interfaces, of mere repeating
sequences. We conclude by considering the place of algorithmic
pattern in a wider activity of making.
accessed:
date-parts:
- - 2022
- 4
- 15
id: "https://zenodo.org/record/4299661"
issued:
date-parts:
- - 2020
- 7
keyword: pattern, tidalcycles, algorithmic music, textiles, live
coding, algorave
publisher-place: Birmingham UK
title: Algorithmic Pattern
URL: "https://zenodo.org/record/4299661"
- accessed:
date-parts:
- - 2022
- 4
- 15
author:
- family: Charlie
given: Roberts
- family: Joann
given: Kuchera-Morin
container-title: International Computer Music Conference Proceedings
id: "https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/--gibber-live-coding-audio-in-the-browser?page_x61_root;size_x61_150;view_x61_text"
ISSN: 2223-3881
issued:
date-parts:
- - 2012
title: "GIBBER: LIVE CODING AUDIO IN THE BROWSER"
title-short: GIBBER
type: article-journal
URL: "https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/%E2%80%93gibber-live-coding-audio-in-the-browser?page=root;size=150;view=text"
volume: 2012
- abstract: Estuary is a browser-based collaborative projectional
editing environment built on top of the popular TidalCycles language
for the live coding of musical pattern that includes a strict form
of structure editing, a click-only border-free approach to interface
design, and explicit notations to modulate the liveness of different
parts of the code. This paper describes the initial design and
development of Estuary, a browser-based collaborative projectional
editing environment built on top of the popular TidalCycles language
for the live coding of musical pattern. Key features of Estuary
include a strict form of structure editing (making syntactical
errors impossible), a click-only border-free approach to interface
design, explicit notations to modulate the liveness of different
parts of the code, and a server-based network collaboration system
that can be used for many simultaneous collaborative live coding
performances, as well as to present different views of the same live
coding activity. Estuary has been developed using Reflex-DOM, a
Haskell-based framework for web development whose strictness
promises robustness and security advantages.
accessed:
date-parts:
- - 2022
- 4
- 15
author:
- family: Ogborn
given: David
- family: Beverley
given: J.
container-title: www.semanticscholar.org
id: "https://www.semanticscholar.org/paper/Estuary_x37_3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b"
issued:
date-parts:
- - 2017
title: "Estuary: Browser-based Collaborative Projectional Live Coding
of Musical Patterns"
title-short: Estuary
URL: "https://www.semanticscholar.org/paper/Estuary%3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b"
- abstract: This is an improvised, from-scratch live coding performance.
The NIME interface which this performance showcases is the new
Feedfoward editor for the TidalCycles live coding environment.
Feedforward is written in Haskell using the ncurses library for
terminal-based user interfaces. It runs on low-powered hardware
including the Raspberry Pi Zero, with formative testing of
prototypes conducted with several groups of children between the
ages of 8 and 14. Feedforward has a number of features designed to
support improvised, multi-pattern live coding. Individual Tidal
patterns are addressable with hotkeys for fast mute and unmuting.
Each pattern has a stereo VU meter, to aid the quick matching of
sound to pattern within a mix. In addition, TidalCycles has been
extended to store context with each event, so that source code
positions in its polyrhythmic sequence mini-notation are tracked.
This allows steps to be highlighted in the source code when- ever
they are active. This works even when Tidal combinators have been
applied to manipulate the timeline. Formal evaluation has yet to
take place, but this feature appears to support learning of how
pattern manipulations work in Tidal. Feedforward and TidalCycles is
free/open source software under a GPL licence version 3.0.
accessed:
date-parts:
- - 2022
- 4
- 15
id: "https://zenodo.org/record/6353969"
issued:
date-parts:
- - 2020
- 7
publisher-place: Birmingham
title: Feedforward
URL: "https://zenodo.org/record/6353969"
- abstract: The Euclidean algorithm (which comes down to us from
Euclid's Elements) computes the greatest common divisor of two given
integers. It is shown here that the structure of the Euclidean
algorithm may be used to automatically generate, very efficiently, a
large family of rhythms used as timelines (rhythmic ostinatos), in
traditional world music. These rhythms, here dubbed Euclidean
rhythms, have the property that their onset patterns are distributed
as evenly as possible in a mathematically precise sense, and optimal
manner. Euclidean rhythms are closely related to the family of Aksak
rhythms studied by ethnomusicologists, and occur in a wide variety
of other disciplines as well. For example they characterize
algorithms for drawing digital straight lines in computer graphics,
as well as algorithms for calculating leap years in calendar design.
Euclidean rhythms also find application in nuclear physics
accelerators and in computer science, and are closely related to
several families of words and sequences of interest in the study of
the combinatorics of words, such as mechanical words, Sturmian
words, two-distance sequences, and Euclidean strings, to which the
Euclidean rhythms are compared. 1.
accessed:
date-parts:
- - 2022
- 4
- 24
author:
- family: Toussaint
given: Godfried
container-title: "In Proceedings of BRIDGES: Mathematical Connections
in Art, Music and Science"
id: "https://citeseerx.ist.psu.edu/viewdoc/summary?doi_x61_10.1.1.72.1340"
issued:
date-parts:
- - 2005
page: 47-56
title: The Euclidean algorithm generates traditional musical rhythms
type: paper-conference
URL: "https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.1340"
- accessed:
date-parts:
- - 2022
- 4
- 24
container-title: webaudioconf.com
id: "https://webaudioconf.com/posts/2021_8/"
title: "WAC Glicol: A Graph-oriented Live Coding Language Developed
with Rust, WebAssembly and AudioWorklet"
title-short: WAC Glicol
URL: "https://webaudioconf.com/posts/2021_8/"
- accessed:
date-parts:
- - 2022
- 4
- 24
container-title: webaudioconf.com
id: "https://webaudioconf.com/posts/2019_38/"
title: "WAC FAUST online IDE: Dynamically compile and publish FAUST
code as WebAudio Plugins"
title-short: WAC FAUST online IDE
URL: "https://webaudioconf.com/posts/2019_38/"
- abstract: Strudel REPL
accessed:
date-parts:
- - 2022
- 4
- 24
container-title: strudel.tidalcycles.org
id: "https://strudel.tidalcycles.org"
title: Strudel REPL
URL: "https://strudel.tidalcycles.org/"
- abstract: Description
accessed:
date-parts:
- - 2022
- 4
- 25
container-title: hydra.ojack.xyz
id: "https://hydra.ojack.xyz/docs/\\_x35\\_/"
title: Hydra
URL: "https://hydra.ojack.xyz/docs/#/"
- accessed:
date-parts:
- - 2022
- 4
- 25
container-title: mikesol.github.io
id: "https://mikesol.github.io/purescript-wags/"
title: Wags documentation
URL: "https://mikesol.github.io/purescript-wags/"
- abstract: Experimental port of tidalcycles to Javascript
accessed:
date-parts:
- - 2022
- 4
- 25
id: "https://github.com/tidalcycles/strudel"
issued:
date-parts:
- - 2022
- 4
keyword: javascript, livecoding, tidal, tidalcycles, algorave,
algorithmic-patterns
note: "original-date: 2022-01-22T20:24:35Z"
publisher: TidalCycles
title: Strudel
URL: "https://github.com/tidalcycles/strudel"
bibliography: citations.json
date: 2022-06-24
title: "Strudel: Algorithmic Patterns for the Web"
url2cite: all-links
---
# Introduction
@@ -358,9 +11,9 @@ alternative implementation of the Tidal (or 'TidalCycles') live coding
system, using the JavaScript programming language. Strudel is an attempt
to make live coding more accessible, by creating a system that runs
entirely in the browser, while opening Tidal's approach to algorithmic
patterns [@https://zenodo.org/record/4299661] up to modern audio/visual
web technologies. The Strudel REPL is a live code editor dedicated to
manipulating strudel patterns while they play, with builtin visual
patterns [@mcleanAlgorithmicPattern2020a] up to modern audio/visual web
technologies. The Strudel REPL is a live code editor dedicated to
manipulating Strudel patterns while they play, with builtin visual
feedback. While Strudel is written in JavaScript, the API is optimized
for simplicity and readability by applying code transformations on the
syntax tree level, allowing language operations that would otherwise be
@@ -369,13 +22,11 @@ including Tone.js, Web Audio nodes, OSC (Open Sound Control) messages,
Web Serial and Web MIDI. The project is split into multiple packages,
allowing granular reuse in other applications. Apart from TidalCycles,
Strudel draws inspiration from many prior existing projects like
TidalVortex [@https://zenodo.org/record/6456380], Gibber
[@{https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/gibber-live-coding-audio-in-the-browser?page_x61_root;size_x61_150;view_x61_text}],
Estuary
[@https://www.semanticscholar.org/paper/Estuary_x37_3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b],
Hydra [@{https://hydra.ojack.xyz/docs/_x35_/}], Wags
[@{https://mikesol.github.io/purescript-wags/}] and Feedforward
[@https://zenodo.org/record/6353969].
TidalVortex [@mcleanTidalVortexZero2022], Gibber
[@robertsGibberLiveCoding2012], Estuary
[@ogbornEstuaryBrowserbasedCollaborative2017], Hydra [@jackHydra2022],
Ocarina [@solomonPurescriptocarina2022] and Feedforward
[@mcleanFeedforward2020].
# Porting from Haskell
@@ -387,12 +38,12 @@ with a dynamic type system. Because Tidal leans heavily on many of
Haskell's more unique features, it was not always clear that it could
meaningfully be ported to a multi-paradigm scripting language. However,
this already proved to be the case with an earlier port to Python
\[TidalVortex; @https://zenodo.org/record/6456380\], and we have now
\[TidalVortex; @mcleanTidalVortexZero2022\], and we have now
successfully implemented Tidal's pure functional representation of
patterns in Strudel, including partial application, and functor,
applicative and monad structures. Over the past few months since the
project started in January 2022, a large part of Tidal's functionality
has already been ported, including it's mini-notation for polymetric
has already been ported, including its mini-notation for polymetric
sequences, and a large part of its library of pattern manipulations. The
result is a terse and highly composable system, where just about
everything is a pattern, that may be transformed and combined with other
@@ -478,20 +129,53 @@ This line could also be expressed without mini notation:
Here is a short description of all the functions used:
- slowcat: play elements sequentially, where each lasts one cycle
- brackets: elements inside brackets are divided equally over the time
of their parent
- euclid(p, s, o): place p pulses evenly over s steps, with offset o
[@https://citeseerx.ist.psu.edu/viewdoc/summary?doi_x61_10.1.1.72.1340]
- fast(n): speed up by n. `g3.fast(2)` will play g3 two times.
- off(n, f): copy each event, offset it by n cycles and apply function
f
- legato(n): multiply duration of event with n
- echo(t, n, v): copy each event t times, with n cycles in between
- `slowcat`: play elements sequentially, where each lasts one cycle
- `brackets`: elements inside brackets are divided equally over the
time of their parent
- `euclid(p, s, o)`: place p pulses evenly over s steps, with offset o
[@toussaintEuclideanAlgorithmGenerates2005]
- `fast(n)`: speed up by n. `g3.fast(2)` will play g3 two times.
- `off(n, f)`: copy each event, offset it by n cycles and apply
function f
- `legato(n)`: multiply duration of event with n
- `echo(t, n, v)`: copy each event t times, with n cycles in between
each copy, decreasing velocity by v
- tone(instrument): play back each event with the given Tone.js
- `tone(instrument)`: play back each event with the given Tone.js
instrument
- pianoroll(): visualize events as midi notes in a pianoroll
- `pianoroll()`: visualize events as midi notes in a pianoroll
# Ways to make Sound
To generate sound, Strudel supports different outputs:
- Tone.js
- Web Audio API
- WebDirt, a js recreation of Tidal's *Dirt* sample engine
- OSC via osc-js
- MIDI via WebMIDI
Tone.js proved to be limited for the use case of Strudel, where each
individual event could potentially have a completely different audio
graph. While the Web Audio API takes a *fire-and-forget* approach,
creating a lot of Tone.js instruments and effects causes performance
issues quickly. For that reason, we chose to search for alternatives.
Strudel's Web Audio API output creates a new audio graph for each event.
It currently supports basic oscillators, sample playback, envelopes,
filters and an experimental support for soundfonts.
WebDirt [@ogbornDktr0WebDirt2022] was created as part of the Estuary
Live Coding System [@ogbornEstuaryBrowserbasedCollaborative2017], and
proved to be a solid choice for handling samples in Strudel as well.
Using OSC, it is possible to send messages to SuperDirt
[@SuperDirt2022], which is what Tidal does to generate sound. The
downside of using OSC is that it requires the user to install
SuperCollider and its sc3plugins library, which can be difficult.
The MIDI output can be used to send MIDI messages to either external
instruments or to other programs on the same device. Web MIDI is
currently only supported on Chromium-based browsers.
# Future Outlook
@@ -502,45 +186,23 @@ general guiding principles, Strudel aims to be
2. consistent with Tidal's approach to pattern
3. modular and extensible
The main accessibility advantage over Tidal is the zero install browser
environment. It is not yet accessible to screen reader users, but will
be soon with the integration of the CodeMirror 6 editor. While Strudel
can control Tidal's SuperDirt audio system via OSC, it requires the user
to install SuperCollider and its sc3plugins library, which can be
difficult. Without SuperDirt, Strudel is able to output sound itself via
Tone.js, however this is limited both in terms of available features and
runtime performance. For the future, it is planned to integrate
alternative sound engines such as glicol
[@{https://webaudioconf.com/posts/2021_8/}] and faust
[@{https://webaudioconf.com/posts/2019_38/}]. To improve compatibility
with Tidal, more Tidal functions are planned to be ported, as well as
full compatibility with SuperDirt. Besides sound, other ways to render
events are being explored, such as graphical, and choreographic output.
We are also looking into alternative ways of editing patterns, including
For the future, it is planned to integrate alternative sound engines
such as Glicol [@lanChaosprintGlicol2022] and Faust
[@FaustProgrammingLanguage2022]. To improve compatibility with Tidal,
more Tidal functions are planned to be ported, as well as full
compatibility with SuperDirt. Besides sound, other ways to render events
are being explored, such as graphical, and choreographic output. We are
also looking into alternative ways of editing patterns, including
multi-user editing for network music, parsing a novel syntax to escape
the constraints of javascript, and developing hardware/e-textile
interfaces.
# Links
The Strudel REPL is available at [https://strudel.tidalcycles.org
[@https://strudel.tidalcycles.org]](https://strudel.tidalcycles.org){.uri
cite-meta="{\"URL\":\"https://strudel.tidalcycles.org/\",\"abstract\":\"Strudel REPL\",\"accessed\":{\"date-parts\":[[2022,4,24]]},\"container-title\":\"strudel.tidalcycles.org\",\"id\":\"https://strudel.tidalcycles.org\",\"title\":\"Strudel REPL\",\"type\":\"\"}"},
The Strudel REPL is available at <https://strudel.tidalcycles.org>,
including an interactive tutorial. The repository is at
[https://github.com/tidalcycles/strudel
[@https://github.com/tidalcycles/strudel]](https://github.com/tidalcycles/strudel){.uri
cite-meta="{\"URL\":\"https://github.com/tidalcycles/strudel\",\"abstract\":\"Experimental port of tidalcycles to Javascript\",\"accessed\":{\"date-parts\":[[2022,4,25]]},\"id\":\"https://github.com/tidalcycles/strudel\",\"issued\":{\"date-parts\":[[2022,4]]},\"keyword\":\"javascript, livecoding, tidal, tidalcycles, algorave, algorithmic-patterns\",\"note\":\"original-date: 2022-01-22T20:24:35Z\",\"publisher\":\"TidalCycles\",\"title\":\"Strudel\",\"type\":\"\"}"},
all the code is open source under the GPL-3.0 License.
# Technical requirements
- Space for one laptop + small audio interface (20 cm x 20cm), with
mains power.
- Stereo sound system, either placed behind presenter (for direct
monitoring) or with additional stereo monitors.
- Audio from audio interface: stereo pair 6,3mm jack outputs
(balanced)
- Projector / screen (HDMI.)
<https://github.com/tidalcycles/strudel>, all the code is open source
under the GPL-3.0 License.
# Acknowledgments
@@ -549,4 +211,4 @@ free/open source software communities for inspiration and support. Alex
McLean's work on this project is supported by a UKRI Future Leaders
Fellowship \[grant number MR/V025260/1\].
# References
# References {#references .unnumbered}
+38 -41
View File
@@ -1,16 +1,16 @@
---
title: 'Strudel: Algorithmic Patterns for the Web'
date: '2022-04-15'
url2cite: all-links
date: '2022-06-24'
bibliography: citations.json
---
# Introduction
This paper introduces Strudel (or sometimes 'StrudelCycles'), an alternative implementation of the Tidal (or 'TidalCycles') live coding system, using the JavaScript programming language. Strudel is an attempt to make live coding more accessible, by creating a system that runs entirely in the browser, while opening Tidal's approach to algorithmic patterns [@algorithmicpattern] up to modern audio/visual web technologies. The Strudel REPL is a live code editor dedicated to manipulating strudel patterns while they play, with builtin visual feedback. While Strudel is written in JavaScript, the API is optimized for simplicity and readability by applying code transformations on the syntax tree level, allowing language operations that would otherwise be impossible. The application supports multiple ways to output sound, including Tone.js, Web Audio nodes, OSC (Open Sound Control) messages, Web Serial and Web MIDI. The project is split into multiple packages, allowing granular reuse in other applications. Apart from TidalCycles, Strudel draws inspiration from many prior existing projects like TidalVortex [@tidalvortex], Gibber [@gibber], Estuary [@estuary], Hydra [@hydra], Wags [@wags] and Feedforward [@feedforward].
This paper introduces Strudel (or sometimes 'StrudelCycles'), an alternative implementation of the Tidal (or 'TidalCycles') live coding system, using the JavaScript programming language. Strudel is an attempt to make live coding more accessible, by creating a system that runs entirely in the browser, while opening Tidal's approach to algorithmic patterns [@mcleanAlgorithmicPattern2020a] up to modern audio/visual web technologies. The Strudel REPL is a live code editor dedicated to manipulating Strudel patterns while they play, with builtin visual feedback. While Strudel is written in JavaScript, the API is optimized for simplicity and readability by applying code transformations on the syntax tree level, allowing language operations that would otherwise be impossible. The application supports multiple ways to output sound, including Tone.js, Web Audio nodes, OSC (Open Sound Control) messages, Web Serial and Web MIDI. The project is split into multiple packages, allowing granular reuse in other applications. Apart from TidalCycles, Strudel draws inspiration from many prior existing projects like TidalVortex [@mcleanTidalVortexZero2022], Gibber [@robertsGibberLiveCoding2012], Estuary [@ogbornEstuaryBrowserbasedCollaborative2017], Hydra [@jackHydra2022], Ocarina [@solomonPurescriptocarina2022] and Feedforward [@mcleanFeedforward2020].
# Porting from Haskell
The original Tidal is implemented as a domain specific language (DSL), embedded in the Haskell pure functional programming language, taking advantage of Haskell's terse syntax and advanced, 'strong' type system. Javascript on the other hand, is a multi-paradigm programming language, with a dynamic type system. Because Tidal leans heavily on many of Haskell's more unique features, it was not always clear that it could meaningfully be ported to a multi-paradigm scripting language. However, this already proved to be the case with an earlier port to Python [TidalVortex; @tidalvortex], and we have now successfully implemented Tidal's pure functional representation of patterns in Strudel, including partial application, and functor, applicative and monad structures. Over the past few months since the project started in January 2022, a large part of Tidal's functionality has already been ported, including it's mini-notation for polymetric sequences, and a large part of its library of pattern manipulations. The result is a terse and highly composable system, where just about everything is a pattern, that may be transformed and combined with other patterns in a myriad of ways.
The original Tidal is implemented as a domain specific language (DSL), embedded in the Haskell pure functional programming language, taking advantage of Haskell's terse syntax and advanced, 'strong' type system. Javascript on the other hand, is a multi-paradigm programming language, with a dynamic type system. Because Tidal leans heavily on many of Haskell's more unique features, it was not always clear that it could meaningfully be ported to a multi-paradigm scripting language. However, this already proved to be the case with an earlier port to Python [TidalVortex; @mcleanTidalVortexZero2022], and we have now successfully implemented Tidal's pure functional representation of patterns in Strudel, including partial application, and functor, applicative and monad structures. Over the past few months since the project started in January 2022, a large part of Tidal's functionality has already been ported, including its mini-notation for polymetric sequences, and a large part of its library of pattern manipulations. The result is a terse and highly composable system, where just about everything is a pattern, that may be transformed and combined with other patterns in a myriad of ways.
# Representing Patterns
@@ -81,15 +81,39 @@ slowcat(d3, f3, [a3, c3].euclid(3, 4, 1), g3.fast(2))
Here is a short description of all the functions used:
- slowcat: play elements sequentially, where each lasts one cycle
- brackets: elements inside brackets are divided equally over the time of their parent
- euclid(p, s, o): place p pulses evenly over s steps, with offset o [@godfried]
- fast(n): speed up by n. `g3.fast(2)` will play g3 two times.
- off(n, f): copy each event, offset it by n cycles and apply function f
- legato(n): multiply duration of event with n
- echo(t, n, v): copy each event t times, with n cycles in between each copy, decreasing velocity by v
- tone(instrument): play back each event with the given Tone.js instrument
- pianoroll(): visualize events as midi notes in a pianoroll
- `slowcat`: play elements sequentially, where each lasts one cycle
- `brackets`: elements inside brackets are divided equally over the time of their parent
- `euclid(p, s, o)`: place p pulses evenly over s steps, with offset o [@toussaintEuclideanAlgorithmGenerates2005]
- `fast(n)`: speed up by n. `g3.fast(2)` will play g3 two times.
- `off(n, f)`: copy each event, offset it by n cycles and apply function f
- `legato(n)`: multiply duration of event with n
- `echo(t, n, v)`: copy each event t times, with n cycles in between each copy, decreasing velocity by v
- `tone(instrument)`: play back each event with the given Tone.js instrument
- `pianoroll()`: visualize events as midi notes in a pianoroll
# Ways to make Sound
To generate sound, Strudel supports different outputs:
- Tone.js
- Web Audio API
- WebDirt, a js recreation of Tidal's *Dirt* sample engine
- OSC via osc-js
- MIDI via WebMIDI
Tone.js proved to be limited for the use case of Strudel, where each individual event could potentially have a completely different audio graph.
While the Web Audio API takes a *fire-and-forget* approach, creating a lot of Tone.js instruments and effects causes performance issues quickly. For that reason, we chose to search for alternatives.
Strudel's Web Audio API output creates a new audio graph for each event. It currently supports basic oscillators, sample playback, envelopes, filters and
an experimental support for soundfonts.
WebDirt [@ogbornDktr0WebDirt2022] was created as part of the Estuary Live Coding System [@ogbornEstuaryBrowserbasedCollaborative2017], and proved to be a solid choice for handling samples in Strudel as well.
Using OSC, it is possible to send messages to SuperDirt [@SuperDirt2022], which is what Tidal does to generate sound.
The downside of using OSC is that it requires the user to install SuperCollider and its sc3plugins library, which can be difficult.
The MIDI output can be used to send MIDI messages to either external instruments or to other programs on the same device.
Web MIDI is currently only supported on Chromium-based browsers.
# Future Outlook
@@ -99,42 +123,15 @@ The project is still young, with many features on the horizon. As general guidin
2. consistent with Tidal's approach to pattern
3. modular and extensible
The main accessibility advantage over Tidal is the zero install browser environment. It is not yet accessible to screen reader users, but will be soon with the integration of the CodeMirror 6 editor. While Strudel can control Tidal's SuperDirt audio system via OSC, it requires the user to install SuperCollider and its sc3plugins library, which can be difficult. Without SuperDirt, Strudel is able to output sound itself via Tone.js, however this is limited both in terms of available features and runtime performance. For the future, it is planned to integrate alternative sound engines such as glicol [@glicol] and faust [@faust]. To improve compatibility with Tidal, more Tidal functions are planned to be ported, as well as full compatibility with SuperDirt. Besides sound, other ways to render events are being explored, such as graphical, and choreographic output. We are also looking into alternative ways of editing patterns, including multi-user editing for network music, parsing a novel syntax to escape the constraints of javascript, and developing hardware/e-textile interfaces.
For the future, it is planned to integrate alternative sound engines such as Glicol [@lanChaosprintGlicol2022] and Faust [@FaustProgrammingLanguage2022]. To improve compatibility with Tidal, more Tidal functions are planned to be ported, as well as full compatibility with SuperDirt. Besides sound, other ways to render events are being explored, such as graphical, and choreographic output. We are also looking into alternative ways of editing patterns, including multi-user editing for network music, parsing a novel syntax to escape the constraints of javascript, and developing hardware/e-textile interfaces.
# Links
The Strudel REPL is available at <https://strudel.tidalcycles.org>, including an interactive tutorial.
The repository is at <https://github.com/tidalcycles/strudel>, all the code is open source under the GPL-3.0 License.
# Technical requirements
- Space for one laptop + small audio interface (20 cm x 20cm), with mains power.
- Stereo sound system, either placed behind presenter (for direct monitoring) or with additional stereo monitors.
- Audio from audio interface: stereo pair 6,3mm jack outputs (balanced)
- Projector / screen (HDMI.)
# Acknowledgments
Thanks to the Strudel and wider Tidal, live coding, webaudio and free/open source software communities for inspiration and support. Alex McLean's work on this project is supported by a UKRI Future Leaders Fellowship [grant number MR/V025260/1].
# References
[@roberts2016]: https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode=rpdm20
[@gibber]: https://quod.lib.umich.edu/i/icmc/bbp2372.2012.011/2/--gibber-live-coding-audio-in-the-browser?page=root;size=150;view=text
[@alternate-timelines]: https://zenodo.org/record/5788732
[@tidal.pegjs]: https://www.semanticscholar.org/paper/Bringing-the-TidalCycles-Mini-Notation-to-the-Roberts/74965efadd572ae3f40d14c633a5c8581c1b9f42
[@tidalvortex]: https://zenodo.org/record/6456380
[@estuary]: https://www.semanticscholar.org/paper/Estuary%3A-Browser-based-Collaborative-Projectional-Ogborn-Beverley/c6b5d34575d6230dfd8751ca4af8e5f6e44d916b
[@tidalcycles]: https://dl.acm.org/doi/10.1145/2633638.2633647
[@hession]: https://www.scopus.com/record/display.uri?eid=2-s2.0-84907386880&origin=inward&txGid=03307e26fba02a27bdc68bda462016f6266316467_Extending_Instruments_with_Live_Algorithms_in_a_Percussion_Code_Duo
[@spiegel]: https://www.academia.edu/664807/Manipulations_of_musical_patterns
[@bel]: https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.517.7129
[@algorithmicpattern]: https://zenodo.org/record/4299661
[@fabricating]: https://zenodo.org/record/2155745
[@cyclic-patterns]: https://zenodo.org/record/1548969
[@feedforward]: https://zenodo.org/record/6353969
[@godfried]: https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.72.1340
[@glicol]: https://webaudioconf.com/posts/2021_8/
[@faust]: https://webaudioconf.com/posts/2019_38/
[@wags]: https://mikesol.github.io/purescript-wags/
[@hydra]: https://hydra.ojack.xyz/docs/#/
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -8,10 +8,10 @@ fi
pandoc -s demo.md \
--from markdown+auto_identifiers --pdf-engine=xelatex --template tex/latex-template.tex -V colorlinks --number-sections \
--filter=pandoc-url2cite --citeproc --pdf-engine=xelatex \
--citeproc --pdf-engine=xelatex \
--dpi=300 -o demo.pdf
pandoc -s demo.md --filter bin/code-filter.py --filter=pandoc-url2cite \
pandoc -s demo.md --filter bin/code-filter.py \
--citeproc \
-t markdown-citations -t markdown-fenced_divs \
-o demo-preprocessed.md
+3
View File
@@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?
oldtunes.mjs
public/samples/EMU World

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