Wednesday, April 25, 2018

Unlimited Soothing Surf & Stimulating Thinking w/ Brownian Noise

Challenge: Fighting noise with noise?  How to source unlimited soothing sounds to aid heavy thinking -- and block out highway noise?  And avoid use of privacy invasive apps / websites -- and run on "old" hardware?  

First a quick solution example -- and then second -- detailed background discussion.  

On almost any *NIX system -- using SoX -- the following commands will generate "Surf Noise" -- sound that mimics ocean waves breaking & retreating on a beach -- much more pleasing than just un-modulated stream of noise:

# =======================================================
# -- Option #1: Using Sound Exchange (SoX) tools 
# -- Unlimited "real time" play with surf waves (brown noise)  
# -- with period 8 secs (0.125 Hz) and 10% zero offset
/usr/bin/play -n synth brownnoise mix synth sine amod 0.125 10 


# --- Or write 40 secs audio to a WAV file at CD quality of 44100: 
/usr/bin/sox -r 44100 \
             -n surf_out.wav synth 40 brownnoise  \
             mix synth sine amod 0.125 10 

Hear & see "surf_out.wav" -- via YouTube -- video rendering generated via FFMPEG over piano keyboard scale (showcqt filter):  
40 secs of brown noise modulated by 
"ocean waves" with 8 sec period

Alternate tool? A fun visual frequency spectrum -- generated using FFMPEG / FFPLAY -- and synthetic input "device" anoisesr  -- and Tremolo modulated -- to simulate beach waves:

# =====================================================
# -- Generate Ocean Surf wave noise & spectrum display 
# -- Hints from obscure FFMPEG development notes:
#  http://k.ylo.ph/2015/11/30/endless-seashore.html 
#  
# -- for audio only, set "-showmode 0"


/usr/bin/ffplay -f lavfi -showmode 2 \
  -i 'anoisesrc=d=40:color=brown:r=44100:a=0.5' \
  -af tremolo=f=0.125:d=0.9 

# --- save to file with ffmpeg 

/usr/bin/ffmpeg -y -f lavfi \
       -i 'anoisesrc=d=40:color=brown:r=44100:a=0.5' \
       -af tremolo=f=0.2:d=0.9  \
        surf_out.wav

BACKGROUND:  Why these examples? Why unlimited ocean wave noise?  Sourced for work & study? 

During undergraduate school, I discovered that background music was soothing help -- while doing complex math & physics homework.  And subjectively seemed to aid problem solving. There is evidence appropriate noise levels help ADHD children -- and according the Wall St Journal, a little noise help normal folks.  See also end of script notes.

Beyond math, for this author, when writing was required -- different brain circuits were involved -- and music -- especially if there were lyrics.  The lyrics mangled the word smithing process.  Use of noisy fans -- or better -- noise from rain / thunderstorms -- provided brain stimulation -- minus the cross wiring of thoughts from lyrics. 

Since childhood days, this author has often used small electric fans or noisy space heaters -- to generate a background of "pink noise" -- and help drown out the spurious urban & suburban sounds.  My spouse regularly uses fans to aid sleep. Using noise sources to aid sleep is so common many commercial solutions exist.


One possible commercial noise
machine (from wikipedia pixs)

Natural Sources: This author enjoys ambient audio recording of passing thunderstorms -- for later soothing playback during long dry spells -- and to provide low level brain stimulation for mentally concentrated work -- or sleep assistance.  One of the down sides of recording in suburban environments is persistent low frequency traffic rumble -- mostly wheel intermod rumble under 30 Hz.  Depending upon atmospheric conditions, this low freq rumble can persist for many miles from traffic sources -- and can be difficult to filter out -- and retain the pleasing deep thunder boom harmonics.

Synthetic Solution?  There are herds smartphone apps --  interesting websites -- and many YouTube videos -- that provide soothing "white/pink" background noise -- and help drown out traffic / urban noise pollution.  Each of these have their up & down sides.  Enter a low cost option: Most laptops -- even 6-8 year old laptops -- have excess CPU capacity to generate soothing ocean wave noise.  Why not give new life to an old laptop -- and avoid buying a white noise machine?

UPSHOT? FOSS tools like SoX and FFMPEG / FFPLAY -- and from experiments illustrated here -- great for generating soothing background "surf" or ocean wave noise.  To paraphrase an old 1960s TV show: Your mission, Jim -- should you choose to accept it -- is to give these tools a shot -- you will be surprised at their power and flexibility -- beyond "trivial" synthetic surf sounds.  As always, should your computer be caught or killed, my secretary will dis-avow any knowledge of your actions.  Good luck Jim!

No comments:

Post a Comment