[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself

Search:


View post   

>> No.1743924 [View]
File: 43 KB, 1338x426, 1577928561080[1].png [View same] [iqdb] [saucenao] [google]
1743924

I invented a circled sine function. What do you guys think? Will it result in a warm sound?
It may look like a really round sine, especially if stretched vertically. Here is how I generated it. Remember the challenge is to generate it as a function of time, NOT in the polar coordinates since I want to implement a soft clipper plugin in the time domain.
So here is my secret. Knowing the polar form:
y=r*sin(theta) and x=r*cos(theta),
simply solve for theta=acos(x/r) and then solve for y.

So this "sine" is just two half circles.
Here is how you generate them:
float circle (float x)
{
float m = fmod(x+M_PI/2, M_PI*2);
if (m < 0)
m += M_PI*2;

if (m > M_PI*2)
{
m -= M_PI*2;
}

float theta;

if (m <= M_PI)
{
theta = acos ((m-M_PI/2)/M_PI*2);
}
else
{
theta = -acos ((-M_PI+m-M_PI/2)/M_PI*2);
}

return sin(theta);

}

Pretty cool, huh?

Navigation
View posts[+24][+48][+96]