Guest

— Forum Scope —

— Match —

— Forum Options —

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

Volume Ramping
April 14, 2015
6:30 am
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
Offline

Hi Will,

I see from the net some advice on optimization.

"Don't calculate envelopes and LFOs every sample. It's generally fine if you calculate them every 16 samples or so (and ramp volume changes). Same goes for filter settings."

How do I "ramp the volume changes"? What does it mean actually?

Many thanks.

April 14, 2015
7:48 pm
W Pirkle
Forum Posts: 208
Member Since:
January 29, 2017
Offline

Hi Pier

Yeah, this is something I struggled with when writing the book - whether to update everything on each sample interval or not. Eventually, I chose to copy hardware synths and update on each interval.

I believe ramping the volume changes is similar to the dezippering operation - when the volume changes drastically from user input, ramp it slowly to avoid clicks. I think they are referring to calculating the new ramped volume value every 16 samples as well.

There is a big thread in the forum on this topic for removing glitches from GUI control movements.

- Will

April 15, 2015
6:07 am
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
Offline

Hi Will,

I assume it is this post : http://www.willpirkle.com/foru.....oise/class CParamSmooth
{
public:
CParamSmooth(float smoothingTimeInMs, float samplingRate)
{
const float c_twoPi = 6.283185307179586476925286766559f;
a = exp(-c_twoPi / (smoothingTimeInMs * 0.001f * samplingRate));
b = 1.0f - a;
z = 0.0f;
}
inline float process(float in)
{
z = (in * b) + (z * a);
return z;
}
private:
float a;
float b;
float z;
};

In the interest of learning, what exactly am I doing when I am doing this? Could you explain why we use exp, etc?
Thank you.

April 15, 2015
6:11 am
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
Offline

Interestingly, csound has this for the opcode port and portk .. it looks similar except the c2 coefficient is calculated using pow instead of exp as in the zipper noise question. Why the difference, and what is the effect? Thank you.

int porset(CSOUND *csound, PORT *p)
{
p->c2 = pow(0.5, (double)CS_ONEDKR / *p->ihtim);
p->c1 = 1.0 - p->c2;
if (LIKELY(*p->isig >= FL(0.0)))
p->yt1 = (double)(*p->isig);
p->ihtim_old = *p->ihtim;
return OK;
}
int kporset(CSOUND *csound, PORT *p) { return porset(csound, p); }

int port(CSOUND *csound, PORT *p)
{
p->yt1 = p->c1 * (double)*p->ksig + p->c2 * p->yt1;
*p->kr = (MYFLT)p->yt1;
return OK;
}

int kport(CSOUND *csound, KPORT *p)
{
if(p->ihtim_old != *p->ihtim) {
p->c2 = pow(0.5, (double)CS_ONEDKR / *p->ihtim);
p->c1 = 1.0 - p->c2;
p->ihtim_old = *p->ihtim;
}
p->yt1 = p->c1 * (double)*p->ksig + p->c2 * p->yt1;
*p->kr = (MYFLT)p->yt1;
return OK;
}

April 16, 2015
12:03 am
W Pirkle
Forum Posts: 208
Member Since:
January 29, 2017
Offline

These are both just types of lowpass filtering. The impulse response of a 1st order LPF is time-smeared, so they are using that property to effectively slow down the parameter. You just run the parameter in question through the filter and it smooths the edges/discontinuities.

- Will

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
3 Guest(s)

1 Guest(s)

Top Posters:

Skyler: 48

Derek: 44

Peter: 41

Frodson: 40

clau_ste: 39

Gwen: 32

JimmyM: 29

EZB: 24

lppier: 23

Msaldaña: 18

Member Stats:

Guest Posters: 1

Members: 508

Moderators: 1

Forum Stats:

Groups: 11

Forums: 31

Topics: 525

Posts: 2030