Feat: improving MIDI
This commit is contained in:
@@ -27,13 +27,13 @@ Sequences of values drive music: arpeggios, parameter sweeps, rhythmic patterns.
|
||||
100 0.5 4 geom.. ;; 100 50 25 12.5
|
||||
```
|
||||
|
||||
Musical use -- build a harmonic series:
|
||||
Build a harmonic series:
|
||||
|
||||
```forth
|
||||
110 2 5 geom.. 5 rev note
|
||||
110 2 5 geom.. 5 rev freq
|
||||
```
|
||||
|
||||
That gives you 110, 220, 440, 880, 1760 (reversed), ready to feed into `note` or `freq`.
|
||||
That gives you 110, 220, 440, 880, 1760 (reversed), ready to feed into `freq`.
|
||||
|
||||
## Computed Sequences
|
||||
|
||||
@@ -73,14 +73,6 @@ The distinction: `gen` is for building data. `times` is for doing things.
|
||||
|
||||
These give you raw indices as data on the stack. This is different from `bjork` and `pbjork` (covered in the Randomness tutorial), which execute a quotation on matching steps. `euclid` gives you numbers to work with; `bjork` triggers actions.
|
||||
|
||||
Use euclid indices to pick notes from a scale:
|
||||
|
||||
```forth
|
||||
: pick ( ..vals n i -- val ) rot drop swap ;
|
||||
c4 d4 e4 g4 a4 ;; pentatonic scale on the stack
|
||||
3 8 euclid ;; get 3 hit positions
|
||||
```
|
||||
|
||||
## Transforming Sequences
|
||||
|
||||
Four words reshape values already on the stack. All take n (the count of items to operate on) from the top:
|
||||
@@ -143,39 +135,4 @@ Or replicate a value for batch processing:
|
||||
0.5 4 dupn 4 sum ;; 2.0
|
||||
```
|
||||
|
||||
## Combining Techniques
|
||||
|
||||
An arpeggio that shuffles every time the step plays:
|
||||
|
||||
```forth
|
||||
c4 e4 g4 b4 4 shuffle
|
||||
drop drop drop ;; keep only the first note
|
||||
note sine s .
|
||||
```
|
||||
|
||||
Parameter spread across voices -- four sines with geometrically spaced frequencies:
|
||||
|
||||
```forth
|
||||
220 1.5 4 geom..
|
||||
4 { @i 1 + pick note sine s . } times
|
||||
```
|
||||
|
||||
Euclidean rhythm driving note selection from a generated sequence:
|
||||
|
||||
```forth
|
||||
3 8 euclid ;; 3 hit indices
|
||||
```
|
||||
|
||||
A chord built from a range, then sorted high to low:
|
||||
|
||||
```forth
|
||||
60 67 .. 8 rsort
|
||||
```
|
||||
|
||||
Rhythmic density control -- generate hits, keep only the loud ones:
|
||||
|
||||
```forth
|
||||
{ 0.0 1.0 rand } 8 gen
|
||||
```
|
||||
|
||||
The generator words produce raw material. The transform words shape it. Together they let you express complex musical ideas in a few words.
|
||||
Reference in New Issue
Block a user