From de4726ec8d437282c3689384f61d3d379ad07818 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 16 Sep 2022 23:59:46 +0200 Subject: [PATCH] improve sampler section --- tutorial/tutorial.mdx | 52 ++++++++++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/tutorial/tutorial.mdx b/tutorial/tutorial.mdx index f8ca1571..3ef79a0b 100644 --- a/tutorial/tutorial.mdx +++ b/tutorial/tutorial.mdx @@ -249,22 +249,10 @@ Besides Synths, `s` can also play back samples: To know which sounds are available, open the [default sample map](https://strudel.tidalcycles.org/EmuSP12.json) -### Custom Samples +### Custom Sample Maps You can load your own sample map like this: - - -The `samples` function takes an object where the properties are the sound names and the values are urls to audio files. -As most sample packs will be loaded from the same location, you can set the base url using the second argument: - +The `samples` function takes an object that maps sound names to audio file paths. +The second argument is the base URL that comes before each path. Make sure your base URL ends with a slash, while your sample paths do **not** begin with one. + Because github is a popular choice to dump samples, there is a shortcut for that: ,~ ,[hh:0 hh:1]*2").out()`} +s(",~ ,[hh:0 hh:1]*2").out()`} /> The `:0` `:1` etc. are the indices of the array. +The sample number can also be set using `n`: -For pitched samples, you can use `note`, just like with synths: +").out()`} +/> + +### Pitched Sounds + +For pitched sounds, you can use `note`, just like with synths: @2").s('gtr').clip(1) .gain(.5).out()`} /> +### Base Pitch + If we have 2 samples with different base pitches, we can make them in tune by specifying the pitch like this: @2").s("gtr,moog").clip(1) If a sample has no pitch set, `c3` is the default. +We can also declare different samples for different regions of the keyboard: + +!2, g4 f4]>") + .s('moog').clip(1) + .gain(.5).out()`} +/> + +The sampler will always pick the closest matching sample for the current note!