Merge pull request #955 from tidalcycles/auto-await-samples

Auto await samples
This commit is contained in:
Felix Roos 2024-02-21 10:27:12 +01:00 committed by GitHub
commit 3d80da9816
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 70 additions and 55 deletions

View File

@ -6,7 +6,7 @@
<script type="module"> <script type="module">
import { initStrudel } from 'https://cdn.skypack.dev/@strudel/web@0.8.2'; import { initStrudel } from 'https://cdn.skypack.dev/@strudel/web@0.8.2';
initStrudel({ initStrudel({
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'), prebake: () => samples('github:tidalcycles/dirt-samples'),
}); });
const click = (id, action) => document.getElementById(id).addEventListener('click', action); const click = (id, action) => document.getElementById(id).addEventListener('click', action);
click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`)); click('a', () => evaluate(`s('bd,jvbass(3,8)').jux(rev)`));

View File

@ -52,7 +52,7 @@
}); });
function getTune() { function getTune() {
return `await samples('github:tidalcycles/Dirt-Samples/master') return `samples('github:tidalcycles/dirt-samples')
stack( stack(
// amen // amen

View File

@ -1,6 +1,6 @@
export const bumpStreet = `// froos - "22 bump street", licensed with CC BY-NC-SA 4.0 export const bumpStreet = `// froos - "22 bump street", licensed with CC BY-NC-SA 4.0
await samples('github:felixroos/samples/main') samples('github:felixroos/samples')
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/') samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
"<[0,<6 7 9>,13,<17 20 22 26>]!2>/2" "<[0,<6 7 9>,13,<17 20 22 26>]!2>/2"
// make it 22 edo // make it 22 edo
@ -33,8 +33,8 @@ await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tid
export const trafficFlam = `// froos - "traffic flam", licensed with CC BY-NC-SA 4.0 export const trafficFlam = `// froos - "traffic flam", licensed with CC BY-NC-SA 4.0
await samples('github:felixroos/samples/main') samples('github:felixroos/samples')
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/') samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
addVoicings('hip', { addVoicings('hip', {
m11: ['2M 3m 4P 7m'], m11: ['2M 3m 4P 7m'],
@ -69,8 +69,8 @@ export const funk42 = `// froos - how to funk in 42 lines of code
// adapted from "how to funk in two minutes" by marc rebillet https://www.youtube.com/watch?v=3vBwRfQbXkg // adapted from "how to funk in two minutes" by marc rebillet https://www.youtube.com/watch?v=3vBwRfQbXkg
// thanks to peach for the transcription: https://www.youtube.com/watch?v=8eiPXvIgda4 // thanks to peach for the transcription: https://www.youtube.com/watch?v=8eiPXvIgda4
await samples('github:felixroos/samples/main') samples('github:felixroos/samples')
await samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/') samples('https://strudel.cc/tidal-drum-machines.json', 'github:ritchse/tidal-drum-machines/main/machines/')
setcps(.5) setcps(.5)

View File

@ -15,7 +15,7 @@
<script type="module"> <script type="module">
import { initStrudel } from '@strudel/web'; import { initStrudel } from '@strudel/web';
initStrudel({ initStrudel({
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'), prebake: () => samples('github:tidalcycles/dirt-samples'),
}); });
const click = (id, action) => document.getElementById(id).addEventListener('click', action); const click = (id, action) => document.getElementById(id).addEventListener('click', action);

View File

@ -1,4 +1,4 @@
export default `await samples('github:tidalcycles/Dirt-Samples/master') export default `samples('github:tidalcycles/dirt-samples')
stack( stack(
// amen // amen

View File

@ -12,7 +12,7 @@
const init = Promise.all([ const init = Promise.all([
initAudioOnFirstClick(), initAudioOnFirstClick(),
samples('github:tidalcycles/Dirt-Samples/master'), samples('github:tidalcycles/dirt-samples'),
registerSynthSounds(), registerSynthSounds(),
]); ]);

View File

@ -292,7 +292,7 @@ const generic_params = [
* @name begin * @name begin
* @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample * @param {number | Pattern} amount between 0 and 1, where 1 is the length of the sample
* @example * @example
* samples({ rave: 'rave/AREUREADY.wav' }, 'github:tidalcycles/Dirt-Samples/master/') * samples({ rave: 'rave/AREUREADY.wav' }, 'github:tidalcycles/dirt-samples')
* s("rave").begin("<0 .25 .5 .75>").fast(2) * s("rave").begin("<0 .25 .5 .75>").fast(2)
* *
*/ */

View File

@ -2322,10 +2322,10 @@ const _loopAt = function (factor, pat, cps = 0.5) {
* @memberof Pattern * @memberof Pattern
* @returns Pattern * @returns Pattern
* @example * @example
* await samples('github:tidalcycles/Dirt-Samples/master') * samples('github:tidalcycles/dirt-samples')
* s("breaks165").slice(8, "0 1 <2 2*2> 3 [4 0] 5 6 7".every(3, rev)).slow(0.75) * s("breaks165").slice(8, "0 1 <2 2*2> 3 [4 0] 5 6 7".every(3, rev)).slow(0.75)
* @example * @example
* await samples('github:tidalcycles/Dirt-Samples/master') * samples('github:tidalcycles/dirt-samples')
* s("breaks125").fit().slice([0,.25,.5,.75], "0 1 1 <2 3>") * s("breaks125").fit().slice([0,.25,.5,.75], "0 1 1 <2 3>")
*/ */
@ -2351,7 +2351,7 @@ export const slice = register(
* Works the same as slice, but changes the playback speed of each slice to match the duration of its step. * Works the same as slice, but changes the playback speed of each slice to match the duration of its step.
* @name splice * @name splice
* @example * @example
* await samples('github:tidalcycles/Dirt-Samples/master') * samples('github:tidalcycles/dirt-samples')
* s("breaks165") * s("breaks165")
* .splice(8, "0 1 [2 3 0]@2 3 0@2 7") * .splice(8, "0 1 [2 3 0]@2 3 0@2 7")
*/ */

View File

@ -19,7 +19,7 @@ import { superdough, samples, initAudioOnFirstClick, registerSynthSounds } from
const init = Promise.all([ const init = Promise.all([
initAudioOnFirstClick(), initAudioOnFirstClick(),
samples('github:tidalcycles/Dirt-Samples/master'), samples('github:tidalcycles/dirt-samples'),
registerSynthSounds(), registerSynthSounds(),
]); ]);
@ -148,7 +148,7 @@ The json file is expected to have the same format as described above.
Because it is common to use github for samples, there is a short way to load a sample map from github: Because it is common to use github for samples, there is a short way to load a sample map from github:
```js ```js
samples('github:tidalcycles/Dirt-Samples/master') samples('github:tidalcycles/dirt-samples')
``` ```
The format is `github:<user>/<repo>/<branch>`. The format is `github:<user>/<repo>/<branch>`.

View File

@ -142,7 +142,7 @@ function getSamplesPrefixHandler(url) {
/** /**
* Loads a collection of samples to use with `s` * Loads a collection of samples to use with `s`
* @example * @example
* samples('github:tidalcycles/Dirt-Samples/master'); * samples('github:tidalcycles/dirt-samples');
* s("[bd ~]*2, [~ hh]*2, ~ sd") * s("[bd ~]*2, [~ hh]*2, ~ sd")
* @example * @example
* samples({ * samples({

View File

@ -23,6 +23,9 @@ describe('transpiler', () => {
it('supports top level await', () => { it('supports top level await', () => {
expect(transpiler("await samples('xxx');", simple).output).toEqual("await samples('xxx');"); expect(transpiler("await samples('xxx');", simple).output).toEqual("await samples('xxx');");
}); });
it('adds await to bare samples call', () => {
expect(transpiler("samples('xxx');", simple).output).toEqual("await samples('xxx');");
});
/* it('parses dynamic imports', () => { /* it('parses dynamic imports', () => {
expect( expect(
transpiler("const { default: foo } = await import('https://bar.com/foo.js');", { transpiler("const { default: foo } = await import('https://bar.com/foo.js');", {

View File

@ -1,8 +1,7 @@
import escodegen from 'escodegen';
import { parse } from 'acorn';
import { walk } from 'estree-walker';
import { isNoteWithOctave } from '@strudel/core';
import { getLeafLocations } from '@strudel/mini'; import { getLeafLocations } from '@strudel/mini';
import { parse } from 'acorn';
import escodegen from 'escodegen';
import { walk } from 'estree-walker';
export function transpiler(input, options = {}) { export function transpiler(input, options = {}) {
const { wrapAsync = false, addReturn = true, emitMiniLocations = true, emitWidgets = true } = options; const { wrapAsync = false, addReturn = true, emitMiniLocations = true, emitWidgets = true } = options;
@ -47,6 +46,9 @@ export function transpiler(input, options = {}) {
}); });
return this.replace(widgetWithLocation(node)); return this.replace(widgetWithLocation(node));
} }
if (isBareSamplesCall(node, parent)) {
return this.replace(withAwait(node));
}
}, },
leave(node, parent, prop, index) {}, leave(node, parent, prop, index) {},
}); });
@ -119,3 +121,14 @@ function widgetWithLocation(node) {
node.callee.name = 'sliderWithID'; node.callee.name = 'sliderWithID';
return node; return node;
} }
function isBareSamplesCall(node, parent) {
return node.type === 'CallExpression' && node.callee.name === 'samples' && parent.type !== 'AwaitExpression';
}
function withAwait(node) {
return {
type: 'AwaitExpression',
argument: node,
};
}

View File

@ -43,7 +43,7 @@ By default, no external samples are loaded, but you can add them like this:
```js ```js
initStrudel({ initStrudel({
prebake: () => samples('github:tidalcycles/Dirt-Samples/master'), prebake: () => samples('github:tidalcycles/dirt-samples'),
}); });
document.getElementById('play').addEventListener('click', document.getElementById('play').addEventListener('click',

View File

@ -29,7 +29,7 @@ edit: the desktop app performance on linux is currently not that great.. the web
The desktop App has the same features as the webapp, with the additional ability to load samples from disk. It is currently not documented yet, but you can do something like The desktop App has the same features as the webapp, with the additional ability to load samples from disk. It is currently not documented yet, but you can do something like
```js ```js
await samples('~/music/xxx'); samples('~/music/xxx');
s('my_sound'); s('my_sound');
``` ```

View File

@ -1,6 +1,6 @@
export const examples = [ export const examples = [
`// "coastline" @by eddyflux `// "coastline" @by eddyflux
await samples('github:eddyflux/crate') samples('github:eddyflux/crate')
setcps(.75) setcps(.75)
let chords = chord("<Bbm9 Fm9>/4").dict('ireal') let chords = chord("<Bbm9 Fm9>/4").dict('ireal')
stack( stack(
@ -30,7 +30,7 @@ stack(
.late("[0 .01]*4").late("[0 .01]*2").size(4)`, .late("[0 .01]*4").late("[0 .01]*2").size(4)`,
`// "broken cut 1" @by froos `// "broken cut 1" @by froos
await samples('github:tidalcycles/Dirt-Samples/master') samples('github:tidalcycles/dirt-samples')
samples({ samples({
'slap': 'https://cdn.freesound.org/previews/495/495416_10350281-lq.mp3', 'slap': 'https://cdn.freesound.org/previews/495/495416_10350281-lq.mp3',
'whirl': 'https://cdn.freesound.org/previews/495/495313_10350281-lq.mp3', 'whirl': 'https://cdn.freesound.org/previews/495/495313_10350281-lq.mp3',

View File

@ -51,7 +51,7 @@ Alternatively, you can get a taste of what Strudel can do by clicking play on th
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'], bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'],
sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'],
hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'],
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
stack( stack(
s("bd,[~ <sd!3 sd(3,4,2)>],hh*8") // drums s("bd,[~ <sd!3 sd(3,4,2)>],hh*8") // drums
.speed(perlin.range(.7,.9)) // random sample speed variation .speed(perlin.range(.7,.9)) // random sample speed variation

View File

@ -143,7 +143,7 @@ Because GitHub is a popular place for uploading open source samples, it has its
bd: 'bd/BT0AADA.wav', bd: 'bd/BT0AADA.wav',
sd: 'sd/rytm-01-classic.wav', sd: 'sd/rytm-01-classic.wav',
hh: 'hh27/000_hh27closedhh.wav', hh: 'hh27/000_hh27closedhh.wav',
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
s("bd sd bd sd,hh*16")`} s("bd sd bd sd,hh*16")`}
/> />
@ -174,7 +174,7 @@ It is also possible, to declare multiple files for one sound, using the array no
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav'], bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav'],
sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'],
hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'],
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
s("bd:0 bd:1,~ <sd:0 sd:1> ~ sd:0,[hh:0 hh:1]*4")`} s("bd:0 bd:1,~ <sd:0 sd:1> ~ sd:0,[hh:0 hh:1]*4")`}
/> />
@ -187,7 +187,7 @@ The sample number can also be set using `n`:
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav'], bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav'],
sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'],
hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'],
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
s("bd bd,~ sd ~ sd,hh*8").n("<0 1>")`} s("bd bd,~ sd ~ sd,hh*8").n("<0 1>")`}
/> />
@ -231,7 +231,7 @@ For pitched sounds, you can use `note`, just like with synths:
client:idle client:idle
tune={`samples({ tune={`samples({
'gtr': 'gtr/0001_cleanC.wav', 'gtr': 'gtr/0001_cleanC.wav',
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s('gtr').gain(.5)`} note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s('gtr').gain(.5)`}
/> />
@ -242,7 +242,7 @@ If we want them to behave more like a synth, we can add `clip(1)`:
client:idle client:idle
tune={`samples({ tune={`samples({
'gtr': 'gtr/0001_cleanC.wav', 'gtr': 'gtr/0001_cleanC.wav',
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s('gtr').clip(1) note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s('gtr').clip(1)
.gain(.5)`} .gain(.5)`}
/> />
@ -256,7 +256,7 @@ If we have 2 samples with different base pitches, we can make them in tune by sp
tune={`samples({ tune={`samples({
'gtr': 'gtr/0001_cleanC.wav', 'gtr': 'gtr/0001_cleanC.wav',
'moog': { 'g3': 'moog/005_Mighty%20Moog%20G3.wav' }, 'moog': { 'g3': 'moog/005_Mighty%20Moog%20G3.wav' },
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s("gtr,moog").clip(1) note("g3 [bb3 c4] <g4 f4 eb4 f3>@2").s("gtr,moog").clip(1)
.gain(.5)`} .gain(.5)`}
/> />
@ -272,7 +272,7 @@ We can also declare different samples for different regions of the keyboard:
'g2': 'moog/004_Mighty%20Moog%20G2.wav', 'g2': 'moog/004_Mighty%20Moog%20G2.wav',
'g3': 'moog/005_Mighty%20Moog%20G3.wav', 'g3': 'moog/005_Mighty%20Moog%20G3.wav',
'g4': 'moog/006_Mighty%20Moog%20G4.wav', 'g4': 'moog/006_Mighty%20Moog%20G4.wav',
}}, 'github:tidalcycles/Dirt-Samples/master/'); }}, 'github:tidalcycles/dirt-samples');
note("g2!2 <bb2 c3>!2, <c4@3 [<eb4 bb3> g4 f4]>") note("g2!2 <bb2 c3>!2, <c4@3 [<eb4 bb3> g4 f4]>")
.s('moog').clip(1) .s('moog').clip(1)
.gain(.5).cpm(60)`} .gain(.5).cpm(60)`}
@ -287,7 +287,7 @@ With it, you can enter any sample name(s) to query from [freesound.org](https://
<MiniRepl <MiniRepl
client:idle client:idle
tune={`await samples('shabda:bass:4,hihat:4,rimshot:2') tune={`samples('shabda:bass:4,hihat:4,rimshot:2')
stack( stack(
n("0 1 2 3 0 1 2 3").s('bass'), n("0 1 2 3 0 1 2 3").s('bass'),
n("0 1*2 2 3*2").s('hihat'), n("0 1*2 2 3*2").s('hihat'),
@ -300,8 +300,8 @@ Note that the language code and the gender parameters are optional and default t
<MiniRepl <MiniRepl
client:idle client:idle
tune={`await samples('shabda/speech:the_drum,forever') tune={`samples('shabda/speech:the_drum,forever')
await samples('shabda/speech/fr-FR/m:magnifique') samples('shabda/speech/fr-FR/m:magnifique')
stack( stack(
s("the_drum*2").chop(16).speed(rand.range(0.85,1.1)), s("the_drum*2").chop(16).speed(rand.range(0.85,1.1)),
s("forever magnifique").slow(4).late(0.125) s("forever magnifique").slow(4).late(0.125)

View File

@ -60,7 +60,7 @@ A sample can be looped and chopped like this:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:yaxu/clean-breaks/main') tune={`samples('github:yaxu/clean-breaks')
s("amen/4").fit().chop(32)`} s("amen/4").fit().chop(32)`}
punchcard punchcard
/> />
@ -71,7 +71,7 @@ Let's add randmized doubling + reversing:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:yaxu/clean-breaks/main') tune={`samples('github:yaxu/clean-breaks')
s("amen/4").fit().chop(16).cut(1) s("amen/4").fit().chop(16).cut(1)
.sometimesBy(.5, ply("2")) .sometimesBy(.5, ply("2"))
.sometimesBy(.25, mul(speed("-1")))`} .sometimesBy(.25, mul(speed("-1")))`}
@ -82,7 +82,7 @@ If we want to specify the order of samples, we can replace `chop` with `slice`:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:yaxu/clean-breaks/main') tune={`samples('github:yaxu/clean-breaks')
s("amen/4").fit() s("amen/4").fit()
.slice(8, "<0 1 2 3 4*2 5 6 [6 7]>*2") .slice(8, "<0 1 2 3 4*2 5 6 [6 7]>*2")
.cut(1).rarely(ply("2"))`} .cut(1).rarely(ply("2"))`}
@ -93,7 +93,7 @@ If we use `splice` instead of `slice`, the speed adjusts to the duration of the
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:yaxu/clean-breaks/main') tune={`samples('github:yaxu/clean-breaks')
s("amen") s("amen")
.splice(8, "<0 1 2 3 4*2 5 6 [6 7]>*2") .splice(8, "<0 1 2 3 4*2 5 6 [6 7]>*2")
.cut(1).rarely(ply("2"))`} .cut(1).rarely(ply("2"))`}
@ -213,7 +213,7 @@ Using `run` with `n`, we can rush through a sample bank:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('bubo:fox') tune={`samples('bubo:fox')
n(run(8)).s("ftabla")`} n(run(8)).s("ftabla")`}
punchcard punchcard
/> />
@ -224,7 +224,7 @@ In this case, I hear the beginning at the third sample, which can be accounted f
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('bubo:fox') tune={`samples('bubo:fox')
n(run(8)).s("ftabla").early(2/8)`} n(run(8)).s("ftabla").early(2/8)`}
/> />
@ -232,7 +232,7 @@ Let's add some randomness:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('bubo:fox') tune={`samples('bubo:fox')
n(run(8)).s("ftabla").early(2/8) n(run(8)).s("ftabla").early(2/8)
.sometimes(mul(speed("1.5")))`} .sometimes(mul(speed("1.5")))`}
/> />
@ -299,7 +299,7 @@ To simplify loading wavetables, any sample that starts with `wt_` will be looped
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:bubobubobubobubo/dough-waveforms/main') tune={`samples('github:bubobubobubobubo/dough-waveforms')
note("c eb g bb").s("wt_dbass").clip(2)`} note("c eb g bb").s("wt_dbass").clip(2)`}
/> />
@ -307,7 +307,7 @@ Running through different wavetables can also give interesting variations:
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:bubobubobubobubo/dough-waveforms/main') tune={`samples('github:bubobubobubobubo/dough-waveforms')
note("c2*8").s("wt_dbass").n(run(8))`} note("c2*8").s("wt_dbass").n(run(8))`}
/> />
@ -315,7 +315,7 @@ note("c2*8").s("wt_dbass").n(run(8))`}
<MiniRepl <MiniRepl
client:visible client:visible
tune={`await samples('github:bubobubobubobubo/dough-waveforms/main') tune={`samples('github:bubobubobubobubo/dough-waveforms')
note("c2*8").s("wt_dbass").n(run(8)) note("c2*8").s("wt_dbass").n(run(8))
.lpf(perlin.range(200,2000).slow(8)) .lpf(perlin.range(200,2000).slow(8))
.lpenv(-3).lpa(.1).room(.5)`} .lpenv(-3).lpa(.1).room(.5)`}

View File

@ -8,7 +8,7 @@ import { MiniRepl } from '../../docs/MiniRepl';
Note: Note:
- this has been (partly) translated from https://tidalcycles.org/docs/patternlib/howtos/buildrhythms - this has been (partly) translated from https://tidalcycles.org/docs/patternlib/howtos/buildrhythms
- this only sounds good with `samples('github:tidalcycles/Dirt-Samples/master')` in prebake - this only sounds good with `samples('github:tidalcycles/dirt-samples')` in prebake
# Build Rhythms # Build Rhythms

View File

@ -115,13 +115,12 @@ export async function prebake() {
'numbers/8.wav', 'numbers/8.wav',
], ],
}, },
'github:tidalcycles/Dirt-Samples/master/', 'github:tidalcycles/dirt-samples',
{ {
prebake: true, prebake: true,
}, },
), ),
]); ]);
// await samples('github:tidalcycles/Dirt-Samples/master');
} }
const maxPan = noteToMidi('C8'); const maxPan = noteToMidi('C8');

View File

@ -527,7 +527,7 @@ export const meltingsubmarine = `// "Melting submarine"
// @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/ // @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
// @by Felix Roos // @by Felix Roos
await samples('github:tidalcycles/Dirt-Samples/master/') samples('github:tidalcycles/dirt-samples')
stack( stack(
s("bd:5,[~ <sd:1!3 sd:1(3,4,3)>],hh27(3,4,1)") // drums s("bd:5,[~ <sd:1!3 sd:1(3,4,3)>],hh27(3,4,1)") // drums
.speed(perlin.range(.7,.9)) // random sample speed variation .speed(perlin.range(.7,.9)) // random sample speed variation
@ -574,7 +574,7 @@ samples({
sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'],
hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'],
perc: ['perc/002_perc2.wav'], perc: ['perc/002_perc2.wav'],
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
chord("<C^7 Am7 Dm7 G7>*2").dict('lefthand').anchor("G4").voicing() chord("<C^7 Am7 Dm7 G7>*2").dict('lefthand').anchor("G4").voicing()
.stack(n("0@6 [<1 2> <2 0> 1]@2").scale('C5 major')) .stack(n("0@6 [<1 2> <2 0> 1]@2").scale('C5 major'))
@ -608,7 +608,7 @@ samples({
bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'], bd: ['bd/BT0AADA.wav','bd/BT0AAD0.wav','bd/BT0A0DA.wav','bd/BT0A0D3.wav','bd/BT0A0D0.wav','bd/BT0A0A7.wav'],
sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'], sd: ['sd/rytm-01-classic.wav','sd/rytm-00-hard.wav'],
hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'], hh: ['hh27/000_hh27closedhh.wav','hh/000_hh3closedhh.wav'],
}, 'github:tidalcycles/Dirt-Samples/master/'); }, 'github:tidalcycles/dirt-samples');
note("<8(3,8) <7 7*2> [4 5@3] 8>".sub(1) // sub 1 -> 1-indexed note("<8(3,8) <7 7*2> [4 5@3] 8>".sub(1) // sub 1 -> 1-indexed
.layer( .layer(
@ -797,7 +797,7 @@ export const amensister = `// "Amensister"
// @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/ // @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
// @by Felix Roos // @by Felix Roos
await samples('github:tidalcycles/Dirt-Samples/master') samples('github:tidalcycles/dirt-samples')
stack( stack(
// amen // amen
@ -906,7 +906,7 @@ export const arpoon = `// "Arpoon"
// @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/ // @license CC BY-NC-SA 4.0 https://creativecommons.org/licenses/by-nc-sa/4.0/
// @by Felix Roos // @by Felix Roos
await samples('github:tidalcycles/Dirt-Samples/master') samples('github:tidalcycles/dirt-samples')
n("[0,3] 2 [1,3] 2".fast(3).lastOf(4, fast(2))).clip(2) n("[0,3] 2 [1,3] 2".fast(3).lastOf(4, fast(2))).clip(2)
.offset("<<1 2> 2 1 1>") .offset("<<1 2> 2 1 1>")