rafaelmardojai / blanket

Listen to different sounds
GNU General Public License v3.0
1.33k stars 103 forks source link

Generating noise in runtime #11

Open alice-mkh opened 4 years ago

alice-mkh commented 4 years ago

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

Porrumentzio commented 4 years ago

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

rafaelmardojai commented 4 years ago

There's also:

rafaelmardojai commented 4 years ago

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

octoshrimpy commented 7 months ago

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