The following white noise sound was generated with GNU Octave’s random number generator rand(), which generates uniformly distributed random values in the interval [0,1). The wavwrite() function expects values in [-1.0, 1.0), so we multiply by 2 and shift down by 1. So to generate 10 seconds of noise sampled at 48 kHz:
white=rand(48000*10,1)*2-1;
I’m not sure about the inner workings of /dev/urandom, but I used the “reseed” command to feed it data from random.org, so this should be pretty random. To export this to a 16-bit, 48 kHz .wav file in our home directory, the command is:
wavwrite(white,48000,16,'white noise uniform.wav');
Then I converted the .wav file to a FLAC-encoded Ogg (.oga) file:
flac --ogg "white noise uniform.wav"
(The “compressed” FLAC file is actually larger than the .wav file.) 🙂 Then I generated a lossily-compressed .ogg Vorbis file:
oggenc "white noise uniform.wav"
RMS value derived from:
sox "white noise uniform.wav" -e stat
and then in dB is
Histogram derived from
hist(white,100,1)
Source:wikipedia.org
Assalamualaikum
Bapak, mau tanya, mengapa menggunakan rand() ketimbang randn()
karena saya baca di dokumentasi, fungsi randn() tidak menunjukkan range hanya antara 0 dan 1 (artinya tidak perlu di-double dan down-shift 1)
LikeLike
From Octave help, randn >> Return a matrix with random elements uniformly distributed on the interval (0, 1).
check the original link >> http://www.bagustris.tk/2011/10/generating-white-noise-sound-on-octave.html
On Sun, Feb 26, 2017 at 11:28 PM, bagustris@wordpress wrote:
>
LikeLike
Karena saya inginnya range nya hanya (0,1) saja.
From Octave help,
randn >> Return a matrix with random elements uniformly distributed on the
interval (0, 1).
check the original link >> http://www.bagustris.tk/2011/10/generating-white-noise-sound-on-octave.html
LikeLike
This method will generate a White Noise with high density on negative side and low density in positive side. Check the signal with Audacity (example).
LikeLike