Hacker News new | ask | show | jobs
by jjoonathan 3318 days ago
The article doesn't adjust for the inherent lowpass/highpass/aliasing behavior of function parameter rate vs sample rate, which is responsible for most of the audible difference, especially the similarities to real life low-passed-noise situations (airplane cabin, high building) noted by the author. Still, I agree, you can hear some residual tones!

Spectra of the 3 noise samples: http://imgur.com/a/gaiVm

I haven't read up on perlin noise recently enough to know whether that's inherent to its structure or whether there's a more mundane explanation like distortion or encoding tomfoolery.

2 comments

Thanks for the spectrograms! I'm not exactly sure which aliasing you're referring to... I'm trying to adjust the sampling rate of the noise function so that it maps to "real" seconds in a way that makes sense. By looking at the waveform in the audio editor, it looks exactly like a visual representation of 1D perlin noise to me (http://imgur.com/a/bM4tn). Looking at your spectrograms though, I'm seeing something in the higher-frequencies (and I think I can hear those as well), but I actually have no explanation for where those could have come from.
That's a completely reasonable thing to do, especially because it might allow you to pick up distortion due to interpolation.

However, you should do the same thing to the white noise [1] if you are going to compare them. If we write the white noise's continuous reconstruction [2] as a function of time, w(t), we could stretch out w(t) until it wiggles at about the same rate as the perlin noise, p(t), and then sample them together at a rate several times higher than that at which they wiggle. Both waveforms would then have the same "muffled roar" sound you get in airplanes, buildings, underwater, etc.

Another mundane explanation for the bands is that they might be "JPEG artifacts" for ogg's compression. Amplitude is logarithmic, so they're probably not as important as they look.

[1] To be pedantic we should call it band-limited white noise, because the sampling+reconstruction process limits the bandwidth, and infinite bandwidth white noise can't actually exist, because it has finite energy per bandwidth * infinite bandwidth = infinite energy. This isn't a theoretical problem. Oscilloscopes have fatter "no-signal" traces in proportion to their bandwidth, the resolution bandwidth ("RBW") of spectrum analyzers lifts the noise floor at higher settings, the field of thermodynamics fell apart in the "ultraviolet catastrophe" before we understood how quantum mechanics effectively limits the bandwidth of thermal radiation, etc.

[2] w(float t) rather than w(int n), obtained by interpolation. Sinx/x interpolation is the interpolation that gives 0 distortion and produces no higher spectral content. It's the time domain equivalent of doing a Fourier Transform, scaling the spectrum, and doing an Inverse Fourier Transform. IIRC Perlin noise is a spline, not sinx/x, so I'd expect its interpolation to produce higher harmonics. By applying perlin-like (spline?) interpolation and sinx/x interpolation to the white noise, you could isolate the audio effects due to the randomization vs the interpolation of the perlin noise. If you were so inclined :)

The code does explicitly assign a frequency of 440 Hz to the parameter rate in the first case and 110, 220, 440 Hz in the second. The second, fractal noise example might have been more interesting to compare to the first one if the author had kept the "fundamental" at 440 Hz and added higher-frequency overtones.