Block diagram showing how to turn white noise into rain

In summary, the conversation discusses synthesizing rain noise and creating a block diagram for this process. The speakers mention the characteristics of raindrops and the need to trigger a drum filter at random times to mimic the sound of a raindrop hitting a tent fabric. They also consider using analog circuitry and incorporating the sound into video games.
  • #1
btb4198
572
10
TL;DR Summary
block diagram how to turn white noise in to rain
So I have been looking and trying different thing to synthesize rain noise like this: https://mynoise.net/NoiseMachines/campingRainNoiseGenerator.php

but I cannot get it.

and the graph that this sound makes did not help at all:
1624112347937.png
can some make a block diagram of how to do this?
 
Engineering news on Phys.org
  • #2
The thing about rain drops is that they are all of similar size, falling at similar speeds.
The pulses are more like shot noise than white noise.
The fundamental random feature is the time of arrival.

To generate the drum sound of a raindrop impact on a tent fabric you need to trigger the drum at random times. When a raindrop hits a taught fabric, it plucks a narrow band tuned circuit that rings with a Q of about 5 or 10 = cycles. The centre frequency of the plucked filter is dependent on tension in fabric.

If you start with white noise you must convert that to random trigger events. Maybe use a comparator that detects when the random noise amplitude is greater than a set value. The positive edge of that triggers the drum filter.

You do not identify your simulation software.
 
  • Informative
  • Like
Likes hutchphd and Klystron
  • #3
What do you mean by "diagram"? What kind of diagram? Like a diagram in Labview or something?

Rain noise is a mix of several types of randomness, so it will likely take a few lines of code to synthesize it. You've mentioned 44100Hz in your other thread -- do you have experience generating *.wav files?

https://en.wikipedia.org/wiki/44,100_Hz

EDIT -- Darn it, @Baluncore beat me to the punch again!
 
Last edited:
  • #4
berkeman said:
What do you mean by "diagram"? What kind of diagram? Like a diagram in Labview or something?

Rain noise is a mix of several types of randomness, so it will likely take a few lines of code to synthesize it. You've mentioned 44100Hz in your other thread -- do you have experience generating *.wav files?

https://en.wikipedia.org/wiki/44,100_Hz

EDIT -- Darn it, @Baluncore beat me to the punch again!
Sorry, I meant block diagram. I do not know Labview ... lol

Yes I do .
check this out :
https://www.amazon.com/dp/B01MS8W9XI/?tag=pfamazon01-20
 
  • #5
Baluncore said:
To generate the drum sound of a raindrop impact on a tent fabric you need to trigger the drum at random times. When a raindrop hits a taught fabric, it plucks a narrow band tuned circuit that rings with a Q of about 5 or 10 = cycles. The centre frequency of the plucked filter is dependent on tension in fabric.

If you start with white noise you must convert that to random trigger events. Maybe use a comparator that detects when the random noise amplitude is greater than a set value. The positive edge of that triggers the drum filter.

You do not identify your simulation software.
Please address the points brought up by @Baluncore
 
  • #6
Baluncore said:
The thing about rain drops is that they are all of similar size, falling at similar speeds.
The pulses are more like shot noise than white noise.
The fundamental random feature is the time of arrival.

To generate the drum sound of a raindrop impact on a tent fabric you need to trigger the drum at random times. When a raindrop hits a taught fabric, it plucks a narrow band tuned circuit that rings with a Q of about 5 or 10 = cycles. The centre frequency of the plucked filter is dependent on tension in fabric.

If you start with white noise you must convert that to random trigger events. Maybe use a comparator that detects when the random noise amplitude is greater than a set value. The positive edge of that triggers the drum filter.

You do not identify your simulation software.
Sorry , I am just seeing this, the one is the picture above is audacity.
it is free to download :
https://www.audacityteam.org/
 
  • #7
berkeman said:
Please address the points brought up by @Baluncore
Baluncore said:
The thing about rain drops is that they are all of similar size, falling at similar speeds.
The pulses are more like shot noise than white noise.
The fundamental random feature is the time of arrival.

To generate the drum sound of a raindrop impact on a tent fabric you need to trigger the drum at random times. When a raindrop hits a taught fabric, it plucks a narrow band tuned circuit that rings with a Q of about 5 or 10 = cycles. The centre frequency of the plucked filter is dependent on tension in fabric.

