This commit is contained in:
Felix Roos 2022-03-23 18:18:20 +01:00
parent 68b5fc40f6
commit 2441e70153
5 changed files with 61 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import {isNote, toMidi} from "./util.js";
const removeUndefineds = (xs) => xs.filter((x) => x != void 0);
const flatten = (arr) => [].concat(...arr);
const id = (a) => a;
const range = (min, max) => Array.from({length: max - min + 1}, (_, i) => i + min);
export function curry(func, overload) {
const fn = function curried(...args) {
if (args.length >= func.length) {
@ -526,6 +527,15 @@ class Pattern {
superimpose(...funcs) {
return this.stack(...funcs.map((func) => func(this)));
}
stutWith(times, time, func) {
return stack(...range(0, times - 1).map((i) => func(this.late(i * time), i)));
}
stut(times, feedback, time) {
return this.stutWith(times, time, (pat, i) => pat.velocity(Math.pow(feedback, i)));
}
iter(times) {
return slowcat(...range(0, times - 1).map((i) => this.early(i / times)));
}
edit(...funcs) {
return stack(...funcs.map((func) => func(this)));
}
@ -771,5 +781,7 @@ export {
struct,
mask,
invert,
inv
inv,
id,
range
};

24
docs/dist/tunes.js vendored
View File

@ -560,3 +560,27 @@ stack(
.legato(cosine.struct("x*8").add(4/5).mul(4/5).fast(8))
.velocity(sine.struct("x*8").add(3/5).mul(2/5).fast(8))
.tone((await piano()).chain(out())).fast(3/4)`;
export const undergroundPlumber = `backgroundImage('https://images.nintendolife.com/news/2016/08/video_exploring_the_funky_inspiration_for_the_super_mario_bros_underground_theme/large.jpg',{
className:'darken'
})
const drums = await players({
bd: 'bd/BT0A0D0.wav',
sn: 'sn/ST0T0S3.wav',
hh: 'hh/000_hh3closedhh.wav',
cp: 'cp/HANDCLP0.wav',
}, 'https://loophole-letters.vercel.app/samples/tidal/')
stack(
"<<bd*2 bd> sn> hh".fast(4).slow(2).tone(drums.chain(vol(.5),out())),
stack(
"[c2 a1 bb1 ~] ~"
.stut(2, .6, 1/16)
.legato(.4)
.slow(2)
.tone(synth({...osc('sawtooth7'),...adsr(0,.3,0)}).chain(out())),
"[g2,[c3 eb3]]".iter(4)
.stutWith(4, 1/4, (x,n)=>x.transpose(n*12).velocity(Math.pow(.4,n)))
.legato(.1)
)
.transpose("<0@2 5 0 7 5 0 -5>/2")
.pianoroll({minMidi:21,maxMidi:180, background:'transparent',inactive:'#3F8F90',active:'#DE3123'})
)`;

View File

@ -42144,6 +42144,10 @@ parcelHelpers.export(exports, "invert", ()=>invert
);
parcelHelpers.export(exports, "inv", ()=>inv
);
parcelHelpers.export(exports, "id", ()=>id
);
parcelHelpers.export(exports, "range", ()=>range
);
var _fractionMjs = require("./fraction.mjs");
var _fractionMjsDefault = parcelHelpers.interopDefault(_fractionMjs);
var _ramda = require("ramda"); // will remove this as soon as compose is implemented here
@ -42156,6 +42160,11 @@ const flatten = (arr)=>[].concat(...arr)
;
const id = (a)=>a
;
const range = (min, max)=>Array.from({
length: max - min + 1
}, (_, i)=>i + min
)
;
function curry(func, overload) {
const fn = function curried(...args) {
if (args.length >= func.length) return func.apply(this, args);
@ -42818,6 +42827,18 @@ class Pattern {
return this.stack(...funcs.map((func)=>func(this)
));
}
stutWith(times, time, func) {
return stack(...range(0, times - 1).map((i)=>func(this.late(i * time), i)
));
}
stut(times, feedback, time) {
return this.stutWith(times, time, (pat, i)=>pat.velocity(Math.pow(feedback, i))
);
}
iter(times) {
return slowcat(...range(0, times - 1).map((i)=>this.early(i / times)
));
}
edit(...funcs) {
return stack(...funcs.map((func)=>func(this)
));
@ -183306,4 +183327,4 @@ exports.default = cx;
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
//# sourceMappingURL=index.7cec804e.js.map
//# sourceMappingURL=index.95a69858.js.map

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,6 @@
<body>
<div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript>
<script src="/tutorial/index.7cec804e.js" defer=""></script>
<script src="/tutorial/index.95a69858.js" defer=""></script>
</body>
</html>