mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-22 11:08:35 +00:00
build
This commit is contained in:
parent
8d81458b7f
commit
b95daf7874
@ -132,8 +132,8 @@ class Hap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class Pattern {
|
class Pattern {
|
||||||
constructor(query2) {
|
constructor(query) {
|
||||||
this.query = query2;
|
this.query = query;
|
||||||
}
|
}
|
||||||
_splitQueries() {
|
_splitQueries() {
|
||||||
const pat = this;
|
const pat = this;
|
||||||
@ -172,10 +172,10 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
_appWhole(whole_func, pat_val) {
|
_appWhole(whole_func, pat_val) {
|
||||||
const pat_func = this;
|
const pat_func = this;
|
||||||
query = function(span) {
|
const query = function(span) {
|
||||||
const event_funcs = pat_func.query(span);
|
const event_funcs = pat_func.query(span);
|
||||||
const event_vals = pat_val.query(span);
|
const event_vals = pat_val.query(span);
|
||||||
apply = function(event_func, event_val) {
|
const apply = function(event_func, event_val) {
|
||||||
const s = event_func.part.intersection(event_val.part);
|
const s = event_func.part.intersection(event_val.part);
|
||||||
if (s == void 0) {
|
if (s == void 0) {
|
||||||
return void 0;
|
return void 0;
|
||||||
@ -188,7 +188,7 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
appBoth(pat_val) {
|
appBoth(pat_val) {
|
||||||
const whole_func = function(span_a, span_b) {
|
const whole_func = function(span_a, span_b) {
|
||||||
if (span_a == void 0 || span_B == void 0) {
|
if (span_a == void 0 || span_b == void 0) {
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
return span_a.intersection_e(span_b);
|
return span_a.intersection_e(span_b);
|
||||||
@ -197,7 +197,7 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
appLeft(pat_val) {
|
appLeft(pat_val) {
|
||||||
const pat_func = this;
|
const pat_func = this;
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const haps = [];
|
const haps = [];
|
||||||
for (const hap_func of pat_func.query(span)) {
|
for (const hap_func of pat_func.query(span)) {
|
||||||
const event_vals = pat_val.query(hap_func.part);
|
const event_vals = pat_val.query(hap_func.part);
|
||||||
@ -211,11 +211,11 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
return haps;
|
return haps;
|
||||||
};
|
};
|
||||||
return new Pattern(query2);
|
return new Pattern(query);
|
||||||
}
|
}
|
||||||
appRight(pat_val) {
|
appRight(pat_val) {
|
||||||
const pat_func = this;
|
const pat_func = this;
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const haps = [];
|
const haps = [];
|
||||||
for (const hap_val of pat_val.query(span)) {
|
for (const hap_val of pat_val.query(span)) {
|
||||||
const hap_funcs = pat_func.query(hap_val.part);
|
const hap_funcs = pat_func.query(hap_val.part);
|
||||||
@ -229,7 +229,7 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
return haps;
|
return haps;
|
||||||
};
|
};
|
||||||
return new Pattern(query2);
|
return new Pattern(query);
|
||||||
}
|
}
|
||||||
get firstCycle() {
|
get firstCycle() {
|
||||||
return this.query(new TimeSpan(Fraction(0), Fraction(1)));
|
return this.query(new TimeSpan(Fraction(0), Fraction(1)));
|
||||||
@ -251,7 +251,7 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
_bindWhole(choose_whole, func) {
|
_bindWhole(choose_whole, func) {
|
||||||
const pat_val = this;
|
const pat_val = this;
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const withWhole = function(a, b) {
|
const withWhole = function(a, b) {
|
||||||
return new Hap(choose_whole(a.whole, b.whole), b.part, b.value);
|
return new Hap(choose_whole(a.whole, b.whole), b.part, b.value);
|
||||||
};
|
};
|
||||||
@ -260,7 +260,7 @@ class Pattern {
|
|||||||
};
|
};
|
||||||
return flatten(pat_val.query(span).map((a) => match(a)));
|
return flatten(pat_val.query(span).map((a) => match(a)));
|
||||||
};
|
};
|
||||||
return new Pattern(query2);
|
return new Pattern(query);
|
||||||
}
|
}
|
||||||
bind(func) {
|
bind(func) {
|
||||||
const whole_func = function(a, b) {
|
const whole_func = function(a, b) {
|
||||||
@ -364,7 +364,7 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
rev() {
|
rev() {
|
||||||
const pat = this;
|
const pat = this;
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const cycle = span.begin.sam();
|
const cycle = span.begin.sam();
|
||||||
const next_cycle = span.begin.nextSam();
|
const next_cycle = span.begin.nextSam();
|
||||||
const reflect = function(to_reflect) {
|
const reflect = function(to_reflect) {
|
||||||
@ -377,7 +377,7 @@ class Pattern {
|
|||||||
const haps = pat.query(reflect(span));
|
const haps = pat.query(reflect(span));
|
||||||
return haps.map((hap) => hap.withSpan(reflect));
|
return haps.map((hap) => hap.withSpan(reflect));
|
||||||
};
|
};
|
||||||
return new Pattern(query2)._splitQueries();
|
return new Pattern(query)._splitQueries();
|
||||||
}
|
}
|
||||||
jux(func, by = 1) {
|
jux(func, by = 1) {
|
||||||
by /= 2;
|
by /= 2;
|
||||||
@ -394,10 +394,10 @@ class Pattern {
|
|||||||
}
|
}
|
||||||
const silence = new Pattern((_) => []);
|
const silence = new Pattern((_) => []);
|
||||||
function pure(value) {
|
function pure(value) {
|
||||||
function query2(span) {
|
function query(span) {
|
||||||
return span.spanCycles.map((subspan) => new Hap(Fraction(subspan.begin).wholeCycle(), subspan, value));
|
return span.spanCycles.map((subspan) => new Hap(Fraction(subspan.begin).wholeCycle(), subspan, value));
|
||||||
}
|
}
|
||||||
return new Pattern(query2);
|
return new Pattern(query);
|
||||||
}
|
}
|
||||||
function steady(value) {
|
function steady(value) {
|
||||||
return new Pattern((span) => Hap(void 0, span, value));
|
return new Pattern((span) => Hap(void 0, span, value));
|
||||||
@ -410,27 +410,27 @@ function reify(thing) {
|
|||||||
}
|
}
|
||||||
function stack(...pats) {
|
function stack(...pats) {
|
||||||
const reified = pats.map((pat) => reify(pat));
|
const reified = pats.map((pat) => reify(pat));
|
||||||
const query2 = (span) => flatten(reified.map((pat) => pat.query(span)));
|
const query = (span) => flatten(reified.map((pat) => pat.query(span)));
|
||||||
return new Pattern(query2);
|
return new Pattern(query);
|
||||||
}
|
}
|
||||||
function slowcat(...pats) {
|
function slowcat(...pats) {
|
||||||
pats = pats.map(reify);
|
pats = pats.map(reify);
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const pat_n = Math.floor(span.begin) % pats.length;
|
const pat_n = Math.floor(span.begin) % pats.length;
|
||||||
const pat = pats[pat_n];
|
const pat = pats[pat_n];
|
||||||
const offset = span.begin.floor().sub(span.begin.div(pats.length).floor());
|
const offset = span.begin.floor().sub(span.begin.div(pats.length).floor());
|
||||||
return pat.withEventTime((t) => t.add(offset)).query(span.withTime((t) => t.sub(offset)));
|
return pat.withEventTime((t) => t.add(offset)).query(span.withTime((t) => t.sub(offset)));
|
||||||
};
|
};
|
||||||
return new Pattern(query2)._splitQueries();
|
return new Pattern(query)._splitQueries();
|
||||||
}
|
}
|
||||||
function slowcatPrime(...pats) {
|
function slowcatPrime(...pats) {
|
||||||
pats = pats.map(reify);
|
pats = pats.map(reify);
|
||||||
const query2 = function(span) {
|
const query = function(span) {
|
||||||
const pat_n = Math.floor(span.begin) % pats.length;
|
const pat_n = Math.floor(span.begin) % pats.length;
|
||||||
const pat = pats[pat_n];
|
const pat = pats[pat_n];
|
||||||
return pat.query(span);
|
return pat.query(span);
|
||||||
};
|
};
|
||||||
return new Pattern(query2)._splitQueries();
|
return new Pattern(query)._splitQueries();
|
||||||
}
|
}
|
||||||
function fastcat(...pats) {
|
function fastcat(...pats) {
|
||||||
return slowcat(...pats)._fast(pats.length);
|
return slowcat(...pats)._fast(pats.length);
|
||||||
|
|||||||
30
docs/dist/tunes.js
vendored
30
docs/dist/tunes.js
vendored
@ -233,25 +233,25 @@ export const swimming = `stack(
|
|||||||
`;
|
`;
|
||||||
export const giantSteps = `stack(
|
export const giantSteps = `stack(
|
||||||
// melody
|
// melody
|
||||||
sequence(
|
mini(
|
||||||
[['F#5', 'D5'], ['B4','G4'], 'Bb4', ['B4','A4']],
|
'[F#5 D5] [B4 G4] Bb4 [B4 A4]',
|
||||||
[['D5', 'Bb4'], ['G4', 'Eb4'], 'F#4', ['G4','F4']],
|
'[D5 Bb4] [G4 Eb4] F#4 [G4 F4]',
|
||||||
['Bb4', ['B4', 'A4'], 'D5', ['D#5', 'C#5']],
|
'Bb4 [B4 A4] D5 [D#5 C#5]',
|
||||||
['F#5', ['G5', 'F5'], 'Bb5', ['F#5', 'F#5']],
|
'F#5 [G5 F5] Bb5 [F#5 F#5]',
|
||||||
),
|
),
|
||||||
// chords
|
// chords
|
||||||
sequence(
|
mini(
|
||||||
[['B^7', 'D7'], ['G^7', 'Bb7'], 'Eb^7', ['Am7', 'D7']],
|
'[B^7 D7] [G^7 Bb7] Eb^7 [Am7 D7]',
|
||||||
[['G^7', 'Bb7'], ['Eb^7', 'F#7'], 'B^7', ['Fm7', 'Bb7']],
|
'[G^7 Bb7] [Eb^7 F#7] B^7 [Fm7 Bb7]',
|
||||||
['Eb^7', ['Am7', 'D7'], 'G^7', ['C#m7', 'F#7']],
|
'Eb^7 [Am7 D7] G^7 [C#m7 F#7]',
|
||||||
['B^7', ['Fm7', 'Bb7'], 'Eb^7', ['C#m7', 'F#7']]
|
'B^7 [Fm7 Bb7] Eb^7 [C#m7 F#7]'
|
||||||
).voicings(['E3', 'G4']),
|
).voicings(['E3', 'G4']),
|
||||||
// bass
|
// bass
|
||||||
sequence(
|
mini(
|
||||||
[['B2', 'D2'], ['G2', 'Bb2'], ['Eb2', 'Bb3'], ['A2', 'D2']],
|
'[B2 D2] [G2 Bb2] [Eb2 Bb3] [A2 D2]',
|
||||||
[['G2', 'Bb2'], ['Eb2', 'F#2'], ['B2', 'F#2'], ['F2', 'Bb2']],
|
'[G2 Bb2] [Eb2 F#2] [B2 F#2] [F2 Bb2]',
|
||||||
[['Eb2','Bb2'], ['A2', 'D2'], ['G2', 'D2'], ['C#2', 'F#2']],
|
'[Eb2 Bb2] [A2 D2] [G2 D2] [C#2 F#2]',
|
||||||
[['B2', 'F#2'], ['F2', 'Bb2'], ['Eb2', 'Bb3'], ['C#2', 'F#2']]
|
'[B2 F#2] [F2 Bb2] [Eb2 Bb3] [C#2 F#2]'
|
||||||
)
|
)
|
||||||
).slow(20);`;
|
).slow(20);`;
|
||||||
export default swimming;
|
export default swimming;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user