If you start with white noise you must convert that to random trigger events. Maybe use a comparator that detects when the random noise amplitude is greater than a set value. The positive edge of that triggers the drum filter.

You do not identify your simulation software.
Wait are you saying that there should be time where the generate graph is 0 then randomly the sound should spike up . what is the drum filter ?
 
  • #8
btb4198 said:
... I have been looking and trying different thing to synthesize rain noise ...

I was fortunate enough to attend an Electrical Engineering lecture by Robert Moog back in the 1960's. He used all analog circuitry. I was inspired by him and made my own synthesizer that simulated stringed instruments. If I remember correctly, it had some random noise generators that worked well for making snare drum audio, etc. Have you considered doing it with analog circuitry?
 
  • #9
dlgoff said:
I was fortunate enough to attend an Electrical Engineering lecture by Robert Moog back in the 1960's. He used all analog circuitry. I was inspired by him and made my own synthesizer that simulated stringed instruments. If I remember correctly, it had some random noise generators that worked well for making snare drum audio, etc. Have you considered doing it with analog circuitry?
I wanted to added it to video games
 
  • #10
btb4198 said:
I wanted to added it to video games
Will those games run on a PC? If so, will it be embedded in the game or run as a separate system?
Once you have made the sound of one raindrop you can play it at random times.
That way you do not need to do any signal processing while running the game.
What material will the raindrop fall onto?
 
  • #11
  • Like
Likes DaveE, dlgoff and berkeman
  • #12
Borek said:
For a game I would go for a prerecorded sound, much faster and simpler.

See for example https://freesound.org/search/?q=rain
if I synthesize all my sounds, I can save memory. I was told that users normally delete apps that are too big. So I am trying to reduce the size by synthesizing my sounds.
 
  • #13
Baluncore said:
Will those games run on a PC? If so, will it be embedded in the game or run as a separate system?
Once you have made the sound of one raindrop you can play it at random times.
That way you do not need to do any signal processing while running the game.
What material will the raindrop fall onto?
Iphone and Ipod, is my goal.

Rain on a cabin in the woods.
 
  • #14
Identify the material that the cabin roof made from?
Place a sample of the material under a source of slow drips and listen to the sound.
Notice that the sound is tuned and so has a centre frequency.
Notice also that the sound decays exponentially from the impulse.

To synthesise the sound of one drop, design a digital filter that can be stimulated by a step impulse, and that will ring for 10 or 20 cycles. It will have two internal variables representing sine and cosine components. The output will be fed back to the input, the feedback coefficients will determine the decay time. Start the sound record by adding a number representing the energy of the raindrop to one of the two variables. Make one raindrop into a sound file by taking one of the variables as amplitude.

Every time a random drop falls, add that sound file onto the sound output buffer. To slightly vary the sound of different drops you can scale the sound file as you add it into the buffer.

If the rain gets heavy the sound of the drops will overlap in time.
 
  • #15
btb4198 said:
if I synthesize all my sounds, I can save memory. I was told that users normally delete apps that are too big. So I am trying to reduce the size by synthesizing my sounds.

Have you checked that your app is already too big?

Replacing an asset with a procedural version is an optimization technique that you better use as a last resort, once you know simpler ones don't work, as it is typically time consuming and doesn't pay off. Start with a normal WAV file. Is it too large? Will changing to mp3 work? Will changing to mono work?
 
  • #16
Try this sort of thing...
Code:
' digital raindrop oscillator
Dim As Double x, y ' sound phasor is a complex number = real, imag
Dim As Double t = 0.25 ' length of sound recording in seconds
Dim As Double r = 44100 ' sound sample rate per second
Dim As Double f = 100 ' frequency Hz
Dim As Double e = 0.9997 ' (1-decay) per sample
Const As Double TwoPi = 8 * Atn( 1 )

Dim As Double c, s ' the complex rotator sets frequency and decay rate
c = e * Cos( TwoPi * f / r )
s = e * Sin( TwoPi * f / r )

Dim As Integer n = t * r ' number of samples
Dim As Double a( 0 To n ) ' the sound record

x = 1 ' start of the sound phasor
y = 0
For i As Integer = 0 To n
 Dim As Double z = x ' temporary x
 x = c*x - s*y ' complex multiply (c+sj)*(x+yj)
 y = c*y + s*z ' = (cx-sy),(cy+sx)j
 a( i ) = y ' sound output sequence
Next i

