blanket icon indicating copy to clipboard operation
blanket copied to clipboard

Generating noise in runtime

Open alice-mkh opened this issue 5 years ago • 5 comments

As a more general solution for https://github.com/rafaelmardojai/blanket/issues/9, a thing that would prevent patterns completely is generating the sounds on the fly instead of just playing a preexisting loop.

While it would be way too complex for e.g. coffee shop sounds, it should be relatively simple for white/pink noise.

See also: https://twitter.com/mattdm/status/1300908885805543424

alice-mkh avatar Sep 01 '20 21:09 alice-mkh

That's a great idea! I don't know how to implement it but there are plenty of examples on a simple search: https://duckduckgo.com/?t=ffab&q=generate+white+noise+python&ia=web Here's an interesting one: https://python-acoustics.github.io/python-acoustics/generator.html?highlight=brown%20noise

Porrumentzio avatar Sep 06 '20 18:09 Porrumentzio

There's also:

  • https://github.com/felixpatzelt/colorednoise
  • https://github.com/scivision/soothing-sounds

rafaelmardojai avatar Sep 06 '20 19:09 rafaelmardojai

But probably we can make this directly with GStreamer (https://gstreamer.freedesktop.org/documentation/audiotestsrc/index.html)

rafaelmardojai avatar Sep 07 '20 02:09 rafaelmardojai

While it would be way too complex for e.g. coffee shop sounds

I have some experience with audio designing for this specific purpose!

The way I do it on cognii is by grabbing a 15 second clip from anywhere in the file, fading in the first 5s, playing the middle 5s at full volume, and fading out the last 5s. while the last 5s fade, the next randomly picked section is fading in its initial 5s, so it gives the illusion of randomized infinite audio from a file as small as 1 minute.

there's a couple things to worry about, specifically keeping constant volume for coffee-shop or train, but that can be mitigated with a bit of planning:

image

octoshrimpy avatar Jan 29 '24 01:01 octoshrimpy