Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Preventing underflow in filters in the Synth Book Projects
No permission to create posts
November 24, 2015
11:46 pm
Avatar
W Pirkle
Admin
Forum Posts: 140
Member Since:
January 28, 2017
sp_UserOnlineSmall Online

If you have the FX book and use the doBiquad( ) function you know that there is a check for underflow prior to writing the z^-1 value into the register:

// underflow check
if(yn > 0.0 && yn < FLT_MIN_PLUS) yn = 0;
if(yn FLT_MIN_MINUS) yn = 0;

The limits are defined in pluginconstants.h

However, the Synth Book filters use doubles instead. One of my students noticed that when filtering one-shot samples using CSampleOscillator and the CMoogLadderFilter, the CPU meter would spike at the end of the sample event. Very small values were left in the z^-1 registers, and after the sound effect, but prior to the end of the sample, some number of 0-valued samples caused the underflow issue (underflowing is documented in the FX book).

You can do the same kind of check to prevent underflow in these double-based filters with the double-version of min and max positive values, but you need to #define them (NOT in pluginconstants.h but somewhere else):

#define DBL_MIN_PLUS 2.2250738585072014e-308 /* min positive value */
#define DBL_MIN_MINUS -2.2250738585072014e-308 /* min negative value */

Then you can use the same logic code to test the values that will be written into the z^-1 registers before writing them. You will need to modify the code slightly to deal with the specific variable (yn above) that you are examining.

With the Synth Book projects we don't see this issue because we are never streaming 0's into the filters - the note off events stop the voice/filters. However, with one-shot samples that have long trailing 0's this can be an issue. Thanks to Evan Shenkman for finding this.

- Will

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online: W Pirkle
3 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Derek: 41

Peter: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 478

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 29

Topics: 479

Posts: 1870

Newest Members:

certvalue111, sobhana s, sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 140

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 140