{"id":16726,"date":"2021-05-23T14:21:23","date_gmt":"2021-05-23T18:21:23","guid":{"rendered":"https:\/\/scruss.com\/blog\/?p=16726"},"modified":"2021-06-08T09:26:46","modified_gmt":"2021-06-08T13:26:46","slug":"an-hour-of-pink-noise","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2021\/05\/23\/an-hour-of-pink-noise\/","title":{"rendered":"An hour of Pink Noise"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"500\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/05\/cover.jpg\" alt=\"\" class=\"wp-image-16727\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/05\/cover.jpg 500w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/05\/cover-320x320.jpg 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/05\/cover-160x160.jpg 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/05\/cover-120x120.jpg 120w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><figcaption>cover made by netpbm, of course<\/figcaption><\/figure><\/div>\n\n\n\n<figure class=\"wp-block-audio aligncenter\"><audio controls src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/1621\/92\/01-pink_noise.mp3\"><\/audio><figcaption>an hour of soothing 2-channel noise<\/figcaption><\/figure>\n\n\n\n<p>Direct download: <a href=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/1621\/92\/01-pink_noise.mp3\">01-pink_noise.mp3<\/a><\/p>\n\n\n\n<p>There are a million variations on the simple &#8220;<em>use sox to play masking pink noise<\/em>&#8220;, such as:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">play -n synth pinknoise gain -3<\/pre>\n\n\n\n<p>This will play synthesized pink noise until you hit Ctrl-C.<\/p>\n\n\n\n<p>But it you want two independent noise channels rather than mono, that&#8217;s a little more complex. It&#8217;s probably easier to download\/play the MP3 file above than show you the command line.<\/p>\n\n\n\n<p>Note that MP3s really aren&#8217;t designed to encode such random data, and it&#8217;s likely that your player will cause the audio to clip in a couple of places. I&#8217;m not quite sure why it does this, but it does it repeatably.<\/p>\n\n\n\n<p>If you want to create this for yourself (and create a bonus lossless FLAC, which was far too large to upload here), here&#8217;s what I did to make this:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n#!\/bin\/bash\n\nduration=&#039;60:00&#039;\nfade=&#039;1&#039;\noutfile=&#039;pinknoise.wav&#039;\n\n# make the track\nsox --combine merge &quot;|sox --norm=-3 -c 1 -b 16 -r 44100 -n -p synth $duration pinknoise&quot; &quot;|sox --norm=-3 -c 1 -b 16 -r 44100 -n -p synth $duration pinknoise&quot; -c 2 -b 16 -r 44100 $outfile fade $fade fade 0 $duration $fade gain -n -3\n\n# make the cover\n# 1 - text - 500 x 500 px\npnmcat -white -tb &lt;(pbmmake -white 500 114) &lt;(pbmtextps -font HelveticaBold -fontsize 64 -resolution 180 &quot;PINK&quot; | pnmcrop) &lt;(pbmmake -white 32 32) &lt;(pbmtextps -font HelveticaBold -fontsize 64 -resolution 180 &quot;NOISE&quot; | pnmcrop) &lt;(pbmmake -white 500 114) &gt; cover-text.pbm\n# 2 - make the noise bg\npgmnoise 500 500 &gt; cover-noise.pgm\n# 3 - make the magenta text\nppmchange black magenta cover-text.pbm &gt; cover-text-magenta.ppm\n# 4 - overlay with transparency\npnmcomp -alpha=&lt;(pnminvert cover-text.pbm | pbmtopgm 35 35 ) cover-text-magenta.ppm cover-noise.pgm | cjpeg -qual 50 -opt -baseline -dct float &gt; cover.jpg\n# delete the temporary image files, leaving cover.jpg\nrm -f cover-text.pbm cover-noise.pgm cover-text-magenta.ppm\n\n# make the mp3\nlame -V 2 --noreplaygain -m s --tt &#039;Pink Noise&#039; --ta &#039;Pink Noise&#039; --tl &#039;Pink Noise&#039; --ty $(date +%Y) --tc &quot;scruss, 2021-05&quot; --tn 1\/1 --tg Ambient --ti cover.jpg &quot;$outfile&quot; 01-pink_noise.mp3\n\n# make the flac (and delete wav file)\nflac --best --output-name=01-pink_noise.flac --delete-input-file --picture=cover.jpg --tag=&quot;TITLE=Pink Noise&quot; --tag=&quot;ARTIST=Pink Noise&quot; --tag=&quot;ALBUM=Pink Noise&quot; --tag=&quot;DATE=$(date +%Y)&quot; --tag=&quot;COMMENT=scruss, 2021-05&quot; --tag=&quot;GENRE=Ambient&quot; --tag=&quot;TRACKNUMBER=1&quot; --tag=&quot;TRACKTOTAL=1&quot; &quot;$outfile&quot;\n\n<\/pre><\/div>\n\n\n<p>You&#8217;ll likely need these packages installed:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt install sox libsox-fmt-all ghostscript gsfonts-x11 netpbm lame flac libjpeg-progs<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Direct download: 01-pink_noise.mp3 There are a million variations on the simple &#8220;use sox to play masking pink noise&#8220;, such as: play -n synth pinknoise gain -3 This will play synthesized pink noise until you hit Ctrl-C. But it you want two independent noise channels rather than mono, that&#8217;s a little more complex. It&#8217;s probably easier [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"An hour of Pink Noise (aka \"Next Door's Baby Got Loud, again\") hand-made for you ...","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12,7],"tags":[2527,1104,270,1473,848,3274,1384,1487],"class_list":["post-16726","post","type-post","status-publish","format-standard","hentry","category-audblog","category-computers-suck","tag-ambient","tag-audio","tag-linux","tag-noise","tag-pink","tag-pinknoise","tag-random","tag-sox"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-4lM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=16726"}],"version-history":[{"count":3,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16726\/revisions"}],"predecessor-version":[{"id":16751,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16726\/revisions\/16751"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=16726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=16726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=16726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}