Skip to content

Commit cff0983

Browse files
committed
Docs - fix up sample source/filter tutorial
1 parent 96d919b commit cff0983

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

etc/doc/tutorial/en/03.7-Sample-Packs.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ names in our directory:
9393
Notice that in these filenames we have quite a bit of
9494
information. Firstly, we have the BPM of the sample (beats per minute)
9595
at the start. So, the piano sample is at 120 BPM and our first three
96-
melodies are at 100 BPM. Also, our sample names contain the key. So
97-
the guitar sample is in Bb and the melodies are in A#. This information
98-
is very useful for mixing in these samples with our other code. For
96+
melodies are at 100 BPM. Also, our sample names contain the key. So the
97+
guitar sample is in Bb and the melodies are in A#. This information is
98+
very useful for mixing in these samples with our other code. For
9999
example, we know we can only play the piano sample with code that's in
100100
120 BPM and in the key of Bb.
101101

@@ -177,6 +177,9 @@ Take care though as searching through a very large set of folders may
177177
take a long time. However, the contents of all folder sources are
178178
cached, so the delay will only happen the first time.
179179

180+
Finally, note that the sources *must go first*. If no source is given,
181+
then the set of built-in samples will be selected as the default list of
182+
candidates to work with:
180183

181184
## Filters
182185

@@ -186,16 +189,26 @@ types to further reduce the selection:
186189
* `"foo"` Strings will filter on substring occurrence within file name (minus directory path and extension).
187190
* `/fo[oO]/` Regular Expressions will filter on pattern matching of file name (minus directory path and extension).
188191
* `:foo` - Keywords will filter candidates on whether the keyword is a direct match of the filename (minus directory path and extension).
189-
* `lambda{ "foo" }` - Procs with no arguments will be automatically called and their result will be treated as a source or filter.
190192
* `lambda{|a| ... }` - Procs with one argument will be treated as a candidate filter or generator function. It will be passed the list of current candidates and must return a new list of candidates (a list of valid paths to sample files).
191193
* `1` - Numbers will select the candidate with that index (wrapping round like a ring if necessary).
192194

195+
For example, we can filter over all the samples in a directory
196+
containing the string \"foo\" and play the first matching sample at half
197+
speed:
198+
199+
```
200+
sample \"/path/to/samples\", \"foo\", rate: 0.5
201+
```
202+
203+
See the help for `sample` for many detailed usage examples. Note that
204+
the ordering of the filters is honoured.
205+
193206
## Composites
194207

195208
Finally, you may use lists wherever you may place a source or
196-
filter. The list will be automatically flattened and the contents will be
197-
treated as regular sources and filters. Therefore the following calls to
198-
`sample` are semantically equivalent:
209+
filter. The list will be automatically flattened and the contents will
210+
be treated as regular sources and filters. Therefore the following calls
211+
to `sample` are semantically equivalent:
199212

200213
```
201214
sample "/path/to/dir", "100", "C#"

0 commit comments

Comments
 (0)