Updated smnp.audio.midi (markdown)

Bartłomiej Przemysław Pluta
2020-03-29 14:41:12 +02:00
parent 4e9c8639dc
commit 4ad041a2a1

@@ -1,5 +1,9 @@
The [[smnp.audio.midi#midi]] module is an entire environment allowing you to use your OS-provided MIDI engine in order to consume written notes and play them or save to MIDI file.
# Reference
## Playing notes
Notes can be played using one of two available ways: the conventional one (which is highly recommended) and the MIDI-dedicated one, which is supported experimentally and its purpose is to provide a background for one of planned features that would allow you to decompile MIDI files to SMNP notes. So far, even though these plans are abandoned, the alternative notation is still available, however, this way is still **not recommended** to use, because it is not universal and is _provider-locked-in_, which means that it is only supported by this module and requires to specify `ppq` parameter to fixed value strictly related with your music sheet.
### Standard music notation
The [[Music notation]] guide instructs how to compose notes that are consumable by the [[smnp.audio.midi#midi]] function.
@@ -9,7 +13,7 @@ If you specify the `ppq` parameter in the config map of [[smnp.audio.midi#midi]]
As specifying the `ppq` parameter changes totally the meaning of duration in note literals, it requires an individual explanation.
Compare following notes' durations:
| NOTE | `ppq` not specified | `ppq = 8`
| Note | `ppq` not specified | `ppq = 8`
|:---------------:|:-------------------:|:---------
| C, quarter | `@c` | `@c:8`
| D, half | `@d:2` | `@d:16`
@@ -21,6 +25,12 @@ Compare following notes' durations:
| C, sixty-fourth | `@c:64` | not available
## Supported commands
The [[smnp.audio.midi#midi]] function supports string command which modifies some parameters of notes sequencing.
So far, supported commands are:
| Command | Description | Example
|:-----------:|:-----------:|:-------
| `i:<a>` | Changes the instrument to the one with number of `<a>` for channel assigned to staff that defines the command. | `i:20` - change current instrument to church organ
# Functions
## midi