Shop OBEX P1 Docs P2 Docs Learn Events
Drops, Rain and Sleep ... and the Prop using PropBasic — Parallax Forums

Drops, Rain and Sleep ... and the Prop using PropBasic

Christof Eb.Christof Eb. Posts: 1,201
edited 2013-06-26 09:58 in Propeller 1
Droplet-Prop might be the name of a Project idea, that I have in mind.

It is said, that rain sound helps to find some sleep. Or helps to concentrate. So the first question: What is your opinion, does it help?

It is interesting, that the generation of rain sound is well covered in the Internet. But I could not find any source code. An interesting article:
http://hal.archives-ouvertes.fr/docs/00/82/74/53/PDF/soundParticles_HAL.pdf

Has anyone already made a soundgenerator, which can produce "Cirped Impact Atoms"?
I am thinking of an implementation with PropBasic.

Any comments?
Christof

#####################################################################################################################################################
Edit:
The idea to generate rain resulted into a contest: http://forums.parallax.com/showthread.php/148601-Contest-Make-it-rain!

Please find enclosed Droplet_Prop_G. The binary works for demo-board.
* Noise with two different frequency- ranges.
* Cirped impacts
* Constant frequency impacts
* Impacts with decaying noise.

All done in PropBasic, which is fast enough without using assembler, because it can generate Cog-code. :-)
Have fun, Christof

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-06-11 10:17
    Duplicating the sound of rain?

    You might try searching among Foley sound effects. Theses are things like breaking a stick of celery to fake the sound of a bone being broken. You would surprised as to how many of us are fully conditioned to accept Foley sound effects as the real thing.

    It is easier to use a Foley than to read that Phd material that might eventually work if you can get up to speed with what is being said.

    http://www.ehow.com/how_8749800_make-rain-sound-effects-foley.html

    Once you do a .wav recording, you could easily loop the file. And if you still want to be creative but don't want to try rolling peas around in a box... just try frying some bacon and record that. Yep! that really does sound like rain.

    And of course there are free archives. http://www.soundjay.com/rain-sound-effect.html


  • KeithEKeithE Posts: 957
    edited 2013-06-11 11:04
    If you do use a loop make sure that it's quite long, and has a smooth transition when it loops. I would guess that you would want at least 10 minutes of audio, maybe an hour. If you read reviews for sleep machines on Amazon you'll find plenty of complaints about short loops, and bad loop transitions. I don't see any reason not to make a really long loop.

    Edited to add: if you're willing to just play back wav files see Kye's KISS wav player driver. It worked great for me when I used it to make a dog in the kitchen alarm:

    http://obexclassic.parallax.com/objects/567/

    I don't recall if it directly supports seamless looping. There may be a version in the new obex, but I didn't look.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-11 13:16
    KeithE wrote:
    If you do use a loop make sure that it's quite long, and has a smooth transition when it loops.
    Ditto that. It's amazing how the brain can remember the most random sequences and recognize when they're being repeated. I did a "babbling brook" sound effect one time for a terrarium that my brother was going to build. I ended up with multiple shorter loops that got played in random order. That helped, but after awhile it didn't sound so random any more.

    OTOH, I once did a crackling fire effect. That was generated algorithmically with a PIC, so there were no repeating loops. I would imagine the same could be done with raindrop sounds.

    -Phil
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2013-06-11 18:28
    Droplet-Prop might be the name of a Project idea, that I have in mind.

    It is said, that rain sound helps to find some sleep. Or helps to concentrate. So the first question: What is your opinion, does it help?

    It is interesting, that the generation of rain sound is well covered in the Internet. But I could not find any source code. An interesting article:
    http://hal.archives-ouvertes.fr/docs/00/82/74/53/PDF/soundParticles_HAL.pdf

    Has anyone already made a soundgenerator, which can produce "Cirped Impact Atoms"?
    I am thinking of an implementation with PropBasic.

    Any comments?
    Christof

    First off, my opinion is that rain does help you sleep except of course if you are outdoors or have a leaky roof.

    Since it's raining here now I certainly have no need for this but do you know that Forth has it built-in?............................................Sure! just hook up a speaker and type DROP DROP DROP :)

    BTW, I have "stacks" more where they came from!
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 11:33
    Here's what I've come up with so far. First I downloaded an audio sample of rain here. Using Audacity, I did a frequency analysis, and came up with this:

    attachment.php?attachmentid=102239&d=1371148356

    Next, I tried to duplicate that curve with a FIR filter, using TFilter. This is the result:

    attachment.php?attachmentid=102240&d=1371148356

    The TFilter coefficients were then used to create a PASM-based FIR filter using my online FIR2PASM utility, which you can read about here. I tested the filter using the Spin filter test program available there, and this is the result, showing good agreement with TFilter's graph:

    attachment.php?attachmentid=102238&d=1371148356

    The resulting filter is then excited with white noise form a random number generator, using the attached program. The output sounds a little bit like heavy rain, but it lacks much of the longer-period ambiance of individual droplet sounds.

    -Phil
  • Heater.Heater. Posts: 21,230
    edited 2013-06-13 11:51
    That's an interesting spectrum.
    I was contemplating that if you were listening to rain falling on flat surface all around you then you have relatively few drops falling nearby and more and more further away. That is the low frequency stuff is nearer and the high frequency stuff is further away.

    Now, for any given "ring" around you the frequency of drops in that ring goes up linearly with distance from you. But the amplitude goes down as the inverse square law.

    So your spectrum is what I had in mind already.

    What's missing in this simple idea is the very distinctive sounds that can be made out of rain drops hitting different surfaces and objects. The "ting" on that tin roof, the "plunk" into a lake and so on. What about the regular beat of drips overflowing your guttering and so on.
  • cgraceycgracey Posts: 14,155
    edited 2013-06-13 12:17
    Neat, Phil!

    I think the key to achieving these kinds of effects is using pure synthesis.

    If you could analyze the spectral pattern of a single raindrop hitting a roof, you could synthesize many dozens of raindrops concurrently and get something close to the real thing. You'd want to add some "random" values to the parameters of each raindrop being synthesized for varied effect.
  • PublisonPublison Posts: 12,366
    edited 2013-06-13 12:44
    Brilliant Phil!

    Thanks for sharing.
  • Christof Eb.Christof Eb. Posts: 1,201
    edited 2013-06-13 13:21
    Hi, alltogether and thanks so far.
    I am thinking of using cogsid for single varying drops. Good idea? I have not found sound source examples for a SID, but what I have read gives some encourage. Perhaps multible Sidcogs? And feed that into a short delay loop with random varying feedback length to get many drops.
    . . . Oh, I should have few days off. . .
    Good night Christof
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-13 23:42
    I've added some individual droplet ambiance to the noise mix. The waveform I use for an individual drop is this:

    attachment.php?attachmentid=102245&d=1371192101

    I'm using just the shaded part, as it better simulates a drop hitting a hard surface. The full waveform sounds more like a drop hitting standing water. The waveform is actuated at random times with random frequencies. There's an enforced refractory time after each drop so they don't occur too close together.

    Attached is the code.

    -Phil
  • Ahle2Ahle2 Posts: 1,179
    edited 2013-06-14 02:31
    The SID is amazingly capabaly for things like this. Much thanks to the analog resonance filter, which is heavily used in the clip below.

    Intro screen to Ghouls'n Ghosts on the C64
  • ElectricAyeElectricAye Posts: 4,561
    edited 2013-06-14 06:49
    ... I did a frequency analysis, and came up with this....

    Fascinating. Thanks for sharing.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2013-06-14 06:49
    ... I did a frequency analysis, and came up with this....

    Fascinating. Thanks for sharing.
  • Christof Eb.Christof Eb. Posts: 1,201
    edited 2013-06-16 12:48
    Phil,
    great!!!
    I have read that you can produce pink noise by adding random numbers with different sample rates instead of filtering.

    I had some time today to try something. Unfortunately, it did not work up to now. I did not find the bug for hours. . .
    Christof
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-06-16 15:53
    I have read that you can produce pink noise by adding random numbers with different sample rates instead of filtering.
    The sample rates can remain the same. I have a PASM pink noise generator here:

    BTW, the noise output of the programs I've posted so far is not faithful to the presumptive filtering. That's because I overlooked the fact that the FIR filter was causing overflow. If I preattenuate the white noise, then reamplify it after filtering, it sounds like Smile. Go figure.

    -Phil
  • Christof Eb.Christof Eb. Posts: 1,201
    edited 2013-06-26 09:58
    Just added my Piece of rain into the first post....
    Christof
Sign In or Register to comment.