Created smnp.music.command (markdown)
45
smnp.music.command.md
Normal file
45
smnp.music.command.md
Normal file
@@ -0,0 +1,45 @@
|
||||
This module contains a common commands and command-like functions that can be shared between available music services (like [[smnp.audio.midi]] or [[smnp.audio.synth]]) and are supported by all of them.
|
||||
|
||||
# Functions
|
||||
## velocity
|
||||
```php
|
||||
velocity(velocity: float)
|
||||
```
|
||||
The factory function for `velocity` command, which changes the velocity of notes.
|
||||
|
||||
#### Arguments
|
||||
* `velocity ` - the velocity-value of notes between `0.0` and `1.0`
|
||||
|
||||
#### Output
|
||||
* a command map
|
||||
|
||||
## cresc
|
||||
```php
|
||||
cresc(begin: float, end: float, ...notes: <note, int>)
|
||||
cresc(begin: float, end: float, notes: list<note, int>)
|
||||
```
|
||||
Applies a `crescendo` effect on provided notes.
|
||||
|
||||
#### Arguments
|
||||
* `begin` - the beginning velocity value for the first note
|
||||
* `end` - the ending velocity value for the last note
|
||||
* `notes` - the notes on which the `crescendo` is intended to be applied.
|
||||
|
||||
#### Crescendo or diminuendo
|
||||
The function allows you to work with two modes:
|
||||
* _crescendo_ if `begin` < `end`
|
||||
* _diminuendo_ if `begin` > `end`
|
||||
|
||||
#### Output
|
||||
* a list of list contained of provided notes delimited by `velocity` command of value linearly-interpolated between `begin` for the first note of `notes` and `end` for the last note
|
||||
|
||||
#### Example
|
||||
```php
|
||||
pp = 0.2;
|
||||
mf = 0.7;
|
||||
x = $ cresc(pp, mf, @c, @d, @e, @f, @g, @a, @h, @c5) ||.flatten();
|
||||
# Note, that the `cresc()` function produces a list which is typically being nested into staff.
|
||||
# Because of that there could be a need to make the staff flat using i.e. `flatten()` method on it
|
||||
# from `smnp.collection` module.
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user