diff --git a/smnp.dsp.md b/smnp.dsp.md index 95c6125..9aa57a0 100644 --- a/smnp.dsp.md +++ b/smnp.dsp.md @@ -1,3 +1,44 @@ # Functions ## `plot(...signals: list)` -## `plot(config: map<>, ...signals: map<>)` \ No newline at end of file +Plots given lists as individual signals. + +## `plot(config: map<>, ...signals: map<>)` +Plots given signals using global config map and individual maps with series. + +### Arguments +* `config` - global config map, which includes following keys (all of them are optional): + +| KEY | TYPE | VALUE | DEFAULT | +|:-------:|:--------:|:--------------------------------------------------------------------:|:-------:| +| title | `string` | The title of plot written at the very top of it. | - | +| output | `string` | The output image file name. If passed, plot is not displayed. | - | +| format | `string` | The format of output image. Applicable only when `output` is passed. | png | + +Available formats: +* png +* jpg +* bpm +* gif +* eps +* pdf +* svg + +* `signals` - a list of maps of following schema: + +| KEY | TYPE |VALUE | REQUIRED? | DEFAULT | +|:-------:|:------:|:-------------------------------------------------------------------:|:---------:|:--------:| +| name | `string` | The name of series (will be applied in legend). | Yes | - | +| y | `list` | The data to be plotted. | Yes | - | +| x | `list` | The X series (horizontal axis). | No | 0, 1, 2, ... | + +### Example +``` +plot({ title -> "Example plot", output -> "myFile", format -> "pdf" }, + { name -> "C", y -> wave([@C:32]) }, + { name -> "D", y -> wave([@D:32]) }, + { name -> "E", y -> wave([@E:32]) } +); +``` + +## `fft(signal: list)` +Returns a signal passed through FFT/radix-2 algorithm as a list of floats. \ No newline at end of file