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
Volume Ramping
No permission to create posts
April 14, 2015
6:30 am
Avatar
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
sp_UserOfflineSmall 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
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall 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
Avatar
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
sp_UserOfflineSmall 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
Avatar
lppier
Member
Members
Forum Posts: 23
Member Since:
December 21, 2014
sp_UserOfflineSmall 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
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall 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)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 476

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 482

Posts: 1876

Newest Members:

sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

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