' kill the exponential tail
Dim As Integer m = n * 0.33
For i As Integer = n - m To n
 a( i ) *= ( n - i ) / m
Next i
Raindrop.png
 
  • #17
Please ignore this post. I missed ln19 so this does not apply. Tom

Baluncore said:
20 x = c*x - s*y ' complex multiply (c+sj)*(x+yj)
21 y = c*y + s*z ' = (cx-sy),(cy+sx)j

ln 20: "x' is not used
ln21: "z" is undefined
 
Last edited:
  • #18
Baluncore said:
Try this sort of thing...
Code:
' digital raindrop oscillator
Dim As Double x, y ' sound phasor is a complex number = real, imag
Dim As Double t = 0.25 ' length of sound recording in seconds
Dim As Double r = 44100 ' sound sample rate per second
Dim As Double f = 100 ' frequency Hz
Dim As Double e = 0.9997 ' (1-decay) per sample
Const As Double TwoPi = 8 * Atn( 1 )

Dim As Double c, s ' the complex rotator sets frequency and decay rate
c = e * Cos( TwoPi * f / r )
s = e * Sin( TwoPi * f / r )

Dim As Integer n = t * r ' number of samples
Dim As Double a( 0 To n ) ' the sound record

x = 1 ' start of the sound phasor
y = 0
For i As Integer = 0 To n
Dim As Double z = x ' temporary x
x = c*x - s*y ' complex multiply (c+sj)*(x+yj)
y = c*y + s*z ' = (cx-sy),(cy+sx)j
a( i ) = y ' sound output sequence
Next i

' kill the exponential tail
Dim As Integer m = n * 0.33
For i As Integer = n - m To n
a( i ) *= ( n - i ) / m
Next i
View attachment 284816
Hi,
what is Atn( 1 )?

is this VB?
 
  • #19
Tom.G said:
ln 20: "x' is not used
ln21: "z" is undefined
@Tom.G Do you understand how to rotate a vector by using a complex multiply.

x is the real part of the vector = phasor, y is the imaginary part. (x+yj) is a complex number.
x and y are recomputed in each pass of the loop.

I ring the tuned circuit with a step function by setting x = 1; then I take y as the output so it rises from zero without too much click. The risetime is the time the raindrop takes to stop. Then the fabric rings and the sound is absorbed.

z was defined in line 19 as a temporary store of the old x since it is being overwritten in line 20 but is needed again in line 21.
btb4198 said:
what is Atn( 1 )?

is this VB?
Atn(1) is arctangent(1.00) = 45°=π/4 radians; 8 * atn(1) = 2⋅π

Yes it is also VB, I wrote it as Freebasic, you can call it pseudocode.
It is trivial to rewrite it in any language that takes your fancy.
 
  • #20
Baluncore said:
@Tom.G Do you understand how to rotate a vector by using a complex multiply.

x is the real part of the vector = phasor, y is the imaginary part. (x+yj) is a complex number.
x and y are recomputed in each pass of the loop.

I ring the tuned circuit with a step function by setting x = 1; then I take y as the output so it rises from zero without too much click. The risetime is the time the raindrop takes to stop. Then the fabric rings and the sound is absorbed.

z was defined in line 19 as a temporary store of the old x since it is being overwritten in line 20 but is needed again in line 21.

Atn(1) is arctangent(1.00) = 45°=π/4 radians; 8 * atn(1) = 2⋅π

Yes it is also VB, I wrote it as Freebasic, you can call it pseudocode.
It is trivial to rewrite it in any language that takes your fancy.
Hi thanks for all of this
I have a few questions,

1) Why is your number of sample = sample * Frequency ?
I am asking because I was getting a run time error
that says, 'Index was out of range.'

here:
// kill the exponential tail
int m = (int) (n * 0.33);
for (int i = n - m; i <= n; i++)
{
a1 *= (n - i) / (double) m;
}

2) to fix that error I does this. Does it look right to you?
Rain Fall:
  x = 1; // start of the sound phasor
            y = 0;

            int m = (int)(n * 0.33);

            for (int i = 1; i <n; i++)
            {
                double z = x; // temporary x
                x = c * x - s * y; // complex multiply (c+sj)*(x+yj)
                y = c * y + s * z; // = (cx-sy),(cy+sx)j

                // kill the exponential tail
                if (i >= n - m)
                {
                    y *= (n - i) / (double) m;
                }

                a1.Add(y); // sound output sequence
            }
Here is how it come out:


