mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-25 04:28:30 +00:00
build
This commit is contained in:
parent
88bcfc5e48
commit
c263eac7fd
15
docs/dist/App.js
vendored
15
docs/dist/App.js
vendored
@ -1,10 +1,11 @@
|
|||||||
import React, {useCallback, useLayoutEffect, useRef, useState} from "../_snowpack/pkg/react.js";
|
import React, {useCallback, useLayoutEffect, useRef, useState} from "../_snowpack/pkg/react.js";
|
||||||
import * as Tone from "../_snowpack/pkg/tone.js";
|
|
||||||
import CodeMirror, {markEvent, markParens} from "./CodeMirror.js";
|
import CodeMirror, {markEvent, markParens} from "./CodeMirror.js";
|
||||||
import cx from "./cx.js";
|
import cx from "./cx.js";
|
||||||
import {evaluate} from "./evaluate.js";
|
import {evaluate} from "./evaluate.js";
|
||||||
import logo from "./logo.svg.proxy.js";
|
import logo from "./logo.svg.proxy.js";
|
||||||
import {useWebMidi} from "./midi.js";
|
import {useWebMidi} from "./midi.js";
|
||||||
|
import playStatic from "./static.js";
|
||||||
|
import {defaultSynth} from "./tone.js";
|
||||||
import * as tunes from "./tunes.js";
|
import * as tunes from "./tunes.js";
|
||||||
import useRepl from "./useRepl.js";
|
import useRepl from "./useRepl.js";
|
||||||
const [_, codeParam] = window.location.href.split("#");
|
const [_, codeParam] = window.location.href.split("#");
|
||||||
@ -14,13 +15,6 @@ try {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn("failed to decode", err);
|
console.warn("failed to decode", err);
|
||||||
}
|
}
|
||||||
const defaultSynth = new Tone.PolySynth().chain(new Tone.Gain(0.5), Tone.getDestination());
|
|
||||||
defaultSynth.set({
|
|
||||||
oscillator: {type: "triangle"},
|
|
||||||
envelope: {
|
|
||||||
release: 0.01
|
|
||||||
}
|
|
||||||
});
|
|
||||||
function getRandomTune() {
|
function getRandomTune() {
|
||||||
const allTunes = Object.values(tunes);
|
const allTunes = Object.values(tunes);
|
||||||
const randomItem = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
const randomItem = (arr) => arr[Math.floor(Math.random() * arr.length)];
|
||||||
@ -145,6 +139,9 @@ function App() {
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
ref: logBox,
|
ref: logBox,
|
||||||
style: {fontFamily: "monospace"}
|
style: {fontFamily: "monospace"}
|
||||||
})));
|
})), /* @__PURE__ */ React.createElement("button", {
|
||||||
|
className: "fixed right-4 bottom-2 z-[11]",
|
||||||
|
onClick: () => playStatic(code)
|
||||||
|
}, "static"));
|
||||||
}
|
}
|
||||||
export default App;
|
export default App;
|
||||||
|
|||||||
48
docs/dist/static.js
vendored
Normal file
48
docs/dist/static.js
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import * as Tone from "../_snowpack/pkg/tone.js";
|
||||||
|
import {State, TimeSpan} from "../_snowpack/link/strudel.js";
|
||||||
|
import {getPlayableNoteValue} from "../_snowpack/link/util.js";
|
||||||
|
import {evaluate} from "./evaluate.js";
|
||||||
|
async function playStatic(code) {
|
||||||
|
let start, took;
|
||||||
|
const seconds = Number(prompt("How many seconds to run?")) || 60;
|
||||||
|
start = performance.now();
|
||||||
|
const {pattern: pat} = await evaluate(code);
|
||||||
|
took = performance.now() - start;
|
||||||
|
console.log("evaluate took", took, "ms");
|
||||||
|
Tone.getTransport().stop();
|
||||||
|
start = performance.now();
|
||||||
|
const events = pat?.query(new State(new TimeSpan(0, seconds)))?.filter((event) => event.part.begin.valueOf() === event.whole.begin.valueOf())?.map((event) => ({
|
||||||
|
time: event.whole.begin.valueOf(),
|
||||||
|
duration: event.whole.end.sub(event.whole.begin).valueOf(),
|
||||||
|
value: event.value,
|
||||||
|
context: event.context
|
||||||
|
}));
|
||||||
|
took = performance.now() - start;
|
||||||
|
console.log("query took", took, "ms");
|
||||||
|
start = performance.now();
|
||||||
|
events.forEach((event) => {
|
||||||
|
Tone.getTransport().schedule((time) => {
|
||||||
|
try {
|
||||||
|
const {onTrigger, velocity} = event.context;
|
||||||
|
if (!onTrigger) {
|
||||||
|
if (defaultSynth) {
|
||||||
|
const note = getPlayableNoteValue(event);
|
||||||
|
defaultSynth.triggerAttackRelease(note, event.duration, time, velocity);
|
||||||
|
} else {
|
||||||
|
throw new Error("no defaultSynth passed to useRepl.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onTrigger(time, event);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err);
|
||||||
|
err.message = "unplayable event: " + err?.message;
|
||||||
|
pushLog(err.message);
|
||||||
|
}
|
||||||
|
}, event.time);
|
||||||
|
});
|
||||||
|
took = performance.now() - start;
|
||||||
|
console.log("schedule took", took, "ms");
|
||||||
|
Tone.getTransport().start("+0.5");
|
||||||
|
}
|
||||||
|
export default playStatic;
|
||||||
7
docs/dist/tone.js
vendored
7
docs/dist/tone.js
vendored
@ -20,6 +20,13 @@ import {
|
|||||||
} from "../_snowpack/pkg/tone.js";
|
} from "../_snowpack/pkg/tone.js";
|
||||||
import {Piano} from "../_snowpack/pkg/@tonejs/piano.js";
|
import {Piano} from "../_snowpack/pkg/@tonejs/piano.js";
|
||||||
import {getPlayableNoteValue} from "../_snowpack/link/util.js";
|
import {getPlayableNoteValue} from "../_snowpack/link/util.js";
|
||||||
|
export const defaultSynth = new PolySynth().chain(new Gain(0.5), getDestination());
|
||||||
|
defaultSynth.set({
|
||||||
|
oscillator: {type: "triangle"},
|
||||||
|
envelope: {
|
||||||
|
release: 0.01
|
||||||
|
}
|
||||||
|
});
|
||||||
const Pattern = _Pattern;
|
const Pattern = _Pattern;
|
||||||
Pattern.prototype.tone = function(instrument) {
|
Pattern.prototype.tone = function(instrument) {
|
||||||
return this._withEvent((event) => {
|
return this._withEvent((event) => {
|
||||||
|
|||||||
@ -933,6 +933,9 @@ select {
|
|||||||
.static {
|
.static {
|
||||||
position: static;
|
position: static;
|
||||||
}
|
}
|
||||||
|
.fixed {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
.absolute {
|
.absolute {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
@ -955,9 +958,15 @@ select {
|
|||||||
.bottom-2 {
|
.bottom-2 {
|
||||||
bottom: 0.5rem;
|
bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
|
.right-4 {
|
||||||
|
right: 1rem;
|
||||||
|
}
|
||||||
.z-\[10\] {
|
.z-\[10\] {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
.z-\[11\] {
|
||||||
|
z-index: 11;
|
||||||
|
}
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -678,6 +678,8 @@ Ensure the default browser behavior of the `hidden` attribute.
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}.static {
|
}.static {
|
||||||
position: static;
|
position: static;
|
||||||
|
}.fixed {
|
||||||
|
position: fixed;
|
||||||
}.absolute {
|
}.absolute {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}.relative {
|
}.relative {
|
||||||
@ -693,8 +695,12 @@ Ensure the default browser behavior of the `hidden` attribute.
|
|||||||
right: 0.5rem;
|
right: 0.5rem;
|
||||||
}.bottom-2 {
|
}.bottom-2 {
|
||||||
bottom: 0.5rem;
|
bottom: 0.5rem;
|
||||||
|
}.right-4 {
|
||||||
|
right: 1rem;
|
||||||
}.z-\[10\] {
|
}.z-\[10\] {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
|
}.z-\[11\] {
|
||||||
|
z-index: 11;
|
||||||
}.block {
|
}.block {
|
||||||
display: block;
|
display: block;
|
||||||
}.flex {
|
}.flex {
|
||||||
@ -1363,4 +1369,4 @@ span.CodeMirror-selectedtext { background: none; }
|
|||||||
color: white !important;
|
color: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*# sourceMappingURL=index.c844960c.css.map */
|
/*# sourceMappingURL=index.2798a8d1.css.map */
|
||||||
1
docs/tutorial/index.2798a8d1.css.map
Normal file
1
docs/tutorial/index.2798a8d1.css.map
Normal file
File diff suppressed because one or more lines are too long
@ -56757,6 +56757,8 @@ exports.default = thunkify;
|
|||||||
},{"./curryN.js":"jngJ1","./internal/_curry1.js":"kHmsM","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"aBpVm":[function(require,module,exports) {
|
},{"./curryN.js":"jngJ1","./internal/_curry1.js":"kHmsM","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"aBpVm":[function(require,module,exports) {
|
||||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||||
parcelHelpers.defineInteropFlag(exports);
|
parcelHelpers.defineInteropFlag(exports);
|
||||||
|
parcelHelpers.export(exports, "defaultSynth", ()=>defaultSynth
|
||||||
|
);
|
||||||
parcelHelpers.export(exports, "amsynth", ()=>amsynth
|
parcelHelpers.export(exports, "amsynth", ()=>amsynth
|
||||||
);
|
);
|
||||||
parcelHelpers.export(exports, "duosynth", ()=>duosynth
|
parcelHelpers.export(exports, "duosynth", ()=>duosynth
|
||||||
@ -56807,6 +56809,15 @@ var _strudelMjs = require("../../strudel.mjs");
|
|||||||
var _tone = require("tone");
|
var _tone = require("tone");
|
||||||
var _piano = require("@tonejs/piano");
|
var _piano = require("@tonejs/piano");
|
||||||
var _utilMjs = require("../../util.mjs");
|
var _utilMjs = require("../../util.mjs");
|
||||||
|
const defaultSynth = new _tone.PolySynth().chain(new _tone.Gain(0.5), _tone.getDestination());
|
||||||
|
defaultSynth.set({
|
||||||
|
oscillator: {
|
||||||
|
type: 'triangle'
|
||||||
|
},
|
||||||
|
envelope: {
|
||||||
|
release: 0.01
|
||||||
|
}
|
||||||
|
});
|
||||||
// what about
|
// what about
|
||||||
// https://www.charlie-roberts.com/gibberish/playground/
|
// https://www.charlie-roberts.com/gibberish/playground/
|
||||||
const Pattern = _strudelMjs.Pattern;
|
const Pattern = _strudelMjs.Pattern;
|
||||||
@ -183303,4 +183314,4 @@ exports.default = cx;
|
|||||||
|
|
||||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
||||||
|
|
||||||
//# sourceMappingURL=index.f8c9aeff.js.map
|
//# sourceMappingURL=index.c6dd21ba.js.map
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="icon" href="/tutorial/favicon.e3ab9dd9.ico">
|
<link rel="icon" href="/tutorial/favicon.e3ab9dd9.ico">
|
||||||
<link rel="stylesheet" type="text/css" href="/tutorial/index.c844960c.css">
|
<link rel="stylesheet" type="text/css" href="/tutorial/index.2798a8d1.css">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="description" content="Strudel REPL">
|
<meta name="description" content="Strudel REPL">
|
||||||
<title>Strudel Tutorial</title>
|
<title>Strudel Tutorial</title>
|
||||||
@ -11,6 +11,6 @@
|
|||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<script src="/tutorial/index.f8c9aeff.js" defer=""></script>
|
<script src="/tutorial/index.c6dd21ba.js" defer=""></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user