Archive for January, 2009

Two ways of generating white noise

Wednesday, January 14th, 2009

Goal: generate a white noise .wav fille of 1.5 hours
In matlab:


% create a matrix with random values:
>> noise = 2 * rand(90 * 60 * 44100, 2, 'double') - 1;

% write the wav file with a sample frequency o 44.1kHz
>> wavwrite(noise, 44100, 16, 'noise.wav');

This process takes a while and it consumes quite some of your system RAM.

More efficient, in bash:

$ dd if=/dev/urandom count=5400 bs=176400 | sox -s -c 2 -r 44100 -t raw -w - noise.wav

This took only 2 minutes!