Here is how the graph looks:
1624379232756.png
something went wrong
lol
any ideas?
 

Attachments

  • 1624377472841.png
    1624377472841.png
    247 bytes · Views: 126
  • #21
Baluncore said:
Try this sort of thing...
Code:
' digital raindrop oscillator
Dim As Double x, y ' sound phasor is a complex number = real, imag
Dim As Double t = 0.25 ' length of sound recording in seconds
Dim As Double r = 44100 ' sound sample rate per second
Dim As Double f = 100 ' frequency Hz
Dim As Double e = 0.9997 ' (1-decay) per sample
Const As Double TwoPi = 8 * Atn( 1 )

Dim As Double c, s ' the complex rotator sets frequency and decay rate
c = e * Cos( TwoPi * f / r )
s = e * Sin( TwoPi * f / r )

Dim As Integer n = t * r ' number of samples
Dim As Double a( 0 To n ) ' the sound record

x = 1 ' start of the sound phasor
y = 0
For i As Integer = 0 To n
Dim As Double z = x ' temporary x
x = c*x - s*y ' complex multiply (c+sj)*(x+yj)
y = c*y + s*z ' = (cx-sy),(cy+sx)j
a( i ) = y ' sound output sequence
Next i

' kill the exponential tail
Dim As Integer m = n * 0.33
For i As Integer = n - m To n
a( i ) *= ( n - i ) / m
Next i
View attachment 284816
So I made a few Changes and now my file looks like this :
1624383372456.png


1624383448019.png


it sounds more like a slow drum now:


So I am using Naudio, It is a free audio playing lib (https://markheath.net/post/introducing-naudio-net-audio-toolkit)

anyhow, I am given this function:
int Read(byte[] buffer, int offset, int sampleCount)
{

}

I have to fill in the buffer that is of size sampleCount.

so you are doing :
n = ( t * r);
where r is 44100 sampling rate .
I set my waveformat to 44100 sampleRate and 2 channels.

I am getting a buffer size of 52920 when I play is live
but then I save the file I get a different buffer size of 1411200.

so the save file is sounds different then when I play it live.
The frequency is faster live.

Normally I keep my n as a class variable to I do not break my signal and that works,
but I am not sure how I would do that in this case.
any Ideas ?
 
  • #22
Everyone will have a different ideal raindrop sound that will bring back memories of the shelter they were in at one time. Your ear will hear and believe what you expect.
This is experimental. I did not listen to it before I posted the code.
Reduce the recording time to 0.125 sec.
Raise the centre frequency = resonant frequency of the cabin roof.
Change to using x as the output so you get a distinct impact like a hail stone.
Adjust the damping time to suit.
btb4198 said:
Normally I keep my n as a class variable to I do not break my signal and that works,
but I am not sure how I would do that in this case.
any Ideas ?
I chose a convenient order of computation. You may have to solve for parameters in a different order.
 
  • #23
:sorry: I missed ln.19. o:) o:)

Baluncore said:
z was defined in line 19 as a temporary store of the old x since it is being overwritten in line 20 but is needed again in line 21.
 
  • Like
Likes Baluncore

FAQ: Block diagram showing how to turn white noise into rain

How is white noise converted into rain?

White noise can be converted into rain by using a process called filtering. This involves passing the white noise signal through a filter that mimics the sound of rain, such as a low-pass filter. This filter will remove high frequency components of the white noise, resulting in a sound that resembles rain.

What is the purpose of turning white noise into rain?

The purpose of turning white noise into rain is to create a more soothing and calming sound. White noise can be harsh and unpleasant to listen to, while the sound of rain is often associated with relaxation and can help mask other unwanted noises.

Can any type of white noise be turned into rain?

Yes, any type of white noise can be turned into rain as long as it is a continuous, random signal with equal energy at all frequencies. This includes white noise from electronic devices, as well as natural sources such as wind and ocean waves.

Are there any other methods for creating the sound of rain?

Yes, there are other methods for creating the sound of rain, such as recording actual rain and playing it back, or using sound synthesis techniques to generate the sound of rain. However, converting white noise into rain is a simple and effective method that can be easily implemented.

Is there a specific software or equipment needed to convert white noise into rain?

There are various software and equipment options available for converting white noise into rain. Some audio editing software, such as Audacity, have built-in filters that can be used to create rain sounds. Other options include using a white noise machine or a sound generator specifically designed for producing rain sounds.

Back
Top