Difference between revisions of "Max gen~"

From MOD Wiki
Jump to navigation Jump to search
m (→‎Editing the plugin: add link to ssh)
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Introduction ==
+
Apart from programming LV2-plugins in a "traditional" way, it's also possible to generate LV2-plugins for the MOD Duo from gen~ objects created in Cycling '74 Max.<br>
 +
This page will tell you the how and why of programming audio effects for the MOD Duo using this very different approach.
  
Apart from programming LV2-plugins in a "traditional" way, it's also possible to generate LV2-plugins for the MOD Duo from gen~ objects created in Cycling '74 Max. This quick start guide will tell you the how and why of programming audio effects for the MOD Duo using this very different approach.
+
== Gen basics ==
  
== Gen Basics ==
+
Gen~ objects are normally used in Max as a way to write low-level code that is run at signal-rate, using (if you want to) the same visual approach Max is known for.<br>
 +
Therefore the insides of a gen~ object can be seen as a pedal schematic, perfect for designing audio effects.<br>
 +
The SHIRO plugins are an example of plugins for the MOD Duo made using this very method.
  
Gen~ objects are normally used in Max as a way to write low-level code that is run at signal-rate, using (if you want to) the same visual approach Max is known for. Therefore the insides of a gen~ object can be seen as a pedal schematic, perfect for designing audio effects.
+
If you're not familiar with Gen, and this sounds all like gibberish to you, have a look at the links below.
 
 
If you're not familiair with Gen, and this sounds all like gibberish to you, have a look at the links below.
 
  
 
