Re: [LAD] Prototyping algorithms and ideas

From: Yann Orlarey <orlarey@email-addr-hidden>
Date: Wed Jan 30 2008 - 00:36:30 EET

Hi Fons,

Here is a quick solution using Faust :

    import("filter.lib");

    line(i) = vgroup("line %i", *(g) : fdelay2(1024, d))
        with { g = vslider("gain (dB)", -60, -60, 4, 0.1) : db2linear :
smooth(0.995);
               d = nentry("delay (samp)", 0, 0, 1000, 0.1) :
smooth(0.995); };

    process = hgroup("", par(i, 10, line(i)) );

The first line imports a library of filters (written in Faust by Julius
Smith) that includes several fractional delays based on Lagrange
interpolation.

Then we define a 'line' that combines in sequence (':' operator) a gain
and a fractional delay encapsulated in a vertical layout. Here we use
fdelay2 a fractional delay with a second order Lagrange interpolation.
It can be replaced by fdelay3 or fdelay4 if better interpolations are
needed.

The gain value g is defined by a vertical slider (in dB) which is
converted in a linear value and then filtered to avoid clicks during
rapid movements. The delay value d is defined by a numerical entry box
also filtered to avoid clicks. The parameter m is the maximum size of
the delay and should be a power of 2.

The last line defines process, the equivalent of main in C, as a
parallel composition of 10 lines.

A fully functional jack application can be easily generated using the
faust2jack command or by pasting the above code in the online faust
compiler (http://faust.grame.fr). The performances on my Vaio laptop
(Intel Core 2 CPU T7400 @ 2.16GHz) is approximately of 2%.

Cheers

Yann

Fons Adriaensen a écrit :
> On Fri, Jan 25, 2008 at 12:57:19PM -0500, Stephen Sinclair wrote:
>
>
>>>> Also, nice in the fact that you can do per-sample computations easily,
>>>>
>>> How ? I seem to have missed something...
>>>
>> Because you can wait in a 1-sample loop?
>>
>> Yes, it will use your whole CPU for a loop like that, but this thread
>> is about prototyping. Obviously you'd rewrite in C for a real
>> application.
>> I never claimed chuck is perfect, but I've been liking it a lot
>> lately. Sure, it can have performance issues depending on how you use
>> it, but the nice thing is having the option to abuse it that way when
>> necessary.
>>
>
> This is one of the things I wanted to create a 'rapid prototype'
> for recently. I needed a jack client implementing:
>
> - a delay line,
> - allowing high-quality fractional-sample delays,
> - at least 12 outputs, for each two controls: delay, gain,
> - smooth 'crossfading' between two control sets, both delay
> and gain, controlled by a GUI or by OSC.
>
> It should not take more than 20% CPU on a 2G P4
> (other things have to run at the same time).
> If you know how to get this faster than by actually
> writing it in C++, please let me know !
>
>
>

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Wed Jan 30 04:15:02 2008

This archive was generated by hypermail 2.1.8 : Wed Jan 30 2008 - 04:15:03 EET