If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Fade In LFO - Best Technique
4 posts
• Page 1 of 1
Fade In LFO - Best Technique
Which technique you use to implement a fade-in to a LFO?
The concept would be to have a single envelope with attack and control the amplitude-stream of the LFO,
but as you well know to implement an envelope is always linked to a stressful computing for CPU,
you know or use other techniques to do this?
The concept would be to have a single envelope with attack and control the amplitude-stream of the LFO,
but as you well know to implement an envelope is always linked to a stressful computing for CPU,
you know or use other techniques to do this?
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
Re: Fade In LFO - Best Technique
For a synth?
Something like this should be enough....
That should work for you. I don't think there is a simpler way than that.
Something like this should be enough....
- Code: Select all
streamin lfo;
streamin fadeInTime;
streamin sampleRate;
streamout fadeInLfo;
float increment;
float fadeIn;
stage(0)
{
increment = fadeInTime / sampleRate ;
fadeIn = 0; //reset for every new voice
}
fadeInLfo = fadeIn * lfo;
fadeIn = min(fadeIn + increment, 1);
That should work for you. I don't think there is a simpler way than that.
- Exo
- Posts: 426
- Joined: Wed Aug 04, 2010 8:58 pm
- Location: UK
Re: Fade In LFO - Best Technique
Or alternatively you may use exponential fade in (basically the same idea of implementation as Exo's but different envelope shape)
fadeCoef has to be calculated too. Generally it is e^(-1/T) where T is release time in samples.
Note that Release time is not the time it takes for the decay to reach 0, but 0.3679 instead. (exponential curve never really reaches 0).
Exponential curves often sound more natural to human eat than linear.
- Code: Select all
streamin lfo;
streamin fadeCoeff; //this is number usually around 0.9 (always 0-1 range)
streamout out;
float cut=1;
out=lfo*(1-cut); //cut is 1 on start and decays to zero over time
cut= cut*fadeCoeff; //fade coeff controls how fast cud decays
fadeCoef has to be calculated too. Generally it is e^(-1/T) where T is release time in samples.
Note that Release time is not the time it takes for the decay to reach 0, but 0.3679 instead. (exponential curve never really reaches 0).
Exponential curves often sound more natural to human eat than linear.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: Fade In LFO - Best Technique
Thx for this code hint.
- Tronic
- Posts: 539
- Joined: Wed Dec 21, 2011 12:59 pm
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Majestic-12 [Bot] and 76 guests