Skip to content

Commit

Permalink
implement Magnus Jonsson's suggestion for eliminating ripples in Pink…
Browse files Browse the repository at this point in the history
…Noise

git-svn-id: https://supercollider.svn.sourceforge.net/svnroot/supercollider/trunk@547 a380766d-ff14-0410-b294-a243070f3f08
  • Loading branch information
James McCartney committed Mar 3, 2003
1 parent dd9efc3 commit 7bc21ed
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions source/plugins/NoiseUGens.cpp
Expand Up @@ -40,7 +40,6 @@ struct PinkNoise : public Unit
{
uint32 mDice[16];
int32 mTotal;
int mCounter;
};

struct Dust : public Unit
Expand Down Expand Up @@ -301,8 +300,8 @@ void PinkNoise_next(PinkNoise *unit, int inNumSamples)

uint32 total = unit->mTotal;
uint32 *dice = unit->mDice;
int counter = unit->mCounter;
LOOP(inNumSamples,
uint32 counter = trand(s1,s2,s3); // Magnus Jonsson's suggestion.
int k = (CTZ(counter)) & 15;
uint32 prevrand = dice[k];
uint32 newrand = trand(s1,s2,s3) >> 13;
Expand All @@ -313,7 +312,6 @@ void PinkNoise_next(PinkNoise *unit, int inNumSamples)
ZXP(out) = ((*(float*)&ifval) - 3.0f);
counter ++;
);
unit->mCounter = counter;
unit->mTotal = total;
RPUT

Expand All @@ -332,7 +330,6 @@ void PinkNoise_Ctor(PinkNoise* unit)
dice[i] = newrand;
}
unit->mTotal = total;
unit->mCounter = 1;

ZOUT0(0) = total;
RPUT
Expand Down

0 comments on commit 7bc21ed

Please sign in to comment.