You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: etc/doc/tutorial/en/03.7-Sample-Packs.md
+20-7Lines changed: 20 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,9 +93,9 @@ names in our directory:
93
93
Notice that in these filenames we have quite a bit of
94
94
information. Firstly, we have the BPM of the sample (beats per minute)
95
95
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
99
99
example, we know we can only play the piano sample with code that's in
100
100
120 BPM and in the key of Bb.
101
101
@@ -177,6 +177,9 @@ Take care though as searching through a very large set of folders may
177
177
take a long time. However, the contents of all folder sources are
178
178
cached, so the delay will only happen the first time.
179
179
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:
180
183
181
184
## Filters
182
185
@@ -186,16 +189,26 @@ types to further reduce the selection:
186
189
*`"foo"` Strings will filter on substring occurrence within file name (minus directory path and extension).
187
190
*`/fo[oO]/` Regular Expressions will filter on pattern matching of file name (minus directory path and extension).
188
191
*`: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.
190
192
*`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).
191
193
*`1` - Numbers will select the candidate with that index (wrapping round like a ring if necessary).
192
194
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
+
193
206
## Composites
194
207
195
208
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
0 commit comments