mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 21:58:37 +00:00
build tutorial
This commit is contained in:
parent
9644a54f67
commit
82b75e2690
@ -7462,7 +7462,7 @@ For sharp notes, the letter "s" is used instead of "#", because JavaScript does
|
||||
tune: `"e4"`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `Using strings, you can also use "#".`), /*#__PURE__*/ _react1.mdx("h2", null, `Functions that create Patterns`), /*#__PURE__*/ _react1.mdx("p", null, `The following functions will return a pattern. We will see later what that means.`), /*#__PURE__*/ _react1.mdx("h2", null, `pure(value)`), /*#__PURE__*/ _react1.mdx("p", null, `To create a pattern from a value, you can wrap the value in pure:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `pure(e4)`,
|
||||
tune: `pure('e4')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `Most of the time, you won't need that function as input values of pattern creating functions are purified by default.`), /*#__PURE__*/ _react1.mdx("h3", null, `cat(...values)`), /*#__PURE__*/ _react1.mdx("p", null, `The given items are con`, /*#__PURE__*/ _react1.mdx("strong", {
|
||||
parentName: "p"
|
||||
@ -7541,37 +7541,63 @@ For sharp notes, the letter "s" is used instead of "#", because JavaScript does
|
||||
tune: `cat(e5, pure(b4).every(4, x => x.late(0.5)))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `add(n)`), /*#__PURE__*/ _react1.mdx("p", null, `Adds the given number to each item in the pattern:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `stack(0, 2, 4).add(slowcat(0, -2, -4, -5)).scale('C minor')`,
|
||||
tune: `"0 2 4".add("<0 3 4 0>").scale('C major')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `Functions not documented yet`), /*#__PURE__*/ _react1.mdx("ul", null, /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `add`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `sub`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `sub`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `mul`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `div`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `union`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `every`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `when`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `off`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `jux`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `append`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `superimpose`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `internal Pattern functions?`), /*#__PURE__*/ _react1.mdx("li", {
|
||||
parentName: "ul"
|
||||
}, `struct`)), /*#__PURE__*/ _react1.mdx("h2", null, `Tone API`), /*#__PURE__*/ _react1.mdx("p", null, `To make the sounds more interesting, we can use Tone.js instruments ands effects.`), /*#__PURE__*/ _react1.mdx("p", null, /*#__PURE__*/ _react1.mdx("a", {
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `Here, the triad `, /*#__PURE__*/ _react1.mdx("inlineCode", {
|
||||
parentName: "p"
|
||||
}, `0, 2, 4`), ` is shifted by different amounts. Without add, the equivalent would be:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"<[0 2 4] [3 5 7] [4 6 8] [0 2 4]>".scale('C major')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `You can also use add with notes:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c3 e3 g3".add("<0 5 7 0>")`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `Behind the scenes, the notes are converted to midi numbers as soon before add is applied, which is equivalent to:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"48 52 55".add("<0 5 7 0>")`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `sub(n)`), /*#__PURE__*/ _react1.mdx("p", null, `Like add, but the given numbers are subtracted:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"0 2 4".sub("<0 1 2 3>").scale('C4 minor')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `See add for more information.`), /*#__PURE__*/ _react1.mdx("h3", null, `mul(n)`), /*#__PURE__*/ _react1.mdx("p", null, `Multiplies each number by the given factor:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"0,1,2".mul("<2 3 4 3>").scale('C4 minor')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `... is equivalent to:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"<[0,2,4] [0,3,6] [0,4,8] [0,3,6]>".scale('C4 minor')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `This function is really useful in combination with signals:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `sine.struct("x*16").mul(7).round().scale('C major')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `Here, we sample a sine wave 16 times, and multiply each sample by 7. This way, we let values oscillate between 0 and 7.`), /*#__PURE__*/ _react1.mdx("h3", null, `div(n)`), /*#__PURE__*/ _react1.mdx("p", null, `Like mul, but dividing by the given number.`), /*#__PURE__*/ _react1.mdx("h3", null, `round()`), /*#__PURE__*/ _react1.mdx("p", null, `Rounds all values to the nearest integer:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"0.5 1.5 2.5".round().scale('C major')`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `struct(binary_pat)`), /*#__PURE__*/ _react1.mdx("p", null, `Applies the given structure to the pattern:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c3,eb3,g3".struct("x ~ x ~ ~ x ~ x ~ ~ ~ x ~ x ~ ~").slow(4)`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `This is also useful to sample signals:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `sine.struct("x ~ x ~ ~ x ~ x ~ ~ ~ x ~ x ~ ~").mul(7).round()
|
||||
.scale('C minor').slow(4)`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `when(binary_pat, func)`), /*#__PURE__*/ _react1.mdx("p", null, `Applies the given function whenever the given pattern is in a true state.`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c3 eb3 g3".when("<0 1>/2", sub(5))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `superimpose(...func)`), /*#__PURE__*/ _react1.mdx("p", null, `Superimposes the result of the given function(s) on top of the original pattern:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"<c3 eb3 g3>".scale('C minor').superimpose(scaleTranspose("2,4"))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `layer(...func)`), /*#__PURE__*/ _react1.mdx("p", null, `Layers the result of the given function(s) on top of each other. Like superimpose, but the original pattern is not part of the result.`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"<c3 eb3 g3>".scale('C minor').layer(scaleTranspose("0,2,4"))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `apply(func)`), /*#__PURE__*/ _react1.mdx("p", null, `Like layer, but with a single function:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"<c3 eb3 g3>".scale('C minor').apply(scaleTranspose("0,2,4"))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `off(time, func)`), /*#__PURE__*/ _react1.mdx("p", null, `Applies the given function by the given time offset:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c3 eb3 g3".off(1/8, add(7))`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `append(pat)`), /*#__PURE__*/ _react1.mdx("p", null, `Appends the given pattern after the current pattern:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c4,eb4,g4".append("c4,f4,ab4")`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h3", null, `stack(pat)`), /*#__PURE__*/ _react1.mdx("p", null, `Stacks the given pattern to the current pattern:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"c4,eb4,g4".stack("bb4,d5")`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h2", null, `Tone API`), /*#__PURE__*/ _react1.mdx("p", null, `To make the sounds more interesting, we can use Tone.js instruments ands effects.`), /*#__PURE__*/ _react1.mdx("p", null, /*#__PURE__*/ _react1.mdx("a", {
|
||||
parentName: "p",
|
||||
"href": "https://github.com/tidalcycles/strudel/blob/main/repl/src/tone.ts"
|
||||
}, `Show Source on Github`)), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
@ -7604,9 +7630,38 @@ const monosynth = (options) => new MonoSynth(options);
|
||||
const noise = (options) => new NoiseSynth(options);
|
||||
const pluck = (options) => new PluckSynth(options);
|
||||
const polysynth = (options) => new PolySynth(options);
|
||||
const sampler = (options) => new Sampler(options);
|
||||
const synth = (options) => new Synth(options);
|
||||
`)), /*#__PURE__*/ _react1.mdx("h3", null, `out`), /*#__PURE__*/ _react1.mdx("p", null, `Shortcut for Tone.Destination. Intended to be used with Tone's .chain:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
const sampler = (options, baseUrl?) => new Sampler(options); // promisified, see below
|
||||
const players = (options, baseUrl?) => new Sampler(options); // promisified, see below
|
||||
`)), /*#__PURE__*/ _react1.mdx("h3", null, `sampler`), /*#__PURE__*/ _react1.mdx("p", null, `With sampler, you can create tonal instruments from samples:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `sampler({
|
||||
C5: 'https://freesound.org/data/previews/536/536549_11935698-lq.mp3'
|
||||
}).then(kalimba =>
|
||||
saw.struct("x*8").mul(16).round()
|
||||
.legato(4).scale('D dorian').slow(2)
|
||||
.tone(kalimba.toDestination())
|
||||
)`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `The sampler function promisifies `, /*#__PURE__*/ _react1.mdx("a", {
|
||||
parentName: "p",
|
||||
"href": "https://tonejs.github.io/docs/14.7.77/Sampler"
|
||||
}, `Tone.js Sampler`), `.`), /*#__PURE__*/ _react1.mdx("p", null, `Note that this function currently only works with this promise notation, but in the future,
|
||||
it will be possible to use async instruments in a synchronous fashion.`), /*#__PURE__*/ _react1.mdx("h3", null, `players`), /*#__PURE__*/ _react1.mdx("p", null, `With players, you can create sound banks:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `players({
|
||||
bd: 'samples/tidal/bd/BT0A0D0.wav',
|
||||
sn: 'samples/tidal/sn/ST0T0S3.wav',
|
||||
hh: 'samples/tidal/hh/000_hh3closedhh.wav'
|
||||
}, 'https://loophole-letters.vercel.app/')
|
||||
.then(drums=>
|
||||
"bd hh sn hh".tone(drums.toDestination())
|
||||
)
|
||||
`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("p", null, `The sampler function promisifies `, /*#__PURE__*/ _react1.mdx("a", {
|
||||
parentName: "p",
|
||||
"href": "https://tonejs.github.io/docs/14.7.77/Players"
|
||||
}, `Tone.js Players`), `.`), /*#__PURE__*/ _react1.mdx("p", null, `Note that this function currently only works with this promise notation, but in the future,
|
||||
it will be possible to use async instruments in a synchronous fashion.`), /*#__PURE__*/ _react1.mdx("h3", null, `out`), /*#__PURE__*/ _react1.mdx("p", null, `Shortcut for Tone.Destination. Intended to be used with Tone's .chain:`), /*#__PURE__*/ _react1.mdx(_miniReplDefault.default, {
|
||||
tune: `"[c4 c4 bb3 c4] [~ g3 ~ g3] [c4 f4 e4 c4] ~".slow(4)
|
||||
.tone(membrane().chain(out()))`,
|
||||
mdxType: "MiniRepl"
|
||||
@ -7693,7 +7748,7 @@ It would be great to get this to work without glitches though, because it is fun
|
||||
x => x.rootNotes(2).tone(synth(osc('sawtooth4')).chain(out()))
|
||||
)`,
|
||||
mdxType: "MiniRepl"
|
||||
}), /*#__PURE__*/ _react1.mdx("h2", null, `MIDI API`), /*#__PURE__*/ _react1.mdx("p", null, `Strudel also supports midi via `, /*#__PURE__*/ _react1.mdx("a", {
|
||||
}), /*#__PURE__*/ _react1.mdx("h2", null, `Microtonal API`), /*#__PURE__*/ _react1.mdx("p", null, `TODO`), /*#__PURE__*/ _react1.mdx("h2", null, `MIDI API`), /*#__PURE__*/ _react1.mdx("p", null, `Strudel also supports midi via `, /*#__PURE__*/ _react1.mdx("a", {
|
||||
parentName: "p",
|
||||
"href": "https://npmjs.com/package/webmidi"
|
||||
}, `webmidi`), `.`), /*#__PURE__*/ _react1.mdx("h3", null, `midi(outputName?)`), /*#__PURE__*/ _react1.mdx("p", null, `Make sure to have a midi device connected or to use an IAC Driver.
|
||||
@ -182995,4 +183050,4 @@ exports.default = cx;
|
||||
|
||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}]},["3uVTb"], "3uVTb", "parcelRequire94c2")
|
||||
|
||||
//# sourceMappingURL=index.5025d817.js.map
|
||||
//# sourceMappingURL=index.0eba8fed.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -11,6 +11,6 @@
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<script src="/tutorial/index.5025d817.js" defer=""></script>
|
||||
<script src="/tutorial/index.0eba8fed.js" defer=""></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user