Hi there!
I am writing a simple Julia program to generate random noise of various colours. I was thinking to start from white noise and then use colouring filters. Anybody here can point me to some source discussing high accuracy colouring filters?
[SOLVED] Noise Colouring Filters
Moderators: MattKingUSA, khz
Re: Noise Colouring Filters
Hey there!
I had a look at the source code of few generators around and most of them just scale the Fourier transform of random data. I decided to go for a similar way, but I instead define a whole complex frequency response with the required magnitude and linear phase. I apply then this frequency response to the Fourier transformed noise. The coloured noise is then the inverse transform. In Julia code sounds like this:
I had a look at the source code of few generators around and most of them just scale the Fourier transform of random data. I decided to go for a similar way, but I instead define a whole complex frequency response with the required magnitude and linear phase. I apply then this frequency response to the Fourier transformed noise. The coloured noise is then the inverse transform. In Julia code sounds like this:
Code: Select all
# For example, pink noise
x = randn(s) # Random Gaussian Noise
X = rfft(x) # Fourier Transform (use Hermitian Symmetry)
f = 1:(fld(s, 2) + 1) # Frequency axis (unormalized)
H = sqrt(1 ./ f) .* exp(f * im) # Colouring filter Frequency Response
X = X .* H # Frequency Domain Convolution
x = irfft(X, s) # Coloured noise