* [https://docs.cycling74.com/max7/vignettes/gen_overview Gen Overview]
 
* [https://docs.cycling74.com/max7/vignettes/gen_overview Gen Overview]
* [http://blog.moddevices.com/2017/01/06/create-a-gen-based-plugin-for-the-mod-duo Create a Gen-based plugin for the MOD Duo]
+
* [https://www.youtube.com/watch?v=iuGi2MDaEOg& Tutorial: Create a Gen-based plugin for the MOD Duo]
  
 
== Designing your effect in Gen ==
 
== Designing your effect in Gen ==
  
* To get your gen~ object working on the MOD Duo, you'll first need to design one using only Gen's internal objects, without referring to objects outside the gen~ object. Only the objects insides will make it to the final LV2-plugin.
+
If you want to design a plugin for the MOD Duo, there are a few things you should know:
* If you want controllable parameters, define the minimum, maximum and default arguments in the "param" object.
+
 
* While designing your gen~ object, remember that the MOD Duo's samplerate is running at 48 KhZ.
+
* To get your gen~ object working on the MOD Duo, you'll need to design one using only Gen's internal objects, without referring to objects outside the gen~ object.<br> Only the objects inside will make it to the final LV2-plugin.
 +
* If you want controllable parameters, define the default, minimum and maximum arguments in the "param" object.
 +
* While designing your gen~ object, remember that the MOD Duo's samplerate is running at 48 kHz.
  
When you're finished, send the "exportcode" message to the gen~ object in your main Max-patch to get the gen_exported.cpp and gen_exported.h files.
+
You'll find some example-plugins if you download the MOD Duo-package from the Package Manager in Max, and click on Launch.
  
 
== Getting your Gen-based plugin to the MOD Duo ==
 
== Getting your Gen-based plugin to the MOD Duo ==
  
At this point you should have the exported code from your gen~ object, and have met the requirements specified above.
+
At this point you should have met the requirements specified above. If so, follow the steps below to get your plugin on the MOD Duo.<br>
If so, follow the steps below to get your plugin on the MOD Duo.
+
In order to run Gen-based plugins on the MOD Duo they must be converted into LV2 plugins and compiled using a custom MOD cloud build system.<br>
 +
All the heavy work has already been done by the MOD Team and Cycling '74.
 +
 
 +
* Go to or install the MOD Duo-package in the Package Manager in Max if you haven't, and click on Launch.
 +
* Make sure your MOD Duo is connected, then start the MODwatcher from the popped-up screen.
 +
* If you want your plugin to have a name on the MOD Duo, copy your gen~ objects contents to a gen~ object with a patcher-name argument.<br> WARNING: naming your original gen~ object will initialize it's contents.
 +
* Finally send a message containing "exportnotifier MODwatcher, exportcode" (without the quotation marks) to the gen~ object.
 +
 
 +
Your plugin will now be transferred to the MOD Duo, within a few minutes the MODwatcher will tell you if the upload succeeded.<br>
 +
If all goes well, your Gen-based plugin should now be inside the MOD Duo, ready to be played!
 +
 
 +
== Additional features (advanced) ==
 +
 
 +
Optionally you can edit your plugin to, for example, add units, knob behavior, a description or even a GUI.<br>
 +
This process is different from the process described above. It doesn't use the MOD Duo-package in Max.
  
 
=== Compiling the plugin ===
 
=== Compiling the plugin ===
  
In order to run Gen-based plugins on the MOD Duo they must be converted into LV2 plugins and compiled using a custom MOD cloud build system.<br>
+
First, download http://download.moddevices.com/releases/max-gen/max-gen-deploy_v4.tar.gz and extract it. <br>
All the heavy work has already been done by the MOD Team and Cycling '74. You only need to download a package and run a script to tell the MOD cloud to compile things for you.
+
Send an "exportcode" message to the gen~ object in your main Max-patcher to get the gen_exported.cpp and gen_exported.h files.<br>
 
 
First, download http://download.moddevices.com/releases/max-gen/max-gen-deploy_v3.tar.gz and extract it.
 
 
Copy the gen_exported.cpp and gen_exported.h files into the extracted max-gen-deploy folder, and run:
 
Copy the gen_exported.cpp and gen_exported.h files into the extracted max-gen-deploy folder, and run:
  
Line 40: Line 55:
 
You'll be asked for a plugin name, and after providing one the cloud should give you back a tar.gz file within a few minutes.
 
You'll be asked for a plugin name, and after providing one the cloud should give you back a tar.gz file within a few minutes.
  
=== Edit the .ttl file (optional) ===
+
=== Editing the plugin ===
 +
 
 +
To add [http://lv2plug.in/ns/extensions/units/units.html units], [http://lv2plug.in/ns/ext/port-props/port-props.html knob behavior] or a description, you'll have to edit the .ttl file.
 +
If you do so, make sure everything is correct,<br> otherwise the plugin won't work and you might have to [[Access_MOD_using_SSH|SSH into the MOD Duo]] to get the corrupt plugin out.<br>
 +
To prevent this from happening, you can [http://lv2plug.in/pages/validating-lv2-data.html validate the lv2-data].
  
Optionally you can now edit the .ttl file to for example add [http://lv2plug.in/ns/extensions/units/units.html units], [http://lv2plug.in/ns/ext/port-props/port-props.html knob behavior] or a description. If you do so, make sure everything is correct, otherwise the plugin won't work and you might have to SSH into the MOD Duo to get the corrupt plugin out. To prevent this from happening, you can [http://lv2plug.in/pages/validating-lv2-data.html validate the lv2-data].
+
The other option is to include a GUI, you can make one with the [https://github.com/moddevices/mod-sdk MOD SDK].<br>
 +
Have a look [https://github.com/moddevices/mod-lv2-data/tree/master/plugins-fixed here] how a GUI affects the .ttl structure.<br>
  
 
<source lang="console">
 
<source lang="console">
Line 52: Line 72:
 
$ tar -cvzf Plugin.lv2-duo.tar.gz Plugin.lv2/
 
$ tar -cvzf Plugin.lv2-duo.tar.gz Plugin.lv2/
 
</source>
 
</source>
 
=== Include a GUI (optional, advanced) ===
 
 
Another option is to include a GUI, you can make one with the [https://github.com/moddevices/mod-sdk MOD SDK].
 
Have a look [http://github.com/moddevices/mod-v2-data/tree/master/plugins-fixed here] how a GUI affects the .ttl structure.
 
And don't forget to compress everything again.
 
  
 
=== Deploying the plugin ===
 
=== Deploying the plugin ===
  
Make sure the MOD Duo is connected to your computer via USB before proceeding.
+
Make sure the MOD Duo is connected to your computer via USB before proceeding. Then run:
  
 
<source lang="console">
 
<source lang="console">
Line 67: Line 81:
 
$ ./mod-deploy.sh
 
$ ./mod-deploy.sh
 
</source>
 
</source>
 
If all goes well, your Gen-based plugin should now be inside the MOD Duo, ready to be played!
 

Revision as of 22:27, 9 November 2018

Apart from programming LV2-plugins in a "traditional" way, it's also possible to generate LV2-plugins for the MOD Duo from gen~ objects created in Cycling '74 Max.
This page will tell you the how and why of programming audio effects for the MOD Duo using this very different approach.

Gen basics

Gen~ objects are normally used in Max as a way to write low-level code that is run at signal-rate, using (if you want to) the same visual approach Max is known for.
Therefore the insides of a gen~ object can be seen as a pedal schematic, perfect for designing audio effects.
The SHIRO plugins are an example of plugins for the MOD Duo made using this very method.

If you're not familiar with Gen, and this sounds all like gibberish to you, have a look at the links below.

Designing your effect in Gen

If you want to design a plugin for the MOD Duo, there are a few things you should know:

  • To get your gen~ object working on the MOD Duo, you'll need to design one using only Gen's internal objects, without referring to objects outside the gen~ object.
    Only the objects inside will make it to the final LV2-plugin.
  • If you want controllable parameters, define the default, minimum and maximum arguments in the "param" object.
  • While designing your gen~ object, remember that the MOD Duo's samplerate is running at 48 kHz.

You'll find some example-plugins if you download the MOD Duo-package from the Package Manager in Max, and click on Launch.

Getting your Gen-based plugin to the MOD Duo

At this point you should have met the requirements specified above. If so, follow the steps below to get your plugin on the MOD Duo.
In order to run Gen-based plugins on the MOD Duo they must be converted into LV2 plugins and compiled using a custom MOD cloud build system.
All the heavy work has already been done by the MOD Team and Cycling '74.

  • Go to or install the MOD Duo-package in the Package Manager in Max if you haven't, and click on Launch.
  • Make sure your MOD Duo is connected, then start the MODwatcher from the popped-up screen.
  • If you want your plugin to have a name on the MOD Duo, copy your gen~ objects contents to a gen~ object with a patcher-name argument.
    WARNING: naming your original gen~ object will initialize it's contents.
  • Finally send a message containing "exportnotifier MODwatcher, exportcode" (without the quotation marks) to the gen~ object.

Your plugin will now be transferred to the MOD Duo, within a few minutes the MODwatcher will tell you if the upload succeeded.
If all goes well, your Gen-based plugin should now be inside the MOD Duo, ready to be played!

Additional features (advanced)

Optionally you can edit your plugin to, for example, add units, knob behavior, a description or even a GUI.
This process is different from the process described above. It doesn't use the MOD Duo-package in Max.

Compiling the plugin

First, download http://download.moddevices.com/releases/max-gen/max-gen-deploy_v4.tar.gz and extract it.
Send an "exportcode" message to the gen~ object in your main Max-patcher to get the gen_exported.cpp and gen_exported.h files.
Copy the gen_exported.cpp and gen_exported.h files into the extracted max-gen-deploy folder, and run:

$ cd /path/to/max-gen-deploy/
$ ./mod-build.sh

You'll be asked for a plugin name, and after providing one the cloud should give you back a tar.gz file within a few minutes.

Editing the plugin

To add units, knob behavior or a description, you'll have to edit the .ttl file. If you do so, make sure everything is correct,
otherwise the plugin won't work and you might have to SSH into the MOD Duo to get the corrupt plugin out.
To prevent this from happening, you can validate the lv2-data.

The other option is to include a GUI, you can make one with the MOD SDK.
Have a look here how a GUI affects the .ttl structure.

OPTIONAL
$ gunzip Plugin.lv2-duo.tar.gz
$ tar -xvf Plugin.lv2-duo.tar
make edits in Plugin.lv2/Plugin_dsp.ttl or include a GUI
$ rm Plugin.lv2-duo.tar.gz
$ tar -cvzf Plugin.lv2-duo.tar.gz Plugin.lv2/

Deploying the plugin

Make sure the MOD Duo is connected to your computer via USB before proceeding. Then run:

$ cd /path/to/max-gen-deploy/
$ ./mod-deploy.sh