Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Nonlinear Decay with Effect_Envelope?

  1. #1
    Junior Member
    Join Date
    Aug 2019
    Posts
    8

    Nonlinear Decay with Effect_Envelope?

    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/Au...t_envelope.cpp
    https://github.com/PaulStoffregen/Au...ect_envelope.h

  2. #2
    Senior Member houtson's Avatar
    Join Date
    Aug 2015
    Location
    Scotland
    Posts
    120
    hi cyclpsrock

    this thread doesn't answer your specific question but talks about the same issue and points to a shaped envelope object by @a_guy_called_tom
    https://forum.pjrc.com/threads/60428...l=1#post235811

  3. #3
    Junior Member
    Join Date
    Aug 2019
    Posts
    8
    Quote Originally Posted by houtson View Post
    hi cyclpsrock

    this thread doesn't answer your specific question but talks about the same issue and points to a shaped envelope object by @a_guy_called_tom
    https://forum.pjrc.com/threads/60428...l=1#post235811
    Thank you! Very interesting, somehow missed this in my search.

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    327
    Quote Originally Posted by cyclpsrock View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •