diff --git a/LICENSE b/LICENSE index f288702d..be3f7b28 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies @@ -7,17 +7,15 @@ Preamble - The GNU General Public License is a free, copyleft license for -software and other kinds of works. + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to +our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you @@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. The precise terms and conditions for copying, distribution and modification follow. @@ -72,7 +60,7 @@ modification follow. 0. Definitions. - "This License" refers to version 3 of the GNU General Public License. + "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. @@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single +under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General +Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published +GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's +versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. @@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by + 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 General Public License for more details. + GNU Affero General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see +For more information on this, and how to apply and follow the GNU AGPL, see . - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/featurelist.md b/featurelist.md deleted file mode 100644 index 5135e511..00000000 --- a/featurelist.md +++ /dev/null @@ -1,131 +0,0 @@ -# Tidal Features in Strudel - -## Basics - -- [ ] drawLine -- [ ] setcps -- [ ] naming patterns? block based evaluation? -- [ ] once -- [x] silence -- [x] hush -- [ ] panic - -## Concatenation - -https://tidalcycles.org/docs/patternlib/tour/concatenation - -- [x] cat: is synonym to fastcat in strudel, while [in tidal, cat is slowcat](https://tidalcycles.org/docs/patternlib/tour/concatenation#cat) -- [x] fastcat -- [x] timeCat: why is this camel case? -- [ ] randcat -- [x] append: but is like fastAppend in tidal -- [ ] fastAppend -- [ ] slowAppend -- [ ] wedge -- [ ] brak -- [ ] flatpat - -## Accumulation - -- [ ] overlay => like stack? "The overlay function is similar to cat" => wrong? -- [ ] `<>` operator (=== overlay) -- [x] stack -- [x] superimpose -- [x] layer -- [ ] steps ? -- [x] iter -- [x] iter' = iterBack - -## Alteration - -- [ ] range, rangex -- [ ] quantise -- [ ] ply -- [x] stutter = echo -- [ ] stripe, slowstripe -- [ ] palindrome = every(2, rev) -- [ ] trunc -- [ ] linger -- [x] chunk, chunk' -- [ ] shuffle -- [ ] scramble -- [ ] rot -- [ ] step / step' -- [ ] lindenmeyer -- [ ] spread / spreadf / fastspread -- [ ] spreadChoose / spreadr - -## conditions - -- [x] every -- [ ] every' -- [ ] whenmod -- [ ] sometimes, sometimesBy, someCycles, someCyclesBy -- [ ] choose, chooseby, wchoose, wchooseby -- [x] struct -- [x] mask -- [ ] sew -- [ ] stitch -- [ ] select, selectF -- [ ] pickF -- [ ] squeeze -- [x] euclid, euclidLegato -- [ ] euclidInv, euclidFull -- [ ] ifp - -## Time - -- [x] fast -- [x] fastGap -- [x] slow -- [ ] hurry -- [ ] compress: is this compressSpan? -- [ ] zoom -- [ ] within -- [x] off -- [ ] rotL / rotR -- [x] rev -- [x] jux -- [ ] juxBy -- [ ] swingBy / swing -- [ ] ghost -- [ ] inside / outside - -## Harmony & Melody - -- [x] scale -- [ ] scaleList -- [ ] getScale -- [ ] toScale -- [ ] chordList -- [ ] arpeggiate -- [ ] arp - -## Transitions - -- [ ] anticipate / anticipateIn -- [ ] clutch / clutchIn -- [ ] histpan -- [ ] interpolate / interpolateIn -- [ ] jump / jumpIn / jumpIn' / jumpMod -- [ ] wait / waitT -- [ ] wash / washIn -- [ ] xfade / xfadeIn - -## Sampling - -- [ ] chop -- [ ] striate / striateBy -- [ ] loopAt -- [x] segment -- [ ] discretise - -## Randomness - -- [ ] rand / irand -- [ ] perlin / perlinWith / perlin2 / perlin2With - -## Composition - -- [ ] ur -- [ ] seqP / seqPLoop diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index acce1acd..5b09766d 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -1,3 +1,9 @@ +/* +controls.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, sequence } from './pattern.mjs'; const controls = {}; diff --git a/packages/core/drawLine.mjs b/packages/core/drawLine.mjs new file mode 100644 index 00000000..0bfe458c --- /dev/null +++ b/packages/core/drawLine.mjs @@ -0,0 +1,45 @@ +/* +drawLine.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + +import Fraction, { gcd } from './fraction.mjs'; + +function drawLine(pat, chars = 60) { + let cycle = 0; + let pos = Fraction(0); + let lines = ['']; + let emptyLine = ''; // this will be the "reference" empty line, which will be copied into extra lines + while (lines[0].length < chars) { + const haps = pat.queryArc(cycle, cycle + 1); + const durations = haps.filter((hap) => hap.hasOnset()).map((hap) => hap.duration); + const charFraction = gcd(...durations); + const totalSlots = charFraction.inverse(); // number of character slots for the current cycle + lines = lines.map((line) => line + '|'); // add pipe character before each cycle + emptyLine += '|'; + for (let i = 0; i < totalSlots; i++) { + const [begin, end] = [pos, pos.add(charFraction)]; + const matches = haps.filter((hap) => hap.whole.begin.lte(begin) && hap.whole.end.gte(end)); + const missingLines = matches.length - lines.length; + if (missingLines > 0) { + lines = lines.concat(Array(missingLines).fill(emptyLine)); + } + lines = lines.map((line, i) => { + const hap = matches[i]; + if (hap) { + const isOnset = hap.whole.begin.eq(begin); + const char = isOnset ? '' + hap.value : '-'; + return line + char; + } + return line + '.'; + }); + emptyLine += '.'; + pos = pos.add(charFraction); + } + cycle++; + } + return lines.join('\n'); +} + +export default drawLine; diff --git a/packages/core/euclid.mjs b/packages/core/euclid.mjs index af98f593..4e4e3bcf 100644 --- a/packages/core/euclid.mjs +++ b/packages/core/euclid.mjs @@ -1,3 +1,9 @@ +/* +euclid.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, timeCat } from './pattern.mjs'; import bjork from 'bjork'; import { rotate } from './util.mjs'; diff --git a/packages/core/examples/canvas.html b/packages/core/examples/canvas.html index 685cc56e..736c9a22 100644 --- a/packages/core/examples/canvas.html +++ b/packages/core/examples/canvas.html @@ -27,7 +27,7 @@ const events = pattern.firstCycle(); // query first cycle events.forEach((event) => { ctx.fillStyle = event.value; - ctx.fillRect(event.whole.begin * canvas.width, 0, event.duration * canvas.width, canvas.height); + ctx.fillRect(event.whole.begin * canvas.width, 0, event.duration.valueOf() * canvas.width, canvas.height); }); } diff --git a/packages/core/fraction.mjs b/packages/core/fraction.mjs index 4fe2b12a..5204395d 100644 --- a/packages/core/fraction.mjs +++ b/packages/core/fraction.mjs @@ -1,3 +1,9 @@ +/* +fraction.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import Fraction from 'fraction.js'; import { TimeSpan } from './timespan.mjs'; @@ -72,6 +78,12 @@ const fraction = (n) => { return Fraction(n); }; +export const gcd = (...fractions) => { + return fractions.reduce((gcd, fraction) => gcd.gcd(fraction), fraction(1)); +}; + +fraction._original = Fraction; + export default fraction; // "If you concern performance, cache Fraction.js objects and pass arrays/objects.“ diff --git a/packages/core/gist.js b/packages/core/gist.js index 716f797f..67924762 100644 --- a/packages/core/gist.js +++ b/packages/core/gist.js @@ -1,3 +1,9 @@ +/* +gist.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // 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) => diff --git a/packages/core/hap.mjs b/packages/core/hap.mjs index b74649c6..4a9f3af6 100644 --- a/packages/core/hap.mjs +++ b/packages/core/hap.mjs @@ -1,3 +1,9 @@ +/* +hap.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export class Hap { /* Event class, representing a value active during the timespan @@ -23,7 +29,7 @@ export class Hap { } get duration() { - return this.whole.end.sub(this.whole.begin).valueOf(); + return this.whole.end.sub(this.whole.begin); } wholeOrPart() { diff --git a/packages/core/index.mjs b/packages/core/index.mjs index 9e7f80e3..45550191 100644 --- a/packages/core/index.mjs +++ b/packages/core/index.mjs @@ -1,3 +1,9 @@ +/* +index.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export * from './controls.mjs'; export * from './euclid.mjs'; import Fraction from './fraction.mjs'; diff --git a/packages/core/pattern.mjs b/packages/core/pattern.mjs index d6eca137..86b7619d 100644 --- a/packages/core/pattern.mjs +++ b/packages/core/pattern.mjs @@ -1,3 +1,9 @@ +/* +pattern.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import TimeSpan from './timespan.mjs'; import Fraction from './fraction.mjs'; import Hap from './hap.mjs'; @@ -5,6 +11,7 @@ import State from './state.mjs'; import { unionWithObj } from './value.mjs'; import { isNote, toMidi, compose, removeUndefineds, flatten, id, listRange, curry, mod } from './util.mjs'; +import drawLine from './drawLine.mjs'; export class Pattern { // the following functions will get patternFactories as nested functions: @@ -614,6 +621,17 @@ export class Pattern { return this._withContext((context) => ({ ...context, color })); } + log() { + return this._withEvent((e) => { + return e.setContext({ ...e.context, logs: (e.context?.logs || []).concat([e.show()]) }); + }); + } + + drawLine() { + console.log(drawLine(this)); + return this; + } + _segment(rate) { return this.struct(pure(true)._fast(rate)); } @@ -648,10 +666,6 @@ export class Pattern { return slowcatPrime(...pats); } - append(other) { - return fastcat(...[this, other]); - } - rev() { const pat = this; const query = function (state) { @@ -694,14 +708,31 @@ export class Pattern { return this.juxBy(1, func); } - // is there a different name for those in tidal? stack(...pats) { return stack(this, ...pats); } + sequence(...pats) { return sequence(this, ...pats); } + // shorthand for sequence + seq(...pats) { + return sequence(this, ...pats); + } + + cat(...pats) { + return cat(this, ...pats); + } + + fastcat(...pats) { + return fastcat(this, ...pats); + } + + slowcat(...pats) { + return slowcat(this, ...pats); + } + superimpose(...funcs) { return this.stack(...funcs.map((func) => func(this))); } @@ -864,7 +895,20 @@ Pattern.prototype.patternified = [ 'velocity', ]; // methods that create patterns, which are added to patternified Pattern methods -Pattern.prototype.factories = { pure, stack, slowcat, fastcat, cat, timeCat, sequence, polymeter, pm, polyrhythm, pr }; +Pattern.prototype.factories = { + pure, + stack, + slowcat, + fastcat, + cat, + timeCat, + sequence, + seq, + polymeter, + pm, + polyrhythm, + pr, +}; // the magic happens in Pattern constructor. Keeping this in prototype enables adding methods from the outside (e.g. see tonal.ts) // Elemental patterns @@ -892,18 +936,23 @@ export function reify(thing) { } return pure(thing); } + // Basic functions for combining patterns export function stack(...pats) { - const reified = pats.map((pat) => reify(pat)); - const query = (state) => flatten(reified.map((pat) => pat.query(state))); + // Array test here is to avoid infinite recursions.. + pats = pats.map((pat) => (Array.isArray(pat) ? sequence(...pat) : reify(pat))); + const query = (state) => flatten(pats.map((pat) => pat.query(state))); return new Pattern(query); } export function slowcat(...pats) { // Concatenation: combines a list of patterns, switching between them // successively, one per cycle. - pats = pats.map(reify); + + // Array test here is to avoid infinite recursions.. + pats = pats.map((pat) => (Array.isArray(pat) ? sequence(...pat) : reify(pat))); + const query = function (state) { const span = state.span; const pat_n = mod(span.begin.sam(), pats.length); @@ -940,7 +989,7 @@ export function fastcat(...pats) { } export function cat(...pats) { - return fastcat(...pats); + return slowcat(...pats); } export function timeCat(...timepats) { @@ -956,6 +1005,15 @@ export function timeCat(...timepats) { return stack(...pats); } +export function sequence(...pats) { + return fastcat(...pats); +} + +// shorthand for sequence +export function seq(...pats) { + return fastcat(...pats); +} + function _sequenceCount(x) { if (Array.isArray(x)) { if (x.length == 0) { @@ -969,10 +1027,6 @@ function _sequenceCount(x) { return [reify(x), 1]; } -export function sequence(...xs) { - return _sequenceCount(xs)[0]; -} - export function polymeterSteps(steps, ...args) { const seqs = args.map((a) => _sequenceCount(a)); if (seqs.length == 0) { @@ -1019,7 +1073,6 @@ export function pr(args) { } export const add = curry((a, pat) => pat.add(a)); -export const append = curry((a, pat) => pat.append(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)); diff --git a/packages/core/signal.mjs b/packages/core/signal.mjs index e96921c5..8fa12910 100644 --- a/packages/core/signal.mjs +++ b/packages/core/signal.mjs @@ -1,3 +1,9 @@ +/* +signal.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Hap } from './hap.mjs'; import { Pattern, fastcat, reify, silence, stack } from './pattern.mjs'; import Fraction from './fraction.mjs'; diff --git a/packages/core/speak.mjs b/packages/core/speak.mjs index 141ef92f..0a1b7fe3 100644 --- a/packages/core/speak.mjs +++ b/packages/core/speak.mjs @@ -1,3 +1,9 @@ +/* +speak.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, patternify2 } from './index.mjs'; const synth = window?.speechSynthesis; diff --git a/packages/core/state.mjs b/packages/core/state.mjs index 56e4fd92..db1f77ef 100644 --- a/packages/core/state.mjs +++ b/packages/core/state.mjs @@ -1,3 +1,9 @@ +/* +state.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export class State { constructor(span, controls = {}) { this.span = span; diff --git a/packages/core/test/drawLine.test.mjs b/packages/core/test/drawLine.test.mjs new file mode 100644 index 00000000..461cd2b3 --- /dev/null +++ b/packages/core/test/drawLine.test.mjs @@ -0,0 +1,56 @@ +/* +drawLine.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + +import { fastcat, stack, slowcat, silence, pure } from '../pattern.mjs'; +import { strict as assert } from 'assert'; +import drawLine from '../drawLine.mjs'; + +describe('drawLine', () => { + it('supports equal lengths', () => { + assert.equal(drawLine(fastcat(0), 4), '|0|0'); + assert.equal(drawLine(fastcat(0, 1), 4), '|01|01'); + assert.equal(drawLine(fastcat(0, 1, 2), 6), '|012|012'); + }); + it('supports unequal lengths', () => { + assert.equal(drawLine(fastcat(0, [1, 2]), 10), '|0-12|0-12'); + assert.equal(drawLine(fastcat(0, [1, 2, 3]), 10), '|0--123|0--123'); + assert.equal(drawLine(fastcat(0, 1, [2, 3]), 10), '|0-1-23|0-1-23'); + }); + it('supports unequal silence', () => { + assert.equal(drawLine(fastcat(0, silence, [1, 2]), 10), '|0-..12|0-..12'); + }); + it('supports polyrhythms', () => { + '0*2 1*3'; + assert.equal(drawLine(fastcat(pure(0).fast(2), pure(1).fast(3)), 10), '|0--0--1-1-1-'); + }); + it('supports multiple lines', () => { + assert.equal( + drawLine(fastcat(0, stack(1, 2)), 10), + `|01|01|01|01 +|.2|.2|.2|.2`, + ); + assert.equal( + drawLine(fastcat(0, 1, stack(2, 3)), 10), + `|012|012|012 +|..3|..3|..3`, + ); + assert.equal( + drawLine(fastcat(0, stack(1, 2, 3)), 10), + `|01|01|01|01 +|.2|.2|.2|.2 +|.3|.3|.3|.3`, + ); + assert.equal( + drawLine(fastcat(0, 1, stack(2, 3, 4)), 10), + `|012|012|012 +|..3|..3|..3 +|..4|..4|..4`, + ); + }); + it('supports unequal cycle lengths', () => { + assert.equal(drawLine(slowcat(0, [1, 2]), 10), `|0|12|0|12`); + }); +}); diff --git a/packages/core/test/fraction.test.mjs b/packages/core/test/fraction.test.mjs new file mode 100644 index 00000000..46e83c69 --- /dev/null +++ b/packages/core/test/fraction.test.mjs @@ -0,0 +1,15 @@ +/* +fraction.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + +import Fraction, { gcd } from '../fraction.mjs'; +import { strict as assert } from 'assert'; + +describe('gcd', () => { + it('should work', () => { + const F = Fraction._original; + assert.equal(gcd(F(1 / 6), F(1 / 4)).toFraction(), '1/12'); + }); +}); diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index 44a0bd5e..b31ed08b 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -1,3 +1,9 @@ +/* +pattern.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import Fraction from 'fraction.js'; import { deepStrictEqual, strict as assert } from 'assert'; @@ -248,6 +254,12 @@ describe('Pattern', function () { ['a', 'b', 'c'], ); }); + it('Can stack subpatterns', function () { + sameFirst( + stack('a', ['b','c']), + stack('a', sequence('b', 'c')), + ); + }); }); describe('_fast()', function () { it('Makes things faster', function () { @@ -414,6 +426,12 @@ describe('Pattern', function () { ['c'], ); }); + it ('Can cat subpatterns', () => { + sameFirst( + slowcat('a', ['b','c']).fast(4), + sequence('a', ['b', 'c']).fast(2) + ) + }) }); describe('rev()', function () { it('Can reverse things', function () { diff --git a/packages/core/test/util.test.mjs b/packages/core/test/util.test.mjs index bf402793..4a315ea8 100644 --- a/packages/core/test/util.test.mjs +++ b/packages/core/test/util.test.mjs @@ -1,3 +1,9 @@ +/* +util.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import { pure } from '../pattern.mjs'; import { isNote, tokenizeNote, toMidi, fromMidi, mod, compose, getFrequency } from '../util.mjs'; diff --git a/packages/core/test/value.test.mjs b/packages/core/test/value.test.mjs index f68ff36c..35de86b4 100644 --- a/packages/core/test/value.test.mjs +++ b/packages/core/test/value.test.mjs @@ -1,3 +1,9 @@ +/* +value.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import { map, valued, mul } from '../value.mjs'; diff --git a/packages/core/timespan.mjs b/packages/core/timespan.mjs index a55e1de8..6647b615 100644 --- a/packages/core/timespan.mjs +++ b/packages/core/timespan.mjs @@ -1,3 +1,9 @@ +/* +timespan.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import Fraction from './fraction.mjs'; export class TimeSpan { diff --git a/packages/core/util.mjs b/packages/core/util.mjs index 93072d89..a9787f00 100644 --- a/packages/core/util.mjs +++ b/packages/core/util.mjs @@ -1,3 +1,9 @@ +/* +util.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // returns true if the given string is a note export const isNote = (name) => /^[a-gA-G][#b]*[0-9]$/.test(name); export const tokenizeNote = (note) => { diff --git a/packages/core/value.mjs b/packages/core/value.mjs index 62bd4fbb..7eb89013 100644 --- a/packages/core/value.mjs +++ b/packages/core/value.mjs @@ -1,3 +1,9 @@ +/* +value.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { curry } from './util.mjs'; export function unionWithObj(a, b, func) { diff --git a/packages/eval/evaluate.mjs b/packages/eval/evaluate.mjs index d96916ab..286e855a 100644 --- a/packages/eval/evaluate.mjs +++ b/packages/eval/evaluate.mjs @@ -1,3 +1,9 @@ +/* +evaluate.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import shapeshifter from './shapeshifter.mjs'; import * as strudel from '@strudel.cycles/core'; diff --git a/packages/eval/shapeshifter.mjs b/packages/eval/shapeshifter.mjs index 20a42e17..46d7a635 100644 --- a/packages/eval/shapeshifter.mjs +++ b/packages/eval/shapeshifter.mjs @@ -1,3 +1,9 @@ +/* +shapeshifter.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + /* import { parseScriptWithLocation } from './shift-parser/index.js'; // npm module does not work in the browser import traverser from './shift-traverser/index.js'; // npm module does not work in the browser */ import { parseScriptWithLocation } from 'shift-parser'; @@ -23,6 +29,8 @@ const isNote = (name) => /^[a-gC-G][bs]?[0-9]$/.test(name); const addLocations = true; export const addMiniLocations = true; +export const minifyStrings = true; +export const wrappedAsync = true; export default (_code) => { const { code, addReturn } = wrapAsync(_code); @@ -38,18 +46,18 @@ export default (_code) => { } // replace template string `xxx` with mini(`xxx`) - if (isBackTickString(node)) { + if (minifyStrings && isBackTickString(node)) { return minifyWithLocation(node, node, ast.locations, artificialNodes); } // allows to use top level strings, which are normally directives... but we don't need directives - if (node.directives?.length === 1 && !node.statements?.length) { + if (minifyStrings && node.directives?.length === 1 && !node.statements?.length) { const str = new LiteralStringExpression({ value: node.directives[0].rawValue }); const wrapped = minifyWithLocation(str, node.directives[0], ast.locations, artificialNodes); return { ...node, directives: [], statements: [wrapped] }; } // replace double quote string "xxx" with mini('xxx') - if (isStringWithDoubleQuotes(node, ast.locations, code)) { + if (minifyStrings && isStringWithDoubleQuotes(node, ast.locations, code)) { return minifyWithLocation(node, node, ast.locations, artificialNodes); } @@ -117,7 +125,9 @@ export default (_code) => { }, }); // add return to last statement (because it's wrapped in an async function artificially) - addReturn(shifted); + if (wrappedAsync) { + addReturn(shifted); + } const generated = codegen(shifted); return generated; }; @@ -125,9 +135,11 @@ export default (_code) => { function wrapAsync(code) { // wrap code in async to make await work on top level => this will create 1 line offset to locations // this is why line offset is -1 in getLocationObject calls below - code = `(async () => { + if (wrappedAsync) { + code = `(async () => { ${code} })()`; + } const addReturn = (ast) => { const body = ast.statements[0].expression.callee.body; // actual code ast inside async function body body.statements = body.statements @@ -204,9 +216,10 @@ function hasModifierCall(parent) { parent?.type === 'StaticMemberExpression' && Object.keys(Pattern.prototype.composable).includes(parent.property) ); } +const factories = Object.keys(Pattern.prototype.factories).concat(['mini']); function isPatternFactory(node) { - return node?.type === 'CallExpression' && Object.keys(Pattern.prototype.factories).includes(node.callee.name); + return node?.type === 'CallExpression' && factories.includes(node.callee.name); } function canBeOverloaded(node) { @@ -233,9 +246,14 @@ function reifyWithLocation(literalNode, node, locations, artificialNodes) { // with this, the reified pattern can pass its location to the event, to know where to highlight when it's active function minifyWithLocation(literalNode, node, locations, artificialNodes) { const args = getLocationArguments(node, locations); + const wrapped = wrapFunction('mini', literalNode); + if (!addMiniLocations) { + artificialNodes.push(wrapped); + return wrapped; + } const withLocation = new CallExpression({ callee: new StaticMemberExpression({ - object: wrapFunction('mini', literalNode), + object: wrapped, property: 'withMiniLocation', }), arguments: args, @@ -246,17 +264,18 @@ function minifyWithLocation(literalNode, node, locations, artificialNodes) { function getLocationArguments(node, locations) { const loc = locations.get(node); + const lineOffset = wrappedAsync ? -1 : 0; return [ new ArrayExpression({ elements: [ - new LiteralNumericExpression({ value: loc.start.line - 1 }), // the minus 1 assumes the code has been wrapped in async iife + new LiteralNumericExpression({ value: loc.start.line + lineOffset }), // the minus 1 assumes the code has been wrapped in async iife new LiteralNumericExpression({ value: loc.start.column }), new LiteralNumericExpression({ value: loc.start.offset }), ], }), new ArrayExpression({ elements: [ - new LiteralNumericExpression({ value: loc.end.line - 1 }), // the minus 1 assumes the code has been wrapped in async iife + new LiteralNumericExpression({ value: loc.end.line + lineOffset }), // the minus 1 assumes the code has been wrapped in async iife new LiteralNumericExpression({ value: loc.end.column }), new LiteralNumericExpression({ value: loc.end.offset }), ], diff --git a/packages/eval/shift-traverser/index.js b/packages/eval/shift-traverser/index.js index b3312594..5ef0977f 100644 --- a/packages/eval/shift-traverser/index.js +++ b/packages/eval/shift-traverser/index.js @@ -1,3 +1,9 @@ +/* +index.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + /* Copyright (C) 2014 Yusuke Suzuki diff --git a/packages/eval/test/evaluate.test.mjs b/packages/eval/test/evaluate.test.mjs index 99c0c311..b1ef004b 100644 --- a/packages/eval/test/evaluate.test.mjs +++ b/packages/eval/test/evaluate.test.mjs @@ -1,9 +1,15 @@ +/* +evaluate.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import { evaluate, extend } from '../evaluate.mjs'; import { mini } from '@strudel.cycles/mini'; import * as strudel from '@strudel.cycles/core'; -const { cat } = strudel; +const { fastcat } = strudel; extend({ mini }, strudel); @@ -12,11 +18,11 @@ describe('evaluate', () => { it('Should evaluate strudel functions', async () => { assert.deepStrictEqual(await ev("pure('c3')"), ['c3']); assert.deepStrictEqual(await ev('cat(c3)'), ['c3']); - assert.deepStrictEqual(await ev('cat(c3, d3)'), ['c3', 'd3']); + assert.deepStrictEqual(await ev('fastcat(c3, d3)'), ['c3', 'd3']); assert.deepStrictEqual(await ev('slowcat(c3, d3)'), ['c3']); }); it('Should be extendable', async () => { - extend({ myFunction: (...x) => cat(...x) }); + extend({ myFunction: (...x) => fastcat(...x) }); assert.deepStrictEqual(await ev('myFunction(c3, d3)'), ['c3', 'd3']); }); it('Should evaluate simple double quoted mini notation', async () => { diff --git a/packages/eval/test/shapeshifter.test.mjs b/packages/eval/test/shapeshifter.test.mjs index 0b8812f0..1cf04825 100644 --- a/packages/eval/test/shapeshifter.test.mjs +++ b/packages/eval/test/shapeshifter.test.mjs @@ -1,3 +1,9 @@ +/* +shapeshifter.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import shapeshifter from '../shapeshifter.mjs'; diff --git a/packages/midi/midi.mjs b/packages/midi/midi.mjs index c9b93777..502ac155 100644 --- a/packages/midi/midi.mjs +++ b/packages/midi/midi.mjs @@ -1,3 +1,9 @@ +/* +midi.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { isNote } from 'tone'; import _WebMidi from 'webmidi'; import { Pattern, isPattern } from '@strudel.cycles/core'; @@ -69,7 +75,7 @@ Pattern.prototype.midi = function (output, channel = 1) { // await enableWebMidi() device.playNote(note, channel, { time, - duration: event.duration * 1000 - 5, + duration: event.duration.valueOf() * 1000 - 5, velocity, }); }; diff --git a/packages/mini/krill-parser.js b/packages/mini/krill-parser.js index 2b307417..d93258b2 100644 --- a/packages/mini/krill-parser.js +++ b/packages/mini/krill-parser.js @@ -1,3 +1,9 @@ +/* +krill-parser.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // Generated by Peggy 1.2.0. // // https://peggyjs.org/ diff --git a/packages/mini/krill.pegjs b/packages/mini/krill.pegjs index c24be8fb..914855e6 100644 --- a/packages/mini/krill.pegjs +++ b/packages/mini/krill.pegjs @@ -1,3 +1,9 @@ +/* +krill.pegjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // Some terminology: // a sequence = a serie of elements placed between quotes // a stack = a serie of vertically aligned slices sharing the same overall length diff --git a/packages/mini/mini.mjs b/packages/mini/mini.mjs index 9572c349..20971230 100644 --- a/packages/mini/mini.mjs +++ b/packages/mini/mini.mjs @@ -1,3 +1,9 @@ +/* +mini.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import * as krill from './krill-parser.js'; import * as strudel from '@strudel.cycles/core'; import { addMiniLocations } from '@strudel.cycles/eval/shapeshifter.mjs'; diff --git a/packages/mini/test/mini.test.mjs b/packages/mini/test/mini.test.mjs index 4cbe399a..baf34314 100644 --- a/packages/mini/test/mini.test.mjs +++ b/packages/mini/test/mini.test.mjs @@ -1,3 +1,9 @@ +/* +mini.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import { mini } from '../mini.mjs'; import '@strudel.cycles/core/euclid.mjs'; diff --git a/packages/osc/osc.mjs b/packages/osc/osc.mjs index ad42d91a..02c8ad83 100644 --- a/packages/osc/osc.mjs +++ b/packages/osc/osc.mjs @@ -1,3 +1,9 @@ +/* +osc.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import OSC from 'osc-js'; import { Pattern } from '@strudel.cycles/core'; diff --git a/packages/osc/server.js b/packages/osc/server.js index f765b284..ba6f9f90 100644 --- a/packages/osc/server.js +++ b/packages/osc/server.js @@ -1,3 +1,9 @@ +/* +server.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + const OSC = require('osc-js'); const config = { diff --git a/packages/osc/tidal-sniffer.js b/packages/osc/tidal-sniffer.js index a1bdd659..2cbb15e6 100644 --- a/packages/osc/tidal-sniffer.js +++ b/packages/osc/tidal-sniffer.js @@ -1,3 +1,9 @@ +/* +tidal-sniffer.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + const OSC = require('osc-js'); const config = { diff --git a/packages/serial/serial.mjs b/packages/serial/serial.mjs index 312a8c8b..a2bba8c9 100644 --- a/packages/serial/serial.mjs +++ b/packages/serial/serial.mjs @@ -1,3 +1,9 @@ +/* +serial.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, isPattern } from '@strudel.cycles/core'; var serialWriter; diff --git a/packages/tonal/test/tonal.test.mjs b/packages/tonal/test/tonal.test.mjs index 2e22384b..1cc0e08b 100644 --- a/packages/tonal/test/tonal.test.mjs +++ b/packages/tonal/test/tonal.test.mjs @@ -1,3 +1,9 @@ +/* +tonal.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import '../tonal.mjs'; // need to import this to add prototypes import { pure } from '@strudel.cycles/core'; diff --git a/packages/tonal/tonal.mjs b/packages/tonal/tonal.mjs index 128e98bd..ada2a63b 100644 --- a/packages/tonal/tonal.mjs +++ b/packages/tonal/tonal.mjs @@ -1,3 +1,9 @@ +/* +tonal.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Note, Interval, Scale } from '@tonaljs/tonal'; import { Pattern, mod } from '@strudel.cycles/core'; diff --git a/packages/tonal/voicings.mjs b/packages/tonal/voicings.mjs index 5bbf2877..5859c3bc 100644 --- a/packages/tonal/voicings.mjs +++ b/packages/tonal/voicings.mjs @@ -1,3 +1,9 @@ +/* +voicings.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern as _Pattern, stack, Hap, reify } from '@strudel.cycles/core'; import _voicings from 'chord-voicings'; const { dictionaryVoicing, minTopNoteDiff, lefthand } = _voicings.default || _voicings; // parcel module resolution fuckup diff --git a/packages/tone/draw.mjs b/packages/tone/draw.mjs index 07979d01..1b7aef1a 100644 --- a/packages/tone/draw.mjs +++ b/packages/tone/draw.mjs @@ -1,3 +1,9 @@ +/* +draw.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Tone } from './tone.mjs'; import { Pattern } from '@strudel.cycles/core'; diff --git a/packages/tone/pianoroll.mjs b/packages/tone/pianoroll.mjs index 33d9e055..dfb5e5cb 100644 --- a/packages/tone/pianoroll.mjs +++ b/packages/tone/pianoroll.mjs @@ -1,3 +1,9 @@ +/* +pianoroll.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern } from '@strudel.cycles/core'; Pattern.prototype.pianoroll = function ({ diff --git a/packages/tone/test/tone.test.mjs b/packages/tone/test/tone.test.mjs index 3f3d749b..ae01190c 100644 --- a/packages/tone/test/tone.test.mjs +++ b/packages/tone/test/tone.test.mjs @@ -1,3 +1,9 @@ +/* +tone.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import '../tone.mjs'; import { pure } from '@strudel.cycles/core'; diff --git a/packages/tone/tone.mjs b/packages/tone/tone.mjs index 2426dac3..705257ce 100644 --- a/packages/tone/tone.mjs +++ b/packages/tone/tone.mjs @@ -1,3 +1,9 @@ +/* +tone.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern } from '@strudel.cycles/core'; import * as _Tone from 'tone'; @@ -54,14 +60,14 @@ Pattern.prototype.tone = function (instrument) { note = getPlayableNoteValue(event); instrument.triggerAttack(note, time); } else if (instrument instanceof NoiseSynth) { - instrument.triggerAttackRelease(event.duration, time); // noise has no value + instrument.triggerAttackRelease(event.duration.valueOf(), time); // noise has no value } else if (instrument instanceof Piano) { note = getPlayableNoteValue(event); instrument.keyDown({ note, time, velocity }); - instrument.keyUp({ note, time: time + event.duration, velocity }); + instrument.keyUp({ note, time: time + event.duration.valueOf(), velocity }); } else if (instrument instanceof Sampler) { note = getPlayableNoteValue(event); - instrument.triggerAttackRelease(note, event.duration, time, velocity); + instrument.triggerAttackRelease(note, event.duration.valueOf(), time, velocity); } else if (instrument instanceof Players) { if (!instrument.has(event.value)) { throw new Error(`name "${event.value}" not defined for players`); @@ -69,10 +75,10 @@ Pattern.prototype.tone = function (instrument) { const player = instrument.player(event.value); // velocity ? player.start(time); - player.stop(time + event.duration); + player.stop(time + event.duration.valueOf()); } else { note = getPlayableNoteValue(event); - instrument.triggerAttackRelease(note, event.duration, time, velocity); + instrument.triggerAttackRelease(note, event.duration.valueOf(), time, velocity); } }; return event.setContext({ ...event.context, instrument, onTrigger }); diff --git a/packages/tone/ui.mjs b/packages/tone/ui.mjs index fda3f3a3..b0a253f0 100644 --- a/packages/tone/ui.mjs +++ b/packages/tone/ui.mjs @@ -1,3 +1,9 @@ +/* +ui.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Tone } from './tone.mjs'; export const hideHeader = () => { diff --git a/packages/webaudio/clockworker.mjs b/packages/webaudio/clockworker.mjs index 4bc5c106..5e9b0297 100644 --- a/packages/webaudio/clockworker.mjs +++ b/packages/webaudio/clockworker.mjs @@ -1,3 +1,9 @@ +/* +clockworker.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // helpers to create a worker dynamically without needing a server / extra file const stringifyFunction = (func) => '(' + func + ')();'; const urlifyFunction = (func) => URL.createObjectURL(new Blob([stringifyFunction(func)], { type: 'text/javascript' })); diff --git a/packages/webaudio/index.mjs b/packages/webaudio/index.mjs index 869af9fd..7c5898ba 100644 --- a/packages/webaudio/index.mjs +++ b/packages/webaudio/index.mjs @@ -1,3 +1,9 @@ +/* +index.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export { default as ClockWorker } from './clockworker.mjs'; export { default as Scheduler } from './scheduler.mjs'; export * from './webaudio.mjs'; diff --git a/packages/webaudio/scheduler.mjs b/packages/webaudio/scheduler.mjs index 8b476560..847cb2b7 100644 --- a/packages/webaudio/scheduler.mjs +++ b/packages/webaudio/scheduler.mjs @@ -1,3 +1,9 @@ +/* +scheduler.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import ClockWorker from './clockworker.mjs'; import { State, TimeSpan } from '@strudel.cycles/core'; diff --git a/packages/webaudio/webaudio.mjs b/packages/webaudio/webaudio.mjs index de07a56e..d46d9a2e 100644 --- a/packages/webaudio/webaudio.mjs +++ b/packages/webaudio/webaudio.mjs @@ -1,3 +1,9 @@ +/* +webaudio.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, getFrequency, patternify2 } from '@strudel.cycles/core'; import { Tone } from '@strudel.cycles/tone'; @@ -39,7 +45,7 @@ Pattern.prototype._wave = function (type) { const f = getFrequency(e); osc.frequency.value = f; // expects frequency.. const begin = t ?? e.whole.begin.valueOf() + lookahead; - const end = begin + e.duration; + const end = begin + e.valueOf(); osc.start(begin); osc.stop(end); // release? return osc; @@ -49,7 +55,7 @@ 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 + lookahead; + const end = begin + e.duration.valueOf() + lookahead; const envelope = adsr(a, d, s, r, velocity, begin, end); node?.connect(envelope); return envelope; diff --git a/packages/xen/test/xen.test.mjs b/packages/xen/test/xen.test.mjs index 939742bd..f2923a0f 100644 --- a/packages/xen/test/xen.test.mjs +++ b/packages/xen/test/xen.test.mjs @@ -1,3 +1,9 @@ +/* +xen.test.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { strict as assert } from 'assert'; import { edo } from '../xen.mjs'; diff --git a/packages/xen/tune.mjs b/packages/xen/tune.mjs index d7d3f581..825a9d01 100644 --- a/packages/xen/tune.mjs +++ b/packages/xen/tune.mjs @@ -1,3 +1,9 @@ +/* +tune.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import Tune from './tunejs.js'; import { Pattern } from '@strudel.cycles/core'; diff --git a/packages/xen/tunejs.js b/packages/xen/tunejs.js index 80bf043a..7b1a804a 100644 --- a/packages/xen/tunejs.js +++ b/packages/xen/tunejs.js @@ -1,3 +1,9 @@ +/* +tunejs.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // See all scales at: http://abbernie.github.io/tune/scales.html export default function Tune(){ diff --git a/packages/xen/xen.mjs b/packages/xen/xen.mjs index 9bacb323..f82844b0 100644 --- a/packages/xen/xen.mjs +++ b/packages/xen/xen.mjs @@ -1,3 +1,9 @@ +/* +xen.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Pattern, mod } from '@strudel.cycles/core'; export function edo(name) { diff --git a/paper/citation-cache.json b/paper/citation-cache.json index 042541db..d8cef086 100644 --- a/paper/citation-cache.json +++ b/paper/citation-cache.json @@ -104,6 +104,533 @@ "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 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.},", + " 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 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" + } + }, + "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": "" + } } } } \ No newline at end of file diff --git a/paper/demo-preprocessed.md b/paper/demo-preprocessed.md new file mode 100644 index 00000000..23642b8c --- /dev/null +++ b/paper/demo-preprocessed.md @@ -0,0 +1,552 @@ +--- +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" +title: "Strudel: Algorithmic Patterns for the Web" +url2cite: all-links +--- + +# 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 [@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 +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 [@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]. + +# 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; @https://zenodo.org/record/6456380\], 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. + +# Representing Patterns + +Patterns are the essence of Tidal. Its patterns are abstract entities +that represent flows of time as functions, adapting a technique called +pure functional reactive programming. Taking a time span as its input, a +Pattern can output a set of events that happen within that time span. It +depends on the structure of the Pattern how the events are located in +time. From now on, this process of generating events from a time span +will be called **querying**. Example: + + e.show()))`} /> + +In this example, we create a pattern using the `sequence` function and +**query** it for the time span from `0` to `1`. Those numbers represent +units of time called **cycles**. The length of one cycle depends on the +tempo, which defaults to one cycle per second. The resulting events are: + + + +Each event has a value, a begin time and an end time, where time is +represented as a fraction. In the above case, the events are placed in +sequential order, where c3 takes the first half, and e3 and g3 together +take the second half. This temporal placement is the result of the +`sequence` function, which divides its arguments equally over one cycle. +If an argument is an array, the same rule applies to that part of the +cycle. In the example, e3 and g3 are divided equally over the second +half of the whole cycle. + +In the REPL, the user only has to type in the pattern itself, the +querying will be handled by the scheduler. The scheduler will repeatedly +query the pattern for events, which then will be used for playback. + +![Screenshot of the Strudel editor, including piano-roll +visualisation.](images/strudel-screenshot.png){width="43%"} + +# Making Patterns + +In practice, the end-user live coder will not deal with constructing +patterns directly, but will rather build patterns using Strudel's +extensive combinator library to create, combine and transform patterns. + +The live coder may use the `sequence` function as already seen above, or +more often the mini-notation for even terser notation of rhythmic +sequences. Such sequences are often treated only a starting point for +manipulation, where they then are undergo pattern transformations such +as repetition, symmetry, interference/combination or randomisation, +potentially at multiple timescales. Because Strudel patterns are +represented as pure functions of time rather than as data structures, +very long and complex generative results can be represented and +manipulated without having to store the resulting sequences in memory. + +# Pattern Example + +The following example showcases how patterns can be utilized to create +musical complexity from simple parts, using repetition and interference: + +".scale('D minor') +.off(1/4, scaleTranspose(2)) +.off(1/2, scaleTranspose(6)) +.legato(.5) +.echo(4, 1/8, .5) +.tone((await piano()).chain(out())) +.pianoroll()`} /> + +The pattern starts with a rhythm of numbers in mini notation, which are +interpreted inside the scale of D minor. Without the scale function, the +first line can be expressed as: + +"`} /> + +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 + 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 + +# Future Outlook + +The project is still young, with many features on the horizon. As +general guiding principles, Strudel aims to be + +1. accessible +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 +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\":\"\"}"}, +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.) + +# 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 diff --git a/paper/demo.md b/paper/demo.md new file mode 100644 index 00000000..266c6bce --- /dev/null +++ b/paper/demo.md @@ -0,0 +1,140 @@ +--- +title: 'Strudel: Algorithmic Patterns for the Web' +date: '2022-04-15' +url2cite: all-links +--- + +# 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]. + +# 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. + +# Representing Patterns + +Patterns are the essence of Tidal. Its patterns are abstract entities that represent flows of time as functions, adapting a technique called pure functional reactive programming. +Taking a time span as its input, a Pattern can output a set of events that happen within that time span. +It depends on the structure of the Pattern how the events are located in time. +From now on, this process of generating events from a time span will be called **querying**. +Example: + +```js +const pattern = sequence(c3, [e3, g3]); +const events = pattern.query(0, 1); +console.log(events.map(e => e.show())) +``` + +In this example, we create a pattern using the `sequence` function and **query** it for the time span from `0` to `1`. +Those numbers represent units of time called **cycles**. The length of one cycle depends on the tempo, which defaults to one cycle per second. +The resulting events are: + +```js +[{ value: 'c3', begin: 0, end: 1/2 }, +{ value: 'e3', begin: 1/2, end: 3/4 }, +{ value: 'g3', begin: 3/4, end: 1 }] +``` + +Each event has a value, a begin time and an end time, where time is represented as a fraction. +In the above case, the events are placed in sequential order, where c3 takes the first half, and e3 and g3 together take the second half. +This temporal placement is the result of the `sequence` function, which divides its arguments equally over one cycle. +If an argument is an array, the same rule applies to that part of the cycle. In the example, e3 and g3 are divided equally over the second half of the whole cycle. + +In the REPL, the user only has to type in the pattern itself, the querying will be handled by the scheduler. +The scheduler will repeatedly query the pattern for events, which then will be used for playback. + +![Screenshot of the Strudel editor, including piano-roll visualisation.](images/strudel-screenshot.png){ width=43% } + +# Making Patterns + +In practice, the end-user live coder will not deal with constructing patterns directly, but will rather build patterns using Strudel's extensive combinator library to create, combine and transform patterns. + +The live coder may use the `sequence` function as already seen above, or more often the mini-notation for even terser notation of rhythmic sequences. Such sequences are often treated only a starting point for manipulation, where they then are undergo pattern transformations such as repetition, symmetry, interference/combination or randomisation, potentially at multiple timescales. Because Strudel patterns are represented as pure functions of time rather than as data structures, very long and complex generative results can be represented and manipulated without having to store the resulting sequences in memory. + +# Pattern Example + +The following example showcases how patterns can be utilized to create musical complexity from simple parts, using repetition and interference: + +```js +"<0 2 [4 6](3,4,1) 3*2>".scale('D minor') +.off(1/4, scaleTranspose(2)) +.off(1/2, scaleTranspose(6)) +.legato(.5) +.echo(4, 1/8, .5) +.tone((await piano()).chain(out())) +.pianoroll() +``` + +The pattern starts with a rhythm of numbers in mini notation, which are interpreted inside the scale of D minor. +Without the scale function, the first line can be expressed as: + +```js +"" +``` + +This line could also be expressed without mini notation: + +```js +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 + +# Future Outlook + +The project is still young, with many features on the horizon. As general guiding principles, Strudel aims to be + +1. accessible +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. + +# Links + +The Strudel REPL is available at , including an interactive tutorial. +The repository is at , 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/#/ \ No newline at end of file diff --git a/paper/demo.pdf b/paper/demo.pdf new file mode 100644 index 00000000..f52cd93c Binary files /dev/null and b/paper/demo.pdf differ diff --git a/paper/images/strudel-screenshot.png b/paper/images/strudel-screenshot.png new file mode 100644 index 00000000..5f9c4ba0 Binary files /dev/null and b/paper/images/strudel-screenshot.png differ diff --git a/paper/make.sh b/paper/make.sh index 0abdda34..18f36526 100755 --- a/paper/make.sh +++ b/paper/make.sh @@ -6,12 +6,12 @@ fi # --template=templates/template.latex \ -pandoc -s paper.md \ +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 \ - --dpi=300 -o paper.pdf + --dpi=300 -o demo.pdf -pandoc -s paper.md --filter bin/code-filter.py --filter=pandoc-url2cite \ +pandoc -s demo.md --filter bin/code-filter.py --filter=pandoc-url2cite \ --citeproc \ -t markdown-citations -t markdown-fenced_divs \ - -o paper-preprocessed.md + -o demo-preprocessed.md diff --git a/paper/paper-preprocessed.md b/paper/paper-preprocessed.md index a845d9c5..9f206b95 100644 --- a/paper/paper-preprocessed.md +++ b/paper/paper-preprocessed.md @@ -67,36 +67,193 @@ references: 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" title: Strudel url2cite: all-links --- # Introduction -That -@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20 -are excellent, I reference their work at least twice per sentence -[@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20, -p. 3]. Another reference [@https://zenodo.org/record/5788732]. - - +This paper introduces Strudel, an alternative implementation of the +TidalCycles live coding system, using the JavaScript programming +language. # Background General motivations / related work. Reference vortex paper and summarise its background. +The reimplementation of TidalCycles in Python (cite TidalVortex) showed +that it is possible to translate pure functional reactive programming +ideas to a multi paradigm language. It proved to be a stepping stone to +move to other multi-paradigm languages, like JavaScript. A significant +part of of the Python codebase could be ported to JavaScript by +syntactical adjustments. + # Introducing TidalStrudel (do we want to call it TidalStrudel once, and Strudel for short from then on as with vortex? Or just stick with Strudel? Should we start -calling TidalCycles just Cycles??) +calling TidalCycles just Cycles?? froos: I think TidalStrudel sounds a +bit weird, but we can stick to the TidalX naming scheme if that's +important. For me, StrudelCycles sounds better, because it has 3/4 +phonems in common with TidalCycles) - Motivating musical example # Tidal patterns +(should we explain shortly what tidal patterns do in general here?) + +The essence of TidalCycles are Patterns. Patterns are abstract entities +that represent flows of time. Taking a time span as its input, a Pattern +can output a set of events that happen within that time span. It depends +on the structure of the Pattern where the events are placed. From now +on, this process of generating events from a time span will be called +**querying**. Example: + + e.show()))`} /> + +In this example, we create a pattern using the `sequence` function and +**query** it for the timespan from `0` to `1`. Those numbers represent +units of time called **cycles**. The length of one cycle defaults to one +second, but could be any number of seconds. The console output looks +like this: + + 1/2 c3) +(1/2 -> 3/4 e3) +(3/2 -> 1 g3)`} /> + +In this output, each line represents one event. The two fractions +represent the begin and end time of the event, followed by its value. In +this case, the events are placed in sequential order, where c3 takes the +first half, and e3 and g3 together take the second half. This temporal +placement is the result of the `sequence` function, which divides its +arguments equally over one cycle. If an argument is an array, the same +rule applies to that part of the sequence. In our example e3 and g3 are +divided equally over the second half of the whole sequence. + +# Mini Notation + +In this example, the Pattern is created using the `mini` function, which +parses Tidal's Mini Notation. The Mini Notation is a Domain Specific +Language (DSL) that allows expressing rhythms in a short mannger. + - Some comparisons of -Strudel with -Vortex and -Cycles code? + +(the following examples are from vortex paper, with added js versions) + +## 1 + + + + + +without mini notation: + + + + +## 2 + +"`} /> + +") +// sound('bd', silence, slowcat('sd', 'cp'))`} /> + +## 3 + + + + + +## 4 + + + + + +## 5 + + +> speed (1, 2)`} /> + + +(operator overloading like in vortex?) + +## 6 + + + + + +## 7 + + + + + +(partial application) + +## 8 + + +> sound "drum"`} /> + + +(operator overloading?) + +## 9 + + + + + +## 10 + - Mininotation # Strudel/web specifics @@ -118,6 +275,55 @@ or whether javascript affordances mean it's going its own way.. - emulating musician thought patterns - microtonal features? webserial +## User Code Transpilation + +(compare user input vs shifted output) + +### double quotes -\> mini calls + + + + +### operator overloading + + + + +(reify is redundant here, the shapeshifter could have an additional +check...) + +(TBD: ability to multiply mini notation strings) + +### pseudo variables + + + + +### locations + + + + + +with locations: + + + +(talk about mini adding locations of mini notation parser) + +### top level await + + +{ + const p = (await piano()).toDestination(); + return cat("c3").tone(p); +})()`} /> + # Musical examples ... @@ -128,4 +334,16 @@ or whether javascript affordances mean it's going its own way.. - OSC -\> Supercollider - mininotation as the 'regex' of metre +That +@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20 +are excellent, I reference their work at least twice per sentence +[@https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode_x61_rpdm20, +p. 3]. Another reference [@https://zenodo.org/record/5788732]. + + + # References + +- gibber +- krill +- glicol diff --git a/paper/paper.md b/paper/paper.md index 3f5e55b8..20f5cdd0 100644 --- a/paper/paper.md +++ b/paper/paper.md @@ -1,31 +1,225 @@ --- -title: 'Strudel' +title: 'StrudelCycles: live coding algorithmic patterns on the web' date: '2022-03-22' url2cite: all-links --- # Introduction -That @roberts2016 are excellent, I reference their work at least twice per sentence [@roberts2016, p. 3]. Another reference [@mclean21]. - -```javascript -"1 2 3" -``` +This paper introduces Strudel, an alternative implementation of the TidalCycles live coding system, using the JavaScript programming language. # Background +TidalCycles (or *Tidal* for short) has been developed since around 2009, as a system for live coding algorithmic patterns, particularly in music [@tidalcycles]. Tidal is embedded in the pure functional *Haskell* programming language, taking advantage of its terse syntax and advanced type system. Over the past decade, Tidal has undergone a number of re-writes, developing a functional reactive representation of pattern, where patterns may be combined and transformed in a wide variety of ways [@alternate-timelines]. Over this time is has gained diverse ideas from other patterned forms, including from computer music [@spiegel], Indian classical music [@bel], textiles [@fabricating], improvised percussion [@hession], and Ancient Greek lyric [@cyclic-patterns]. + +Most recently, attention has turned to transferring Tidal's ideas to other, less 'pure' languages; firstly, to the Python programming language as *TidalVortex* [@tidalvortex] (*Vortex* for short), and now to JavaScript as StrudelCycles (*Strudel* for short), the topic of the present paper. For general background on the motivations for porting Tidal to a multi-paradigm programming language, please see the TidalVortex paper [@tidalvortex]. The motivations for porting it to JavaScript are similar, with a particular slanting on accessibility - of course, a web browser based application does not require any installation. As with Vortex though, it is important to point out that this is a creative, free/open source project, and as such, an primary motivation will always be developer's curiosity, and market-driven perspectives on development choices may even be demotivational. + General motivations / related work. Reference vortex paper and summarise its background. -# Introducing TidalStrudel +The reimplementation of TidalCycles in Python (cite TidalVortex) showed that it is possible to translate pure functional reactive programming ideas to a multi paradigm language. It proved to be a stepping stone to move to other multi-paradigm languages, like JavaScript. A significant part of of the Python codebase could be quickly ported to JavaScript by syntactical adjustments. -(do we want to call it TidalStrudel once, and Strudel for short from then on as with vortex? Or just stick with Strudel? Should we start calling TidalCycles just Cycles??) +# Introducing Strudel * Motivating musical example # Tidal patterns +(should we explain shortly what tidal patterns do in general here?) + +The essence of TidalCycles are Patterns. Patterns are abstract entities that represent flows of time, supporting both continuous changes (like signals) and discrete events (like notes). +Taking a time span as its input, a Pattern can output a set of events that happen within that time span. +It depends on the structure of the Pattern where the events are placed. +From now on, this process of generating events from a time span will be called **querying**. +Example: + +```js +const pattern = sequence(c3, [e3, g3]); +const events = pattern.query(0, 1); +console.log(events.map(e => e.show())) +``` + +In this example, we create a pattern using the `sequence` function and **query** it for the timespan from `0` to `1`. +Those numbers represent units of time called **cycles**. The length of one cycle defaults to one second, but could be any number of seconds. +The console output looks like this: + +```js +(0 -> 1/2 c3) +(1/2 -> 3/4 e3) +(3/2 -> 1 g3) +``` + +In this output, each line represents one event. The two fractions represent the begin and end time of the event, followed by its value. +In this case, the events are placed in sequential order, where c3 takes the first half, and e3 and g3 together take the second half. +This temporal placement is the result of the `sequence` function, which divides its arguments equally over one cycle. +If an argument is an array, the same rule applies to that part of the sequence. In our example e3 and g3 are divided equally over the second half of the whole sequence. + +# Mini Notation + +In this example, the Pattern is created using the `mini` function, which parses Tidal's Mini Notation. +The Mini Notation is a Domain Specific Language (DSL) that allows expressing rhythms in a short mannger. + * Some comparisons of -Strudel with -Vortex and -Cycles code? + +(the following examples are from vortex paper, with added js versions) + +## 1 + +```haskell +sound "bd ~ [sd cp]" +``` + +```python +sound("bd", silence, ["sd", "cp"]) +``` + +```javascript +sound("bd ~ [sd cp]") +``` + +without mini notation: + +```haskell +sound $ cat + [pure "bd", silence, + cat(pure "sd", pure "cp")] +``` + +```javascript +sound('bd', silence, cat('sd', 'cp')) +``` + +## 2 + +```haskell +sound "bd ~ " +``` + +```python +sound("bd", silence, slowcat("sd", "cp")) +``` + +```javascript +sound("bd ~ ") +// sound('bd', silence, slowcat('sd', 'cp')) +``` + +## 3 + +```haskell +sound "bd {cp sd, lt mt ht}" +``` + +```python +sound("bd", pm(["cp", "sd"], ["lt", "mt", "ht"])) +``` + +```js +? +``` + +## 4 + +```haskell +sound "bd {cp sd, [lt mt,bd bd bd] ht}" +``` + +```python + sound("bd", pm(["cp", "sd"], + [pr(["lt", "mt"], + ["bd", "bd", "bd"] + ), + "ht" ])) +``` + +```js +?? +``` + +## 5 + +```haskell +sound "bd sd cp" # speed "1 2" +``` + +```python +sound("bd", "sd", "cp") >> speed (1, 2) +``` + +```javascript +sound("bd sd cp").speed("1 2") +``` + +(operator overloading like in vortex?) + +## 6 + +```haskell +rev $ sound "bd sd" +``` + +```python +rev(sound("bd", "sd")) +sound("bd", "sd").rev() +``` + +```javascript +rev(sound("bd sd")) +sound("bd sd").rev() +``` + +## 7 + +```haskell +jux rev $ every 3 (fast 2) $ sound "bd sd" +``` + +```python +jux(rev, every(3, fast(2), sound("bd", "sd"))) +sound("bd","sd").every(3, fast(2)).jux(rev) +``` + +```js +jux(rev, every(3, fast(2), sound("bd sd"))) +sound("bd sd").every(3, fast(2)).jux(rev) +``` + +(partial application) + +## 8 + +```haskell +n ("1 2 3" + "4 5") # sound "drum" +``` + +```python +n (sequence(1,2,3) + sequence(4,5)) >> sound "drum" +``` + +```js +n("1 2 3".add("4 5")).sound("drum") +n("5 [6 7] 8").sound("drum") +``` + +(operator overloading?) + +## 9 + +```haskell +speed("1 2 3" + sine) +``` + +```python +speed(sequence(1,2,3) + sine) +``` + +```js +speed("1 2 3".add(sine)) +"c3*4".add(sine.mul(12).slow(8)).pianoroll() +``` + +## 10 + * Mininotation # Strudel/web specifics @@ -46,7 +240,85 @@ adding source locations * microtonal features? webserial -# Musical examples +## User Code Transpilation + +(compare user input vs shifted output) + +### double quotes -> mini calls + +```javascript +"c3 e3" // or `c3 e3` +``` + +```javascript +mini("c3 e3") +``` + +### operator overloading + +```javascript +cat(c3, e3) * 4 +``` + +```javascript +reify(cat("c3","e3")).fast(4) +``` + +(reify is redundant here, the shapeshifter could have an additional check...) + +(TBD: ability to multiply mini notation strings) + +### pseudo variables + +```javascript +cat(c3, r, e3) +``` + +```javascript +cat("c3",silence,"e3") +``` + +### locations + +```javascript +cat(c3, e3) +``` + +```javascript +cat( + reify("c3").withLocation([1,4,4],[1,6,6]), + reify("e3").withLocation([1,8,8],[1,10,10]) +) +``` + +```javascript +mini("c3 e3") +``` + +with locations: + +```javascript +// "c3 e3" +mini("c3 e3").withMiniLocation([1,0,0],[1,7,7]) +``` + +(talk about mini adding locations of mini notation parser) + +### top level await + +```javascript +const p = (await piano()).toDestination() +cat(c3).tone(p) +``` + +```javascript +(async()=>{ + const p = (await piano()).toDestination(); + return cat("c3").tone(p); +})() +``` + +# Musical examples ... @@ -56,7 +328,27 @@ webserial * OSC -> Supercollider * mininotation as the 'regex' of metre +That @roberts2016 are excellent, I reference their work at least twice per sentence [@roberts2016, p. 3]. + +```javascript +"1 2 3" +``` + # References [@roberts2016]: https://www.tandfonline.com/doi/abs/10.1080/14794713.2016.1227602?journalCode=rpdm20 -[@mclean21]: https://zenodo.org/record/5788732 \ No newline at end of file +[@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 +[@ogborn17]: 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 + +- gibber +- krill +- glicol diff --git a/paper/paper.pdf b/paper/paper.pdf index 05a99753..ce2f6394 100644 Binary files a/paper/paper.pdf and b/paper/paper.pdf differ diff --git a/paper/tex/latex-template.tex b/paper/tex/latex-template.tex index e972a843..9dada977 100755 --- a/paper/tex/latex-template.tex +++ b/paper/tex/latex-template.tex @@ -1,7 +1,11 @@ \documentclass{tex/sig-alternate} -\usepackage{hyperref} +\usepackage[colorlinks = true, + linkcolor = blue, + urlcolor = blue, + citecolor = blue, + anchorcolor = blue]{hyperref} \usepackage{fancyvrb} \usepackage{xcolor} @@ -79,35 +83,42 @@ \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} % Add ',fontsize=\small' for more characters per line - +\makeatletter +\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi} +\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi} +\makeatother +% Scale images if necessary, so that they will not overflow the page +% margins by default, and it is still possible to overwrite the defaults +% using explicit options in \includegraphics[width, height, ...]{} +\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio} \begin{document} \setcopyright{waclicense} -\conferenceinfo{Web Audio Conference WAC-2022,}{December 6--8, 2022, Cannes, France.} +\conferenceinfo{Web Audio Conference WAC-2022,}{July 6--8, 2022, Cannes, France.} \CopyrightYear{2022} -\title{Strudel} +\title{Strudel: Algorithmic Patterns for the Web} \numberofauthors{2} \author{ \alignauthor \name{Felix Roos} - \affaddr{Affiliation?} - \email{x@x.com} + \affaddr{Lembach, France} + \email{flix91@gmail.com} % 2nd. author \alignauthor \name{Alex McLean} - \affaddr{Then Try This\\ Sheffield/Penryn} + \affaddr{Then Try This\\ Sheffield/Penryn, UK} \email{alex@slab.org} } \maketitle \begin{sloppypar} -\begin{abstract} -Abstract goes here (find me in the latex template) -\end{abstract} +%\begin{abstract} +%Abstract goes here (find me in the latex template) +%\end{abstract} \end{sloppypar} $body$ diff --git a/paper/tex/waccopyright.sty b/paper/tex/waccopyright.sty index bf33fdcf..9d370390 100755 --- a/paper/tex/waccopyright.sty +++ b/paper/tex/waccopyright.sty @@ -94,10 +94,10 @@ \or % acmcopyright ACM. \or % acmlicensed - Copyright held by the owner/author(s). Publication rights licensed to + Copyright held by the owner/author(s). Publication rights not licensed to ACM. \or % rightsretained - Copyright held by the owner/author(s). + Felix Roos and Alex McLean. \or % usgov \or % usgovmixed ACM. @@ -115,7 +115,7 @@ ACM. \or % licensedothergov \or % waclicense - Copyright held by the owner/author(s). + Felix Roos and Alex McLean. \fi} \def\@copyrightpermission{% \ifcase\acm@copyrightmode\relax % none @@ -222,7 +222,7 @@ only. \or % waclicense \frame{\includegraphics[scale=.54]{images/cc}}\vspace{1mm}\vfill - Licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0). \textbf{Attribution}: owner/author(s). + Licensed under a Creative Commons Attribution 4.0 International License (CC BY 4.0). \textbf{Attribution}: Felix Roos and Alex McLean. \fi} \endinput %% diff --git a/repl/postcss.config.js b/repl/postcss.config.js index 33ad091d..8365a461 100644 --- a/repl/postcss.config.js +++ b/repl/postcss.config.js @@ -1,3 +1,9 @@ +/* +postcss.config.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + module.exports = { plugins: { tailwindcss: {}, diff --git a/repl/src/App.js b/repl/src/App.js index 6c85dc39..1e3f3241 100644 --- a/repl/src/App.js +++ b/repl/src/App.js @@ -1,3 +1,9 @@ +/* +App.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import React, { useCallback, useLayoutEffect, useRef, useState } from 'react'; import CodeMirror, { markEvent, markParens } from './CodeMirror'; import cx from './cx'; diff --git a/repl/src/App.test.js b/repl/src/App.test.js index 1f03afee..ae608030 100644 --- a/repl/src/App.test.js +++ b/repl/src/App.test.js @@ -1,3 +1,9 @@ +/* +App.test.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { render, screen } from '@testing-library/react'; import App from './App'; diff --git a/repl/src/CodeMirror.jsx b/repl/src/CodeMirror.jsx index b58ad75a..a659e3ee 100644 --- a/repl/src/CodeMirror.jsx +++ b/repl/src/CodeMirror.jsx @@ -44,8 +44,8 @@ export const markEvent = (editor) => (time, event) => { //Tone.Transport.schedule(() => { // problem: this can be cleared by scheduler... setTimeout(() => { marks.forEach((mark) => mark.clear()); - // }, '+' + event.duration * 0.5); - }, event.duration /* * 0.9 */ * 1000); + // }, '+' + event.duration.valueOf() * 0.5); + }, event.duration.valueOf() /* * 0.9 */ * 1000); }; let parenMark; diff --git a/repl/src/cx.js b/repl/src/cx.js index fdd3ae90..f806fcf3 100644 --- a/repl/src/cx.js +++ b/repl/src/cx.js @@ -1,3 +1,9 @@ +/* +cx.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export default function cx(...classes) { // : Array return classes.filter(Boolean).join(' '); } diff --git a/repl/src/index.js b/repl/src/index.js index ef2edf8e..9403334b 100644 --- a/repl/src/index.js +++ b/repl/src/index.js @@ -1,3 +1,9 @@ +/* +index.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; diff --git a/repl/src/oldtunes.mjs b/repl/src/oldtunes.mjs index 6ac25dda..33e499e5 100644 --- a/repl/src/oldtunes.mjs +++ b/repl/src/oldtunes.mjs @@ -1,3 +1,9 @@ +/* +oldtunes.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export const timeCatMini = `stack( "c3@3 [eb3, g3, [c4 d4]/2]", "c2 g2", diff --git a/repl/src/reportWebVitals.js b/repl/src/reportWebVitals.js index 5253d3ad..84b6af34 100644 --- a/repl/src/reportWebVitals.js +++ b/repl/src/reportWebVitals.js @@ -1,3 +1,9 @@ +/* +reportWebVitals.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + const reportWebVitals = onPerfEntry => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { diff --git a/repl/src/setupTests.js b/repl/src/setupTests.js index 8f2609b7..16e872ec 100644 --- a/repl/src/setupTests.js +++ b/repl/src/setupTests.js @@ -1,3 +1,9 @@ +/* +setupTests.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + // jest-dom adds custom jest matchers for asserting on DOM nodes. // allows you to do things like: // expect(element).toHaveTextContent(/react/i) diff --git a/repl/src/static.mjs b/repl/src/static.mjs index 0fc70537..db3de4f1 100644 --- a/repl/src/static.mjs +++ b/repl/src/static.mjs @@ -1,3 +1,9 @@ +/* +static.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { Tone } from '@strudel.cycles/tone'; import { State, TimeSpan } from '@strudel.cycles/core'; import { getPlayableNoteValue } from '@strudel.cycles/core/util.mjs'; @@ -45,7 +51,7 @@ async function playStatic(code) { if (!onTrigger) { if (defaultSynth) { const note = getPlayableNoteValue(event); - defaultSynth.triggerAttackRelease(note, event.duration, time, velocity); + defaultSynth.triggerAttackRelease(note, event.duration.valueOf(), time, velocity); } else { throw new Error('no defaultSynth passed to useRepl.'); } diff --git a/repl/src/tunes.mjs b/repl/src/tunes.mjs index 93f84ede..520a42c2 100644 --- a/repl/src/tunes.mjs +++ b/repl/src/tunes.mjs @@ -1,3 +1,9 @@ +/* +tunes.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + export const timeCatMini = `stack( "c3@3 [eb3, g3, [c4 d4]/2]", "c2 g2", @@ -5,16 +11,16 @@ export const timeCatMini = `stack( )`; export const timeCat = `stack( - timeCat([3, c3], [1, stack(eb3, g3, cat(c4, d4).slow(2))]), - cat(c2, g2), - sequence( - timeCat([5, eb4], [3, cat(f4, eb4, d4)]), - cat(eb4, c4).slow(2) + timeCat([3, c3], [1, stack(eb3, g3, seq(c4, d4).slow(2))]), + seq(c2, g2), + seq( + timeCat([5, eb4], [3, seq(f4, eb4, d4)]), + seq(eb4, c4).slow(2) ).slow(4) )`; export const shapeShifted = `stack( - sequence( + seq( e5, [b4, c5], d5, [c5, b4], a4, [a4, c5], e5, [d5, c5], b4, [r, c5], d5, e5, @@ -24,7 +30,7 @@ export const shapeShifted = `stack( b4, [b4, c5], d5, e5, c5, a4, a4, r, ).rev(), - sequence( + seq( e2, e3, e2, e3, e2, e3, e2, e3, a2, a3, a2, a3, a2, a3, a2, a3, gs2, gs3, gs2, gs3, e2, e3, e2, e3, @@ -36,16 +42,16 @@ export const shapeShifted = `stack( ).rev() ).slow(16)`; -export const tetrisWithFunctions = `stack(sequence( - 'e5', sequence('b4', 'c5'), 'd5', sequence('c5', 'b4'), - 'a4', sequence('a4', 'c5'), 'e5', sequence('d5', 'c5'), - 'b4', sequence(silence, 'c5'), 'd5', 'e5', - 'c5', 'a4', 'a4', silence, - sequence(silence, 'd5'), sequence(silence, 'f5'), 'a5', sequence('g5', 'f5'), - 'e5', sequence(silence, 'c5'), 'e5', sequence('d5', 'c5'), - 'b4', sequence('b4', 'c5'), 'd5', 'e5', - 'c5', 'a4', 'a4', silence), - sequence( +/* export const tetrisWithFunctions = `stack(seq( + 'e5', seq('b4', 'c5'), 'd5', seq('c5', 'b4'), + 'a4', seq('a4', 'c5'), 'e5', seq('d5', 'c5'), + 'b4', seq(r, 'c5'), 'd5', 'e5', + 'c5', 'a4', 'a4', r, + seq(r, 'd5'), seq(r, 'f5'), 'a5', seq('g5', 'f5'), + 'e5', seq(r, 'c5'), 'e5', seq('d5', 'c5'), + 'b4', seq('b4', 'c5'), 'd5', 'e5', + 'c5', 'a4', 'a4', r), + seq( 'e2', 'e3', 'e2', 'e3', 'e2', 'e3', 'e2', 'e3', 'a2', 'a3', 'a2', 'a3', 'a2', 'a3', 'a2', 'a3', 'g#2', 'g#3', 'g#2', 'g#3', 'e2', 'e3', 'e2', 'e3', @@ -55,10 +61,10 @@ export const tetrisWithFunctions = `stack(sequence( 'b1', 'b2', 'b1', 'b2', 'e2', 'e3', 'e2', 'e3', 'a1', 'a2', 'a1', 'a2', 'a1', 'a2', 'a1', 'a2', ) -).slow(16)`; +).slow(16)`; */ export const tetris = `stack( - cat( + seq( "e5 [b4 c5] d5 [c5 b4]", "a4 [a4 c5] e5 [d5 c5]", "b4 [~ c5] d5 e5", @@ -68,7 +74,7 @@ export const tetris = `stack( "b4 [b4 c5] d5 e5", "c5 a4 a4 ~" ), - cat( + seq( "e2 e3 e2 e3 e2 e3 e2 e3", "a2 a3 a2 a3 a2 a3 a2 a3", "g#2 g#3 g#2 g#3 e2 e3 e2 e3", @@ -98,14 +104,14 @@ export const tetrisMini = `\`[[e5 [b4 c5] d5 [c5 b4]] [[a1 a2]*4]\`.slow(16) `; -export const whirlyStrudel = `sequence(e4, [b2, b3], c4) +export const whirlyStrudel = `seq(e4, [b2, b3], c4) .every(4, fast(2)) .every(3, slow(1.5)) -.fast(slowcat(1.25, 1, 1.5)) -.every(2, _ => sequence(e4, r, e3, d4, r))`; +.fast(cat(1.25, 1, 1.5)) +.every(2, _ => seq(e4, r, e3, d4, r))`; export const swimming = `stack( - cat( + seq( "~", "~", "~", @@ -124,7 +130,7 @@ export const swimming = `stack( "A5 [F5@2 C5] [D5@2 F5] F5", "[C5@2 F5] [Bb5 A5 G5] F5@2" ), - cat( + seq( "[F4,Bb4,D5] [[D4,G4,Bb4]@2 [Bb3,D4,F4]] [[G3,C4,E4]@2 [[Ab3,F4] [A3,Gb4]]] [Bb3,E4,G4]", "[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, Bb3, Db3] [F3, Bb3, Db3]]", "[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]", @@ -143,7 +149,7 @@ export const swimming = `stack( "[~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, A3, C3] [F3, A3, C3]] [~ [F3, Bb3, D3] [F3, Bb3, D3]] [~ [F3, B3, D3] [F3, B3, D3]]", "[~ [F3, Bb3, D4] [F3, Bb3, D4]] [~ [F3, Bb3, C4] [F3, Bb3, C4]] [~ [F3, A3, C4] [F3, A3, C4]] [~ [F3, A3, C4] [F3, A3, C4]]" ), - cat( + seq( "[G3 G3 C3 E3]", "[F2 D2 G2 C2]", "[F2 D2 G2 C2]", @@ -167,38 +173,38 @@ export const swimming = `stack( export const giantSteps = `stack( // melody - cat( + seq( "[F#5 D5] [B4 G4] Bb4 [B4 A4]", "[D5 Bb4] [G4 Eb4] F#4 [G4 F4]", "Bb4 [B4 A4] D5 [D#5 C#5]", "F#5 [G5 F5] Bb5 [F#5 F#5]", ), // chords - cat( + seq( "[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]", "[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]", "Eb^7 [Am7 D7] G^7 [C#m7 F#7]", "B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]" ).voicings(['E3', 'G4']), // bass - cat( + seq( "[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]", "[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]", "[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]", "[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]" ) -).slow(20);`; +).slow(20)`; export const giantStepsReggae = `stack( // melody - cat( + seq( "[F#5 D5] [B4 G4] Bb4 [B4 A4]", "[D5 Bb4] [G4 Eb4] F#4 [G4 F4]", "Bb4 [B4 A4] D5 [D#5 C#5]", "F#5 [G5 F5] Bb5 [F#5 [F#5 ~@3]]", ), // chords - cat( + seq( "[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]", "[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]", "Eb^7 [Am7 D7] G^7 [C#m7 F#7]", @@ -207,7 +213,7 @@ export const giantStepsReggae = `stack( .struct("~ [x ~]".fast(4*8)) .voicings(['E3', 'G4']), // bass - cat( + seq( "[B2 D2] [G2 D2] [Eb2 Bb2] [A2 D2]", "[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]", "[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]", @@ -220,13 +226,13 @@ export const transposedChordsHacked = `stack( "c2 eb2 g2", "Cm7".voicings(['g2','c4']).slow(2) ).transpose( - slowcat(1, 2, 3, 2).slow(2) + cat(1, 2, 3, 2).slow(2) ).transpose(5)`; export const scaleTranspose = `stack(f2, f3, c4, ab4) -.scale(sequence('F minor', 'F harmonic minor').slow(4)) -.scaleTranspose(sequence(0, -1, -2, -3).slow(4)) -.transpose(sequence(0, 1).slow(16))`; +.scale(seq('F minor', 'F harmonic minor').slow(4)) +.scaleTranspose(seq(0, -1, -2, -3).slow(4)) +.transpose(seq(0, 1).slow(16))`; export const struct = `stack( "c2 g2 a2 [e2@2 eb2] d2 a2 g2 [d2 ~ db2]", @@ -239,9 +245,9 @@ export const magicSofa = `stack( .every(2, fast(2)) .voicings(), " " -).slow(1).transpose(slowcat(0, 2, 3, 4))`; +).slow(1).transpose(cat(0, 2, 3, 4))`; // below doesn't work anymore due to constructor cleanup -// ).slow(1).transpose.slowcat(0, 2, 3, 4)`; +// ).slow(1).transpose.cat(0, 2, 3, 4)`; export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]" .superimpose( @@ -251,8 +257,8 @@ export const confusedPhone = `"[g2 ~@1.3] [c3 ~@1.3]" transpose(12).late(0.3), transpose(24).late(0.4) ) -.scale(slowcat('C dorian', 'C mixolydian')) -.scaleTranspose(slowcat(0,1,2,1)) +.scale(cat('C dorian', 'C mixolydian')) +.scaleTranspose(cat(0,1,2,1)) .slow(2)`; export const zeldasRescue = `stack( @@ -340,7 +346,7 @@ stack( export const callcenterhero = `const bpm = 90; const lead = polysynth().set({...osc('sine4'),...adsr(.004)}).chain(vol(0.15),out()) const bass = fmsynth({...osc('sawtooth6'),...adsr(0.05,.6,0.8,0.1)}).chain(vol(0.6), out()); -const s = scale(slowcat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4)); +const s = scale(cat('F3 minor', 'Ab3 major', 'Bb3 dorian', 'C4 phrygian dominant').slow(4)); stack( "0 2".struct(" [x ~]").apply(s).scaleTranspose(stack(0,2)).tone(lead), "<6 7 9 7>".struct("[~ [x ~]*2]*2").apply(s).scaleTranspose("[0,2] [2,4]".fast(2).every(4,rev)).tone(lead), @@ -379,7 +385,7 @@ stack( `; export const xylophoneCalling = `const t = x => x.scaleTranspose("<0 2 4 3>/4").transpose(-2) -const s = x => x.scale(slowcat('C3 minor pentatonic','G3 minor pentatonic').slow(4)) +const s = x => x.scale(cat('C3 minor pentatonic','G3 minor pentatonic').slow(4)) const delay = new FeedbackDelay(1/8, .6).chain(vol(0.1), out()); const chorus = new Chorus(1,2.5,0.5).start(); stack( @@ -412,7 +418,8 @@ stack( "~ ".tone(noise().chain(vol(0.8),out())), // hihat "c3*4".transpose("[-24 0]*2").tone(metal(adsr(0,.02)).chain(vol(0.5).connect(delay),out())) -).slow(1)`; +).slow(1) +// strudel disable-highlighting`; export const sowhatelse = `// mixer const mix = (key) => vol({ @@ -448,7 +455,8 @@ stack( "~ c3".tone(instr('snare')), "<[c1@5 c1] >".tone(instr('kick')), "[2,4]/4".scale('D dorian').apply(t).tone(instr('pad')).mask("/8") -).fast(6/8)`; +).fast(6/8) +// strudel disable-highlighting`; export const barryHarris = `backgroundImage( 'https://media.npr.org/assets/img/2017/02/03/barryharris_600dpi_wide-7eb49998aa1af377d62bb098041624c0a0d1a454.jpg', @@ -481,7 +489,7 @@ const rhodes = await sampler({ }, 'https://loophole-letters.vercel.app/') const bass = synth(osc('sawtooth8')).chain(vol(.5),out()) -const scales = sequence('C major', 'C mixolydian', 'F lydian', ['F minor', slowcat('Db major','Db mixolydian')]).slow(4) +const scales = cat('C major', 'C mixolydian', 'F lydian', ['F minor', cat('Db major','Db mixolydian')]) stack( " " @@ -500,12 +508,12 @@ stack( .tone(bass), ).fast(3/2)`; -export const wavyKalimba = `const delay = new FeedbackDelay(1/3, .5).chain(vol(.2), out()); +export const wavyKalimba = `const delay = new FeedbackDelay(1/3, .5).chain(vol(.2), out()) let kalimba = await sampler({ C5: 'https://freesound.org/data/previews/536/536549_11935698-lq.mp3' }) kalimba = kalimba.chain(vol(0.6).connect(delay),out()); -const scales = sequence('C major', 'C mixolydian', 'F lydian', ['F minor', 'Db major']).slow(4); +const scales = cat('C major', 'C mixolydian', 'F lydian', ['F minor', 'Db major']) stack( "[0 2 4 6 9 2 0 -2]*3" @@ -573,7 +581,7 @@ stack( chords.voicings().struct("x(3,8,-1)").velocity(.5).off(1/7,x=>x.transpose(12).velocity(.2)), chords.rootNotes(2).struct("x(4,8,-2)"), chords.rootNotes(4) - .scale(slowcat('C minor','F dorian','G dorian','F# mixolydian')) + .scale(cat('C minor','F dorian','G dorian','F# mixolydian')) .struct("x(3,8,-2)".fast(2)) .scaleTranspose("0 4 0 6".early(".125 .5")).layer(scaleTranspose("0,<2 [4,6] [5,7]>/4")) ).slow(2) @@ -581,7 +589,7 @@ stack( .tone((await piano()).chain(out()))`; export const festivalOfFingers2 = `const chords = ""; -const scales = slowcat('C minor','F dorian','G dorian','F# mixolydian') +const scales = cat('C minor','F dorian','G dorian','F# mixolydian') stack( chords.voicings().struct("x(3,8,-1)").velocity(.5).off(1/7,x=>x.transpose(12).velocity(.2)), chords.rootNotes(2).struct("x(4,8)"), @@ -638,7 +646,7 @@ stack( ).cpm(78).slow(4).pianoroll() `; -export const goodTimes = `const scale = slowcat('C3 dorian','Bb2 major').slow(4); +export const goodTimes = `const scale = cat('C3 dorian','Bb2 major').slow(4); stack( "2*4".add(12).scale(scale) .off(1/8,x=>x.scaleTranspose("2")).fast(2) @@ -708,7 +716,7 @@ export const speakerman = `backgroundImage('https://external-content.duckduckgo. { className:'darken', style:'background-size:cover'}) stack( "[g3,bb3,d4] [f3,a3,c4] [c3,e3,g3]@2".slow(2).late(.1), - slowcat( + cat( 'Baker man', 'is baking bread', 'Baker man', @@ -738,7 +746,7 @@ bell = bell.chain(vol(0.6).connect(delay),out()); .add(rand.range(0,12)) .velocity(rand.range(.5,1)) .legato(rand.range(.4,3)) - .scale(slowcat('D minor pentatonic')).tone(bell) + .scale(cat('D minor pentatonic')).tone(bell) .stack("".euclidLegato(6,8,1).tone(bass.toDestination())) .slow(6) .pianoroll({minMidi:20,maxMidi:120,background:'transparent'})`; @@ -768,7 +776,7 @@ export const hyperpop = `const lfo = cosine.slow(15); const lfo2 = sine.slow(16); const filter1 = x=>x.filter('lowpass', lfo2.range(300,3000)); const filter2 = x=>x.filter('highpass', lfo.range(1000,6000)).filter('lowpass',4000) -const scales = slowcat('D3 major', 'G3 major').slow(8) +const scales = cat('D3 major', 'G3 major').slow(8) const drums = await players({ bd: '344/344757_1676145-lq.mp3', @@ -819,7 +827,7 @@ export const festivalOfFingers3 = `"[-7*3],0,2,6,[8 7]" .legato(sine.range(.5,2).slow(8)) .velocity(sine.range(.4,.8).slow(5)) .echo(4,1/12,.5)) -.scale(slowcat('D dorian','G mixolydian','C dorian','F mixolydian')) +.scale(cat('D dorian','G mixolydian','C dorian','F mixolydian')) .legato(1) .slow(2) .tone((await piano()).toDestination()) diff --git a/repl/src/tutorial/Tutorial.js b/repl/src/tutorial/Tutorial.js index a721a0a1..8f6f5d3c 100644 --- a/repl/src/tutorial/Tutorial.js +++ b/repl/src/tutorial/Tutorial.js @@ -1,3 +1,9 @@ +/* +Tutorial.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import React from 'react'; import ReactDOM from 'react-dom'; import Tutorial from './tutorial.mdx'; diff --git a/repl/src/tutorial/tutorial.mdx b/repl/src/tutorial/tutorial.mdx index 117695c9..38ff8655 100644 --- a/repl/src/tutorial/tutorial.mdx +++ b/repl/src/tutorial/tutorial.mdx @@ -15,7 +15,8 @@ The best place to actually make music with Strudel is the [Strudel REPL](https:/ To get a taste of what Strudel can do, check out this track: - + An important difference to the mini notation: For sharp notes, the letter "s" is used instead of "#", because JavaScript does not support "#" in a variable name. The above is the same as: - + Using strings, you can also use "#". @@ -220,38 +221,35 @@ Most of the time, you won't need that function as input values of pattern creati ### cat(...values) -The given items are con**cat**enated spread evenly over one cycle: +The given items are con**cat**enated, where each one takes one cycle: - + -The function **fastcat** does the same as **cat**. +- Square brackets will create a subsequence +- The function **slowcat** does the same as **cat**. -### sequence(...values) +### seq(...values) -Like **cat**, but allows nesting with arrays: +Like **cat**, but the items are crammed into one cycle: - + + +- Synonyms: **fastcat**, **sequence** ### stack(...values) The given items are played at the same time at the same length: - + -### slowcat(...values) - -Like cat, but each item has the length of one cycle: - - - - +- Square Brackets will create a subsequence ### Nesting functions You can nest functions inside one another: + You can also use the shorthand **pr** instead of **polyrhythm**. @@ -295,7 +293,7 @@ The following functions modify a pattern. Like "/" in mini notation, **slow** will slow down a pattern over the given number of cycles: - + The same in mini notation: @@ -305,19 +303,19 @@ The same in mini notation: Like "\*" in mini notation, **fast** will play a pattern times the given number in one cycle: - + ### early(cycles) With early, you can nudge a pattern to start earlier in time: - + ### late(cycles) Like early, but in the other direction: - + @@ -325,19 +323,19 @@ Like early, but in the other direction: Will reverse the pattern: - + ### every(n, func) Will apply the given function every n cycles: - + Note that late is called directly. This is a shortcut for: - x.late(0.5)))`} /> + x.late(0.5)))`} /> @@ -612,7 +610,7 @@ Turns numbers into notes in the scale (zero indexed). Also sets scale for other Note that the scale root is octaved here. You can also omit the octave, then index zero will default to octave 3. diff --git a/repl/src/useCycle.mjs b/repl/src/useCycle.mjs index 2e6cad42..5a68c9da 100644 --- a/repl/src/useCycle.mjs +++ b/repl/src/useCycle.mjs @@ -1,3 +1,9 @@ +/* +useCycle.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { useEffect, useState } from 'react'; import { Tone } from '@strudel.cycles/tone'; import { State, TimeSpan } from '@strudel.cycles/core'; diff --git a/repl/src/usePostMessage.mjs b/repl/src/usePostMessage.mjs index b40282ac..9d3bc8e7 100644 --- a/repl/src/usePostMessage.mjs +++ b/repl/src/usePostMessage.mjs @@ -1,3 +1,9 @@ +/* +usePostMessage.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { useEffect, useCallback } from 'react'; function usePostMessage(listener) { diff --git a/repl/src/useRepl.mjs b/repl/src/useRepl.mjs index c20a9cba..9246374c 100644 --- a/repl/src/useRepl.mjs +++ b/repl/src/useRepl.mjs @@ -1,3 +1,9 @@ +/* +useRepl.mjs - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { useCallback, useState, useMemo } from 'react'; import { evaluate } from '@strudel.cycles/eval'; import { getPlayableNoteValue } from '@strudel.cycles/core/util.mjs'; @@ -29,7 +35,7 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) { return onDraw; } }, [activeCode, onDraw]); - + // cycle hook to control scheduling const cycle = useCycle({ onDraw, @@ -37,11 +43,14 @@ function useRepl({ tune, defaultSynth, autolink = true, onEvent, onDraw }) { (time, event, currentTime) => { try { onEvent?.(event); + if (event.context.logs?.length) { + event.context.logs.forEach(pushLog); + } const { onTrigger, velocity } = event.context; if (!onTrigger) { if (defaultSynth) { const note = getPlayableNoteValue(event); - defaultSynth.triggerAttackRelease(note, event.duration, time, velocity); + defaultSynth.triggerAttackRelease(note, event.duration.valueOf(), time, velocity); } else { throw new Error('no defaultSynth passed to useRepl.'); } diff --git a/repl/src/useWebMidi.js b/repl/src/useWebMidi.js index 456be340..ee3f0db3 100644 --- a/repl/src/useWebMidi.js +++ b/repl/src/useWebMidi.js @@ -1,3 +1,9 @@ +/* +useWebMidi.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + import { useEffect, useState } from 'react'; import { enableWebMidi, WebMidi } from '@strudel.cycles/midi' diff --git a/repl/tailwind.config.js b/repl/tailwind.config.js index d5dd0c7d..6dbeb8fc 100644 --- a/repl/tailwind.config.js +++ b/repl/tailwind.config.js @@ -1,3 +1,9 @@ +/* +tailwind.config.js - +Copyright (C) 2022 Strudel contributors - see +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 . +*/ + module.exports = { content: ['./src/**/*.{js,jsx,ts,tsx}'], theme: {