Creating Brown Noise with WaveProvider32 in C#

  • Thread starter Thread starter btb4198
  • Start date Start date
  • Tags Tags
    Noise
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
btb4198
Messages
570
Reaction score
10
ok I am new to Brown Noise and DSP
but from I read this is how you would do it :
Code:
 class BrownNoise : WaveProvider32
    {
        double T;
        int N;
        double dt;
        Random rand1;
        float lastValue;
public BrownNoise()
{
    T = 1;
   rand1 = new Random();
    }

public override int Read(float[] buffer, int offset, int sampleCount)
{
    buffer[0] = 0;
    lastValue =0;

    dt = T / (double)sampleCount;

    for (int i = 1 ; i < sampleCount; i++)
    {
    float temp = (float)(Math.Sqrt(dt)*rand1.Next(255));
    buffer[i] = lastValue + temp;
    lastValue = temp;
    }
    return sampleCount;
}

is that right?
Brown noise you do add the last number with the new number right ?
also
samplecount = 13230;
offset = 0;
 
Engineering news on Phys.org
I'm sorry you are not generating any responses at the moment. Is there any additional information you can share with us? Any new findings?