From 38dc236740becb999021d2999831054734d3d430 Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Mon, 30 Sep 2024 09:26:46 +0200 Subject: [PATCH] docs: update how-to instructions in readme for changed file names Link to Nim sourec of each example Signed-off-by: Christopher Arndt --- README.md | 79 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 8d43cfc..8ac9dde 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # nymph -A [Nim] library for writing audio and MIDI plugins conforming to the [LV2] standard +A [Nim] library for writing audio and MIDI plugins conforming to the [LV2] +standard ## Examples @@ -27,51 +28,59 @@ the basename of the plugin's LV2 bundle dir. Currently, there are just a few other example plugins: -* `miditranspose`: shows how to handle receiving and sending MIDI events. -* `multimodefilter`: shows a multimode state-variable filter implementation - ported from C++ to Nim. -* `tiltfilter`: shows a multimode tilt equalizer filter implementation ported - from Rust to Nim. -* `faustlpf`: shows how to integrate DSP C code generated from a [FAUST] - source file in Nim (in this example the FAUST code implements a simple - non-resonant low-pass filter from the FAUST standard library). +* [`miditranspose`](./examples/miditranspose_plugin.nim): shows how to handle + receiving and sending MIDI events. +* [`multimodefilter`](./examples/multimodefilter_plugin.nim): shows a + multimode state-variable filter implementation ported from C++ to Nim. +* [`tiltfilter`](./examples/titltfilter_plugin.nim): shows a multimode tilt + equalizer filter implementation ported from Rust to Nim. +* [`faustlpf`](./examples/faustlpf_plugin.nim): shows how to integrate DSP C + code generated from a [FAUST] source file in Nim (in this example the FAUST + code implements a simple non-resonant low-pass filter from the FAUST + standard library). + ## How To -* Install this library: +**Note:** I'll use `mydsp` as the base name for the new plugin in the +examples below. Substitute your own plugin basename wherever you see it used +below. - nimble install https://git.0x20.eu/chris/nymph +1. Install this library: -* Copy `examples/amp.lv2` and `examples/amp.nim` into your project and rename - them as you like (also rename `amp.lv2/amp.ttl`). I'll use `myplugin` as the - base name in the examples below. + nimble install https://github.com/SpotlightKid/nymph.git -* Edit `myplugin.lv2/manifest.ttl`: - * Change the plugin URI. - * Change the plugin's shared library name defined via `lv2:binary` to - `libmyplugin.so`. - * Change file name referenced via `rdfs:seeAlso` to `myplugin.ttl`. +1. Make a directory named `mydsp.lv2` and copy `examples/amp.lv2/manifest.ttl` + into it. Also copy `examples/amp.lv2/amp.ttl` to `mydsp.lv2/mydsp.ttl`. -* Edit `myplugin.lv2/myplugin.ttl`: - * Change the plugin URI. - * Define audio, control and atom ports as needed. +1. Copy `examples/amp_plugin.nim` into your project as `mydsp_plugin.nim`. -* Edit `myplugin.nim`: - * Change the `PluginUri` constant at the top. - * Change the `PluginPort` enum and list the ports in the order defined in - `myplugin.ttl`. - * Rename and update the definition of the `AmpPlugin` object type and - define its members with the appropriate data type for the plugin port - they will be connected to. Update the type name in the `instantiate`, - `deactivate`, `connectPorts` and `run` procs. - * Update and extend the `case` statement in `connectPort` to connect ports - to your plugin object instance members. - * Implement your DSP code in the `run` proc. +1. Edit `mydsp.lv2/manifest.ttl`: + * Change the plugin URI. + * Change the plugin's shared library name defined via `lv2:binary` to + `libmydsp.so`. + * Change file name referenced via `rdfs:seeAlso` to `mydsp.ttl`. -* Compile the plugin shared library object with: +1. Edit `mydsp.lv2/mydsp.ttl`: + * Change the plugin URI. + * Define audio, control and atom ports as needed. + +1. Edit `mydsp_plugin.nim`: + * Change the `PluginUri` constant at the top. + * Change the `PluginPort` enum and list the ports in the order defined in + `mydsp.ttl`. + * Rename and update the definition of the `AmpPlugin` object type and + define its members with the appropriate data types for the plugin ports + they will be connected to. Update the type name in the `instantiate`, + `deactivate`, `connectPorts` and `run` procs. + * Update and extend the `case` statement in `connectPort` to connect ports + to your plugin object instance members. + * Implement your DSP code in the `run` proc. + +1. Compile the plugin shared library object with: nim c --app:lib --noMain:on --mm:arc \ - --out:myplugin.lv2/libmyplugin.so myplugin.nim + --out:mydsp.lv2/libmydsp.so mydsp_plugin.nim See the definition of the `build_ex` task in the [nymph.nimble](./nymph.nimble#L67) file on how to create a nimble task