Re: [LAD] Pluginization example?

From: Steve Harris <steve@email-addr-hidden>
Date: Wed Aug 15 2007 - 18:39:43 EEST

Hi Juhana,

On 15 Aug 2007, at 15:43, Juhana Sadeharju wrote:
> 1. Denormalization. Feeding noise at the reverb input would
> save me trouble of finding all places where the problem
> occurs, but is this wise? How to generate the proper noise?

You don't have to use noise, you could use a fs/2 signal at very low
amplitude, eg.

sig = 1e-30;
for (i in input)
    x[i] += sig;
    sig = -sig;

it's a little ugly, but works.

> 2. Effect modulation is done by two extra arrays at
> effect_do( ..., mod1_array, mod2_array, ...)
> They should be filled with slowly varying sin() signals, but
> how to do it efficiently? I have used earlier the sin() call.

There's a trick to calculating sinus signals where you calculate the
sin delta value for the starting point (once) and cross sum them to
calculate the sine and cosine. Works fine as long as you don't need
to change the frequency: (100 is the frequency of the LFO)

#include <math.h>
#include <stdio.h>

int main()
{
         float fs = 48000.0;
         float sinv = 1.0;
         float cosv = 0.0;
         float delta = 2.0 * sin(M_PI * 100.0 / fs);
         int i;

         for (i=0; i<1000; i++) {
                 sinv -= delta * cosv;
                 cosv += delta * sinv;
                 printf("%f\n", sinv);
         }
}

If you do you can just use a smallish table and interpolate it, or
use an approximation function.

> 3. The audio is divided to blocks of N samples. Apparently
> I should interpolate the tweaked parameters over the N samples
> inside the reverb, or I should provide arrays for all parameters
> and leave the interpolation to the plugin wrapper.

It's probably easier to do it inside your code, some of them will not
need interpolating and for the ones that do linear is generally fine.

- Steve
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo.cgi/linux-audio-dev
Received on Wed Aug 15 20:15:05 2007

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2007 - 20:15:05 EEST