I made a LADSPA plugin

Anything that doesn't fit into other topics goes here!
So I couldn't find a plugin for wrap overdrive (not in LADSPA nor VST form, even) anywhere. So I downloaded the LADSPA SDK, spent a while going through the example plugins and the docs, and found out that writing LADSPA plugins isn't really all that hard (at least not for simple ones like this).

So I wrote my WrapOD plugin. It's very simple in principle: it applies obscene amounts of gain to the signal, but if the signal goes above a treshold (which you can adjust), it gets "wrapped" back over itself, this is repeated as many times is needed - so basically it creates harmonics with gain. It's a nifty effect, hard to use well, but when you master it, it goes quite nicely with some phat squiggly leads and pads in certain types of electronic music.

I mainly wrote this for my own amusement, but I figure if might be useful to others possibly? So I'm attaching the source file here, you need a C compiler such as GCC to compile it, and then you have to add it to the LADSPA directory of LMMS to be able to use it in LMMS.

This plugin is licensed under the GNU LGPLv2+.

Build instructions
For Linux:

First, you need to have ladspa.h from the LADSPA-SDK installed. If you use Ubuntu or a derivative, you can install LADSPA-SDK from the repositories. Otherwise, go to http://www.ladspa.org/ladspa_sdk/installation.html and follow the instructions there.

Then, to compile wrapod.c, go to the directory where you put it and type the following:

Code: Select all

gcc -o wrapod.o -c wrapod.c
ld -o wrapod.so wrapod.o -shared
If all goes right, you should have the file wrapod.so in your directory. Copy that file to your LADSPA plugin directory, and you're set.

For Windows:

Sorry, I have no idea how to compile anything on Windows. Probably you'll need Cygwin and all that stuff, if someone manages to do it, feel free to post instructions to this thread and I'll add them here.

Attachments

Hi . sounds like a neat plugin, but i cannot get it to compile on ubuntu 12.04 32bit. I have tried with c++, g++, gcc etc but i am getting the following error...

~/lmms/include$ c++ wrapod.c -o OD.so
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
Sorry, I should have added some instructions.

You need the LADSPA libs and headers, particularly "ladspa.h". Go here for instruction:

http://www.ladspa.org/ladspa_sdk/installation.html

On that site, you can download the ladspa.h API header file, which you'll have to place in some place like /usr/include, and then run ldconfig (with root) so that gcc can find the file.
diiz wrote: You need the LADSPA libs and headers, particularly "ladspa.h".
ladspa.h is included in the package ladspa-sdk that is available in the package manager in Ubuntu.
owallgren wrote:
diiz wrote: You need the LADSPA libs and headers, particularly "ladspa.h".
ladspa.h is included in the package ladspa-sdk that is available in the package manager in Ubuntu.
Oh, well that's convenient. Good to know.
I already have the ladspa.h file installed from the ladspa-sdk. I have tried things like copying the ladspa.h file to the build path and also pointing gcc etc to the library but im still getting the same error. I have multiple ladspa's installed and working on my system so i know this is possible to correct... any more ideas guys ???
thanks :)
*UPDATE* whenever i use g++ and c++ the error is exactly as above, but when using gcc the error becomes multiple errors ....

~/wrapod$ gcc wrapod.c
/tmp/cchSln6r.o: In function `_init':
wrapod.c:(.text+0x237): multiple definition of `_init'
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crti.o:(.init+0x0): first defined here
/tmp/cchSln6r.o: In function `_fini':
wrapod.c:(.text+0x5c9): multiple definition of `_fini'
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crti.o:(.fini+0x0): first defined here
/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status


gcc -I /usr/lib/ladspa wrapod.c and gcc -I /usr/include/ladspa.h wrapod.c both yield the same result.

thanks :)
Ok, try it this way:

gcc -o wrapod.o -c wrapod.c
ld -o wrapod.so wrapod.o -shared
thanks, your above commands worked for me this time. I now have Wrap Overdrive installed system wide as i copied wrapod.so to /usr/lib/ladspa :)
mikobuntu wrote:thanks, your above commands worked for me this time. I now have Wrap Overdrive installed system wide as i copied wrapod.so to /usr/lib/ladspa :)
Great, hope you have fun with it. I've also amended the first post to add build instructions, so that others can go about this with less hassle...