COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Generate noise with specific crest factor

• Email
• Follow

```Hi all,

It's been a couple of years since I last visited comp.dsp. But now I
finally have a dsp related question :) I need to generate noise with
a
specific crest factor, so I tested in SciLab with:
1. Generate a vector of uniformly distributed random numbers (noise if
you will) in the range [-pi/2,+pi/2]
2. Feed that into sin(...) and get a vector with range [-1,+1]
Seems to work pretty nicely, since the RMS of the vector from (2) is
about 0.707 which would be same CF as a sine wave with +/- 1
amplitude.

But I'd really like to have a generator so I can generate with an
arbitrary CF (actually I have a parameterized one but the parameter
maps
porly to achieved CF... :( )

Ideas ?
/Rob
```
 0

See related articles to this posting

```On 24 Jan, 16:24, Rob <robert.bie...@xponaut.se> wrote:
> But I'd really like to have a generator so I can generate with an
> arbitrary CF (actually I have a parameterized one but the parameter
> maps
> porly to achieved CF... :( )

Hehe... some more fiddling with integrals, now I got a function so I
can get arbitrary CF parameterized :)

/Rob
```
 0

```On Jan 24, 10:24=A0am, Rob <robert.bie...@xponaut.se> wrote:
>
> It's been a couple of years since I last visited comp.dsp. But now I
> finally have a dsp related question :) I need to generate noise with
> a specific crest factor, so I tested in SciLab with:
> 1. Generate a vector of uniformly distributed random numbers (noise if
> you will) in the range [-pi/2,+pi/2]
> 2. Feed that into sin(...) and get a vector with range [-1,+1]
> Seems to work pretty nicely, since the RMS of the vector from (2) is
> about 0.707 which would be same CF as a sine wave with +/- 1
> amplitude.
>
> But I'd really like to have a generator so I can generate with an
> arbitrary CF (actually I have a parameterized one but the parameter
> maps poorly to achieved CF... :( )
>
> Ideas ?

isn't the crest factor totally determined by the p.d.f. of the random
variable?

assuming you have a uniform pseudo-random variable generated by the
computer, you should be able to pass this through a deterministic
function to send that uniform p.d.f. to the p.d.f. that has the crest
factor you want.  there may be many p.d.f.s that have the desired
crest factor, and i am not sure how to best choose between them.

r b-j

```
 0

```Hi Robert,

On 26 Jan, 17:17, robert bristow-johnson <r...@audioimagination.com>
wrote:
> isn't the crest factor totally determined by the p.d.f. of the random
> variable?

Yes, should be.

>
> assuming you have a uniform pseudo-random variable generated by the
> computer, you should be able to pass this through a deterministic
> function to send that uniform p.d.f. to the p.d.f. that has the crest
> factor you want. =A0there may be many p.d.f.s that have the desired
> crest factor, and i am not sure how to best choose between them.

Not sure you've seen my later posts where I've successfully created
that deterministic function allowing
me to choose crest factor arbitrarily.

Thanks though :)
/Rob
Ps. Is Grant G still "around" ?
```
 0

```The lazy solution:
1. generate a "noise" consisting of random 1 and -1 (crest factor = 1)
2. insert a single randomly placed sample with the desired crest factor
as its amplitude

On 26.01.2011 17:21, Rob wrote:
> Hi Robert,
>
> On 26 Jan, 17:17, robert bristow-johnson<r...@audioimagination.com>
> wrote:
>> isn't the crest factor totally determined by the p.d.f. of the random
>> variable?
>
> Yes, should be.
>
>>
>> assuming you have a uniform pseudo-random variable generated by the
>> computer, you should be able to pass this through a deterministic
>> function to send that uniform p.d.f. to the p.d.f. that has the crest
>> factor you want.  there may be many p.d.f.s that have the desired
>> crest factor, and i am not sure how to best choose between them.
>
> Not sure you've seen my later posts where I've successfully created
> that deterministic function allowing
> me to choose crest factor arbitrarily.
>
> Thanks though :)
> /Rob
> Ps. Is Grant G still "around" ?

```
 0

