Hi Darwin,
  Check out the diagram here: http://www.donreiman.com/Flanger/Flanger.htm
 
A flanger works like this:   y[n] = x[n] + wetness*x[n-delay] + feedback*y[n-1]

where delay = 0.5*sample_rate / ( center_frequency + mod_depth* LFO[phasor] )

(This will be a float so you need to make an interpolated delay line for 
sub-sample delays)

your LFO is a lookup table, so you will need a phasor (sawtooth oscillator 
between scaled between 0 and 1) to read it.

It is also common to use a triangle wave LFO rather than a sine wave.

-David

On Jun 25, 2014, at 2:48 AM, Darwin Sese <darwins...@gmail.com> wrote:

> I am writing a basic flanger. i successfully create an delay or echo
> effects.
> 
> i am coding an LFO. but i dont know how to do it. here is my code.
> 
> 
> LFO = (float) sin( ((double)i++/(double)TABLE_SIZE) * M_PI * 2. );
> 
> 
> here is my full code functions.
> 
> float flanger( float input )
> {
>            what is the correct value for LFO?
>            LFO = (float) sin( ((double)i++/(double)TABLE_SIZE) * M_PI * 2.
> );
> 
> 
>          //how i can put the lfo here?
>            echo_buffer[echooffset]=input*0.5;
>            if (echooffset++>=ECHO-1)echooffset=0;

>            output+=echo_buffer[echooffset]*0.4;// amount to mix into dry
        
>            if (echooffsetplay++>=ECHO-1)echooffsetplay=0;
> 
> 
> 
> 
> 
> 
>            return output;
> 
> 
> 
> }
> 
> 
> 
> Thanks in advance.
> Darwin
> 
> 
> 
> 
> 
> -- 
>  Darwin Sese
> <http://www.earnmailer.com/link/14976efb59a73c20>
> <http://www.earnmailer.com/alert/confirm/14976efb59a73c20>
> <http://www.earnmailer.com/>
> <flanger.gif>--
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp 
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to