# How can I generate pink noise using Mathematica?

I need a time series of pink noise. How can I generate pink noise using Mathematica?

• if you have v11 look at AudioGenerator Commented Jun 19, 2017 at 15:43
• @george2079 That generates audio, is it possible to extract the time series? Commented Jun 19, 2017 at 15:52
• Never heard of pink noise. Could you provide some links so we know exactly what definition you are using? Also, show us what you tried. It will make it easier to help you.
– ivbc
Commented Jun 19, 2017 at 16:06
• @ivbc Thanks. Look here:en.wikipedia.org/wiki/Pink_noise Now I am trying to use entropy to analysis the complexity of white noise and pink noise(1/f).These pink-like noises occur widely in nature. First, I need generating a time series of pink noise. Commented Jun 19, 2017 at 16:16
• @ivbc I just find it: "The 1/f noise is generated as follows: we start with uniformly distributed white noise, calculate the fast Fourier transform (FFT), and after imposing a 1/f distribution on the power spectrum, we calculate the inverse FFT. " Commented Jun 19, 2017 at 16:40

The approach below is still somewhat brute-force, but it was greatly improved by Carl Woll's suggestion to look into AudioData, which was the link I was missing here.

It works to generate a pink noise set using the output of AudioGenerator. you should be able to adapt the code to arbitrary sampling frequency and data length:

audio = AudioGenerator["Pink"]

data = Transpose@{
Range[0, 1 - 1/44100, 1/44100.],
AudioData[audio]
};

ListPlot[data, Frame -> True, Axes -> False]


• For data extraction, look at AudioData Commented Jun 19, 2017 at 16:37
• @MacroB Thanks a lot. It seems work well. Commented Jun 19, 2017 at 16:39
• @CarlWoll Thank you! I was looking for that function exactly, and somehow I overlooked the link right there at the bottom of the documentation page for Audio :-( Is there a way to extract the timing information as well, or is that simply recreated based on sampling frequency? Commented Jun 19, 2017 at 16:41
• @Julian You're welcome. I have modified the code to use AudioData, which is definitely more elegant, thanks to Carl's suggestion. That should look a little better and probably be faster. Commented Jun 19, 2017 at 16:42
• For sample rate, use AudioSampleRate Commented Jun 19, 2017 at 16:45