Nonlinear Decay with Effect_Envelope?

Status
Not open for further replies.
Hey all, I've been experimenting with the synth library for the past few months, specifically working on synthesizing percussive sounds, and I've come to the conclusion that part of the reason I can't get the snappy sounds I am after is because the envelope effect decay is too linear. I started trying to decipher the source code for somewhere I might be able to pop in a function to adjust the slope of the decay but having trouble figuring out where in here the linear decay is being implemented. If anyone has ideas and can point me in a direction of what I should be looking at it would be a huge help!

Links to the relevant code for reference:
https://github.com/PaulStoffregen/Audio/blob/master/effect_envelope.cpp
https://github.com/PaulStoffregen/Audio/blob/master/effect_envelope.h
 
Hey all, I've been experimenting with the synth library for the past few months, specifically working on synthesizing percussive sounds, and I've come to the conclusion that part of the reason I can't get the snappy sounds I am after is because the envelope effect decay is too linear. I started trying to decipher the source code for somewhere I might be able to pop in a function to adjust the slope of the decay but having trouble figuring out where in here the linear decay is being implemented. If anyone has ideas and can point me in a direction of what I should be looking at it would be a huge help!


The update method's loop uses inc to adjust the envelope value (mult) for each sample. The code is highly optimized
for linear slopes only, its effectively this in pseudo-code:

Code:
  output <- input * mult
  mult <- mult + inc
  counter <- counter - 1
When the counter reaches zero its the end of the current phase, and the state machine advances.

The actual code is complicated by using both high and low resolution variables, and by loop-unrolling,
all to save a few CPU cycles.
 
Status
Not open for further replies.
Back
Top