Generate an extremely long brown/pink/white noise MP3 in Linux

Using, simplified. Added fade-in and fade-out. Compile sox and lame with sndfile support to get the w64 format.


# ^your choice: 'white', 'pink', 'brown', 'tpdf'
# where tpdf stands for Triangular Probability Density Function (cf. dither).
# N.B. - white and pink noise have higher frequencies than Brown.

#does not determine the size of the output when "fade" is used, but must be at least
#as long as the fade cutoff.


# FYI Channels: 2 @ 32-bit, Samplerate: 48000Hz.

#w64 format eliminates the 2GB sox barrier with conventional wav files
mkfifo out.w64
rm -fr noise.mp3

#Makes for a ~7hr, 1GB MP3 with these lame settings (320 kbps CBR)
#This volume was selected to just barely avoid clipping (view the MP3 in Audacity)

sox -c 2 --null out.w64 synth $len ${noise}noise vol $volume fade t 3 $real_len &

lame --preset insane out.w64 out.mp3

#for some reason, lame puts a little loud blip at the beginning of the file,
#at position 0.05s or so. So remove it here
ffmpeg -ss 0.1 -i out.mp3 -acodec copy noise.mp3

rm out.w64
rm out.mp3
This entry was posted in hacks. Bookmark the permalink.

Leave a Reply

Your email address will not be published.