Skip to content

Commit

Permalink
upstream changes (#809)
Browse files Browse the repository at this point in the history
* checkbox + number slider

* match number.slider

* Add pink, white and brown oscillators

* Add noise parameter for base oscillators

* Fix noise parameter and FM parameters compatibility

* Cap noise amount to 1

* Add documentation about noise sources

* match slider as function

* use loc as slider id

* add slider function to scope

* Replacing old reverb by better convolution

* make sliders work!

* fix some odd number / string problems

* fix: import

* wip: use sample as an impulse response for the reverb

* Document reverb controls

* bugfixes for parameter passing

* improve mouse tracking

* use sample as an impulse response for the reverb

* cleanup

* simplify: use native events

* add back some margin

* use raw css instead of tailwind

* add extra sliderWithID function
+ add warning to slider function

* remove checkbox

* remove comment

* fix: comment

* fix: import

* hotfix: add missing dependency

* support mininotation '..' range operator, fixes #715 (#716)

* support mininotation .. range operator, fixes #715

* remove logs

* Connecting all parameters to convolution generator

* Connecting new reverb documentation

* codeformat

* fix: reverbs[orbit] is undefined

* eslint ignore reverbGen + snapshot

* Prepare to merge with PR #718

* feat: add step as slider param

* more logical naming + update docs

* snapshot

* codeformat

* add noise heading + hihat example

* refactor synth
- separate waveform / noise oscillators
- pull noise out of getOscillator
- put fm into getOscillator
- simplify overall value plumbing

* proper dry wet + pull out noise to extra file

* fix: imports

* cache noise

* rename zzfx noise to znoise

* snapshot

* fix: slider crash on some platforms

* update internal reverb param names

* simplify createReverb

* consistent naming + simplify

* remove unused reverb method

* Integrate with the new impulse generation functionality

* fix: reverbGen.mjs

* fix: formatting

* fix: reverb regenerate loophole

* consume n with scale

* snapshot

* fix: conflicts

* fix: conflicts

* add compressor + postgain

* fix: hashes in urls

* compressor docs

* format

* snapshot

* fix: roomsize not required

* fix: reverb sampleRate

* bump superdough to 0.9.10

* fix: pitched sample as ir

* vite-vanilla-repl readme fix

* Add shabda shortcut (#406)

* Update samples/shabda documentation

* Prettier doc file

* fixed

* document function

* fixed example test failure

* add recipes

* add understand cycles

* move stuff around

* fix: loud example

* format

* Add test snapshots for shabda shortcut

* fix: trailing slash confusion

* fix: trailing slash confusion

* fix: try different trailing slash behavior

* completely revert config mess

* Fix krill build command in README

* Support international alphabets in mininotation

* Add a human-readable error message for invalid char in step

* Revert error message length limitation

* use new vite-pwa-astro version from file

* basic hydra integration

* add play function

* also return pat

* add docs + fix hydra for mini repl

* add H function to plug patterns into Hydra

* document H function

* ignore hydra.mjs in linter

* add px in zen mode to fix logo overlap

* fix: flip scope in y direction

* fix: additive synthesis

* fix: scale offset

* Document striate function

* Document adsr function

* replace strudel.tidalcycles.org with strudel.cc

* functions

* move to signal file with other choose functions

* use 0.1.4 @vite-pwa/astro

* use new flag

* snapshots

* add doc chapters

* integrated vscode bindings

* Fix chunk, add fastChunk and repeatCycles (#712)

* Match behaviour of chunk with tidal, add fastChunk for old strudel behaviour. Also adds repeatCycles. fixes #689

* documentation

* (hopefully) fixed broken lock file

* Update CONTRIBUTING.md

fix prettier instructions

* fixed style issues

* fix: share copy to clipboard + alert

* rename bindings key

* remove obsolete config

* update to astro 3

* no double !

* initial commit

* add xfade + docs

* snapshot

* fix: namespace mini-repl styles

* Implement optional hover tooltip with function documentation

* Add pianoroll function documentation

* Add label function documentation

* Add color function documentation

* Fix pianoroll documentation

* Add function params in reference tab

* Update pianoroll documentation

* tweaking to make it sound good

* fix: scope pos

* document scope functions

* snapshot

* samples loading shortcuts:
- use main branch by default in github shortcut
- add bubo shortcut

* don't use anchor links for reference

* change to bus effect experiment

* Update first-sounds.mdx

in eine sogenannte Funktion -> in einer sogenannten Funktion

* Update first-effects.mdx

grammatical amendments

* Update pattern-effects.mdx

grammatical amendments

* Update recap.mdx

Adds a few missing translations

* FIXES: table

* cleaning up

* cleaning up

* cleaning up

* turn off of depth is 0

* update doc

* create free running lfos for different orbits

* add more parameters

* fixed doc

* snapshots

* phaser shortcuts

* doc: phaser synonyms

* add params to superdough readme

* add to doc page

* dedupe / move supertdirt phaser controls

* format

* simplify

* refactor: move vibrato up + cleanup oscillator

* fix: sampler broke without vibrato

* support multiple named serial connections, change default baudrate to 115200 (#551)

* Document wordfall

* Document slider

* Document euclidLegatoRot

* Add snapshot for euclidLegatoRot

* remove unwanted cm6 outline for strudelTheme

* move fix to Repl.css

* fix codeformat

* add option to disable active line highlighting in Code Settings

* fix typo

* remove pseudo note variables

* p and q methods + all function

* + add hush
+ add the ability to evaluate without clearing

* fix tests

* add q1 .. q9 shortcuts

* add p1 .. p9 shortcuts as well

* bump superdough

* Mark optional slider params

---------

Co-authored-by: Felix Roos <flix91@gmail.com>
Co-authored-by: Raphael Forment <raphael.forment@gmail.com>
Co-authored-by: Vasilii Milovidov <vasily.milovidov@gmail.com>
Co-authored-by: Alexandre G.-Raymond <alex@ndre.gr>
Co-authored-by: Jade Rowland <jaderowlanddev@gmail.com>
Co-authored-by: Dsm0 <willrinkoff@gmail.com>
Co-authored-by: Will <45471522+Dsm0@users.noreply.github.com>
Co-authored-by: Bernhard Wagner <github.comNotification20120125@xmlizer.net>
Co-authored-by: Bernhard Wagner <gitcommit@nosuch.biz>
Co-authored-by: Kaspars <kasparsj@gmail.com>
Co-authored-by: Alexandre Gravel-Raymond <agravelraymond@deezer.com>
  • Loading branch information
12 people committed Nov 17, 2023
1 parent 46312bd commit 28ccdd5
Show file tree
Hide file tree
Showing 113 changed files with 7,385 additions and 3,742 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ vite.config.js
**/*.json
**/dev-dist
**/dist
/src-tauri/target/**/*
/src-tauri/target/**/*
reverbGen.mjs
hydra.mjs
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To get in touch with the contributors, either
## Ask a Question

If you have any questions about strudel, make sure you've glanced through the
[docs](https://strudel.tidalcycles.org/learn/) to find out if it answers your question.
[docs](https://strudel.cc/learn/) to find out if it answers your question.
If not, use one of the Communication Channels above!

Don't be afraid to ask! Your question might be of great value for other people too.
Expand All @@ -31,7 +31,7 @@ Use one of the Communication Channels listed above.

## Improve the Docs

If you find some weak spots in the [docs](https://strudel.tidalcycles.org/workshop/getting-started/),
If you find some weak spots in the [docs](https://strudel.cc/workshop/getting-started/),
you can edit each file directly on github via the "Edit this page" link located in the right sidebar.

## Propose a Feature
Expand Down Expand Up @@ -83,7 +83,7 @@ Please report any problems you've had with the setup instructions!

To make sure the code changes only where it should, we are using prettier to unify the code style.

- You can format all files at once by running `pnpm prettier` from the project root
- You can format all files at once by running `pnpm codeformat` from the project root
- Run `pnpm format-check` from the project root to check if all files are well formatted

If you use VSCode, you can
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

An experiment in making a [Tidal](https://github.com/tidalcycles/tidal/) using web technologies. This software is slowly stabilising, but please continue to tread carefully.

- Try it here: <https://strudel.tidalcycles.org/>
- Docs: <https://strudel.tidalcycles.org/learn/>
- Try it here: <https://strudel.cc>
- Docs: <https://strudel.cc/learn>
- Technical Blog Post: <https://loophole-letters.vercel.app/strudel>
- 1 Year of Strudel Blog Post: <https://loophole-letters.vercel.app/strudel1year>

Expand Down
2 changes: 1 addition & 1 deletion my-patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ If you want to automatically deploy your site on push, go to `deploy.yml` and ch
## running locally

- install dependencies with `npm run setup`
- run dev server with `npm run repl` and open `http://localhost:3000/strudel/swatch/`
- run dev server with `npm run repl` and open `http://localhost:4321/strudel/swatch/`

## tests fail?

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"bugs": {
"url": "https://github.com/tidalcycles/strudel/issues"
},
"homepage": "https://strudel.tidalcycles.org",
"homepage": "https://strudel.cc",
"dependencies": {
"@strudel.cycles/core": "workspace:*",
"@strudel.cycles/mini": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions packages/codemirror/index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './codemirror.mjs';
export * from './highlight.mjs';
export * from './flash.mjs';
export * from './slider.mjs';
144 changes: 144 additions & 0 deletions packages/codemirror/slider.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { ref, pure } from '@strudel.cycles/core';
import { WidgetType, ViewPlugin, Decoration } from '@codemirror/view';
import { StateEffect, StateField } from '@codemirror/state';

export let sliderValues = {};
const getSliderID = (from) => `slider_${from}`;

export class SliderWidget extends WidgetType {
constructor(value, min, max, from, to, step, view) {
super();
this.value = value;
this.min = min;
this.max = max;
this.from = from;
this.originalFrom = from;
this.to = to;
this.step = step;
this.view = view;
}

eq() {
return false;
}

toDOM() {
let wrap = document.createElement('span');
wrap.setAttribute('aria-hidden', 'true');
wrap.className = 'cm-slider'; // inline-flex items-center
let slider = wrap.appendChild(document.createElement('input'));
slider.type = 'range';
slider.min = this.min;
slider.max = this.max;
slider.step = this.step ?? (this.max - this.min) / 1000;
slider.originalValue = this.value;
// to make sure the code stays in sync, let's save the original value
// becuase .value automatically clamps values so it'll desync with the code
slider.value = slider.originalValue;
slider.from = this.from;
slider.originalFrom = this.originalFrom;
slider.to = this.to;
slider.style = 'width:64px;margin-right:4px;transform:translateY(4px)';
this.slider = slider;
slider.addEventListener('input', (e) => {
const next = e.target.value;
let insert = next;
//let insert = next.toFixed(2);
const to = slider.from + slider.originalValue.length;
let change = { from: slider.from, to, insert };
slider.originalValue = insert;
slider.value = insert;
this.view.dispatch({ changes: change });
const id = getSliderID(slider.originalFrom); // matches id generated in transpiler
window.postMessage({ type: 'cm-slider', value: Number(next), id });
});
return wrap;
}

ignoreEvent(e) {
return true;
}
}

export const setWidgets = StateEffect.define();

export const updateWidgets = (view, widgets) => {
view.dispatch({ effects: setWidgets.of(widgets) });
};

function getWidgets(widgetConfigs, view) {
return widgetConfigs.map(({ from, to, value, min, max, step }) => {
return Decoration.widget({
widget: new SliderWidget(value, min, max, from, to, step, view),
side: 0,
}).range(from /* , to */);
});
}

export const sliderPlugin = ViewPlugin.fromClass(
class {
decorations; //: DecorationSet

constructor(view /* : EditorView */) {
this.decorations = Decoration.set([]);
}

update(update /* : ViewUpdate */) {
update.transactions.forEach((tr) => {
if (tr.docChanged) {
this.decorations = this.decorations.map(tr.changes);
const iterator = this.decorations.iter();
while (iterator.value) {
// when the widgets are moved, we need to tell the dom node the current position
// this is important because the updateSliderValue function has to work with the dom node
if (iterator.value?.widget?.slider) {
iterator.value.widget.slider.from = iterator.from;
iterator.value.widget.slider.to = iterator.to;
}
iterator.next();
}
}
for (let e of tr.effects) {
if (e.is(setWidgets)) {
this.decorations = Decoration.set(getWidgets(e.value, update.view));
}
}
});
}
},
{
decorations: (v) => v.decorations,
},
);

/**
* Displays a slider widget to allow the user manipulate a value
*
* @name slider
* @param {number} value Initial value
* @param {number} min Minimum value - optional, defaults to 0
* @param {number} max Maximum value - optional, defaults to 1
* @param {number} step Step size - optional
*/
export let slider = (value) => {
console.warn('slider will only work when the transpiler is used... passing value as is');
return pure(value);
};
// function transpiled from slider = (value, min, max)
export let sliderWithID = (id, value, min, max) => {
sliderValues[id] = value; // sync state at eval time (code -> state)
return ref(() => sliderValues[id]); // use state at query time
};
// update state when sliders are moved
if (typeof window !== 'undefined') {
window.addEventListener('message', (e) => {
if (e.data.type === 'cm-slider') {
if (sliderValues[e.data.id] !== undefined) {
// update state when slider is moved
sliderValues[e.data.id] = e.data.value;
} else {
console.warn(`slider with id "${e.data.id}" is not registered. Only ${Object.keys(sliderValues)}`);
}
}
});
}

0 comments on commit 28ccdd5

Please sign in to comment.