```On 26 Jan, 17:32, Andre <lod...@pathme.de> wrote:
> The lazy solution:
> 1. generate a "noise" consisting of random 1 and -1 (crest factor = 1)
> 2. insert a single randomly placed sample with the desired crest factor
> as its amplitude

Nope, that won't work. Crest factor == Peak/RMS. I doubt that the RMS
of the noise will change significantly with
that single sample insertion.

/Rob
```
 0

```On Jan 27, 11:35=A0am, Rob <robert.bie...@xponaut.se> wrote:
> On 26 Jan, 17:32, Andre <lod...@pathme.de> wrote:
>
> > The lazy solution:
> > 1. generate a "noise" consisting of random 1 and -1 (crest factor =3D 1=
)
> > 2. insert a single randomly placed sample with the desired crest factor
> > as its amplitude
>
> Nope, that won't work. Crest factor =3D=3D Peak/RMS. I doubt that the RMS
> of the noise will change significantly with
> that single sample insertion.
>

but Andre is saying that the *peak* will change.  even by a single
sample.

r b-j

```
 0

```On 27 Jan, 18:28, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On Jan 27, 11:35=A0am, Rob <robert.bie...@xponaut.se> wrote:
>
> > On 26 Jan, 17:32, Andre <lod...@pathme.de> wrote:
>
> > > The lazy solution:
> > > 1. generate a "noise" consisting of random 1 and -1 (crest factor =3D=
1)
> > > 2. insert a single randomly placed sample with the desired crest fact=
or
> > > as its amplitude
>
> > Nope, that won't work. Crest factor =3D=3D Peak/RMS. I doubt that the R=
MS
> > of the noise will change significantly with
> > that single sample insertion.
>
> but Andre is saying that the *peak* will change. =A0even by a single
> sample.

Ah... yeah. Now I see it, my eyes kind of filtered out that the noise
was just 1's and -1's (sorry Andre ;)

But anyway, it is lazy as the solution will have no practical value...

/R
```
 0

```On Jan 27, 2:34=A0pm, Rob <robert.bie...@xponaut.se> wrote:
> On 27 Jan, 18:28, robert bristow-johnson <r...@audioimagination.com>
> wrote:
>
> > On Jan 27, 11:35=A0am, Rob <robert.bie...@xponaut.se> wrote:
>
> > > On 26 Jan, 17:32, Andre <lod...@pathme.de> wrote:
>
> > > > The lazy solution:
> > > > 1. generate a "noise" consisting of random 1 and -1 (crest factor =
=3D 1)
> > > > 2. insert a single randomly placed sample with the desired crest fa=
ctor
> > > > as its amplitude
>
> > > Nope, that won't work. Crest factor =3D=3D Peak/RMS. I doubt that the=
RMS
> > > of the noise will change significantly with
> > > that single sample insertion.
>
> > but Andre is saying that the *peak* will change. =A0even by a single
> > sample.
>
> Ah... yeah. Now I see it, my eyes kind of filtered out that the noise
> was just 1's and -1's (sorry Andre ;)
>
> But anyway, it is lazy as the solution will have no practical value...

yup.

r b-j

```
 0

```On 27.01.2011 20:34, Rob wrote:
> On 27 Jan, 18:28, robert bristow-johnson<r...@audioimagination.com>
> wrote:
>> On Jan 27, 11:35 am, Rob<robert.bie...@xponaut.se>  wrote:
>>
>>> On 26 Jan, 17:32, Andre<lod...@pathme.de>  wrote:
>>
>>>> The lazy solution:
>>>> 1. generate a "noise" consisting of random 1 and -1 (crest factor = 1)
>>>> 2. insert a single randomly placed sample with the desired crest factor
>>>> as its amplitude
>>
>>> Nope, that won't work. Crest factor == Peak/RMS. I doubt that the RMS
>>> of the noise will change significantly with
>>> that single sample insertion.
>>
>> but Andre is saying that the *peak* will change.  even by a single
>> sample.
>
> Ah... yeah. Now I see it, my eyes kind of filtered out that the noise
> was just 1's and -1's (sorry Andre ;)
>
> But anyway, it is lazy as the solution will have no practical value...
>
> /R

It may serve to test algorithms that do calculate the crest factor, but
certainly not more...

Andre

```
 0