5D Library › 节律声刺激、听觉稳态反应与双耳等时调制工程 · English

第三章 粉红噪声、A 计权与睡眠掩蔽

什么是粉红噪声

白噪声的功率谱密度是平的,每赫兹的功率相同;粉红噪声的密度与 1/f1/f 成正比,每个倍频程的功率相同,因此密度每升高一个倍频程下降 10log⁡10210\log_{10}2,即 3.01 dB;布朗噪声与 1/f21/f^2 成正比,每倍频程下降 6.02 dB。Voss 与 Clarke 在音乐与语音的响度起伏中发现了 1/f1/f 谱 (Voss and Clarke 1978),Gardner 把 Voss 的合成算法介绍给了一般读者 (Gardner 1978)。

合成粉红噪声有两种常用办法。Voss-McCartney 法:准备若干行随机数,第 kk 行每隔 2k2^k 个样本重新抽取一次,各行相加,变化慢的行贡献低频,变化快的行贡献高频。滤波器组法:用几个泄漏积分器(一阶 IIR 滤波器)分别对白噪声积分,再按系数相加。程序在 44,100 Hz 下各合成 2172^{17} 个样本,用 Welch 法估计功率谱,在 125 Hz 至 8 kHz 的七个倍频程上拟合斜率。

推导

# Chapter 3. p05: Two ways to make pink noise, and how to check them.
# Pink noise has power density proportional to 1/f^alpha with alpha = 1,
# so each octave carries equal power and the density falls by
# 10 log10(2) = 3.01 dB per octave. Generators at fs = 44,100 Hz,
# 2^17 samples each, fixed seed:
#   white: independent uniform samples;
#   Voss-McCartney: 16 random rows, row k redrawn every 2^k samples,
#     plus one white row, summed;
#   IIR bank: three leaky integrators of white noise (a widely used
#     "economy" filter, coefficients for 44.1 kHz);
#   brown: leaky running sum of white (alpha = 2, 6.02 dB per octave).
# Welch estimate: Hann windows of 4,096, 50 % overlap. Octave bands
# 125 Hz to 8 kHz; slope by least squares of dB on log2(f).
import cmath
import math
import random

FS, N, SEG = 44100, 1 << 17, 4096

def fft(x):
    n = len(x)
    a = list(x)
    j = 0
    for i in range(1, n):
        bit = n >> 1
        while j & bit:
            j ^= bit
            bit >>= 1
        j |= bit
        if i < j:
            a[i], a[j] = a[j], a[i]
    size = 2
    while size <= n:
        w = [cmath.exp(-2j * math.pi * k / size) for k in range(size // 2)]
        for s in range(0, n, size):
            for k in range(size // 2):
                u, v = a[s + k], a[s + k + size // 2] * w[k]
                a[s + k], a[s + k + size // 2] = u + v, u - v
        size *= 2
    return a

def welch(x):
    win = [0.5 - 0.5 * math.cos(2 * math.pi * i / SEG) for i in range(SEG)]
    acc = [0.0] * (SEG // 2)
    count = 0
    for s in range(0, len(x) - SEG + 1, SEG // 2):
        X = fft([x[s + i] * win[i] for i in range(SEG)])
        for k in range(SEG // 2):
            acc[k] += abs(X[k]) ** 2
        count += 1
    return [a / count for a in acc]

def bands(psd):
    out = []
    for o in range(7):
        fc = 125.0 * 2 ** o
        lo, hi = fc / math.sqrt(2), fc * math.sqrt(2)
        ks = [k for k in range(len(psd)) if lo <= k * FS / SEG < hi]
        out.append((fc, 10 * math.log10(sum(psd[k] for k in ks) / len(ks))))
    return out

def slope(b):
    xs = [math.log2(fc) for fc, _ in b]
    ys = [d for _, d in b]
    mx, my = sum(xs) / len(xs), sum(ys) / len(ys)
    return (sum((x - mx) * (y - my) for x, y in zip(xs, ys)) /
            sum((x - mx) ** 2 for x in xs))

def gens(seed=11):
    rng = random.Random(seed)
    white = [rng.uniform(-1, 1) for _ in range(N)]
    rows = [rng.uniform(-1, 1) for _ in range(16)]
    voss = []
    for i in range(N):
        if i:
            k = (i & -i).bit_length() - 1
            if k < 16:
                rows[k] = rng.uniform(-1, 1)
        voss.append(sum(rows) + rng.uniform(-1, 1))
    b0 = b1 = b2 = 0.0
    iir = []
    for w in white:
        b0 = 0.99765 * b0 + w * 0.0990460
        b1 = 0.96300 * b1 + w * 0.2965164
        b2 = 0.57000 * b2 + w * 1.0526913
        iir.append(b0 + b1 + b2 + w * 0.1848)
    acc, brown = 0.0, []
    for w in white:
        acc = 0.998 * acc + w
        brown.append(acc)
    return [("white", white), ("Voss-McCartney", voss),
            ("IIR bank", iir), ("brown", brown)]

if __name__ == "__main__":
    print("   band level in dB relative to the 1 kHz band")
    print("   generator        125   250   500    1k    2k    4k    8k"
          "  dB/oct")
    for name, x in gens():
        b = bands(welch(x))
        ref = b[3][1]
        print("   {:15s}".format(name) + "".join(
            "{:6.1f}".format(d - ref) for _, d in b) +
            "{:8.2f}".format(slope(b)))
    print("   targets: white 0, pink {:.2f}, brown {:.2f}".format(
        -10 * math.log10(2), -20 * math.log10(2)))
    print("\nReading: both pink generators land within 0.1 dB per")
    print("octave of the target slope over seven octaves, while single")
    print("bands wander by up to about 1 dB around the straight line.")
    print("A file sold as pink noise can be checked the same way in a")
    print("few seconds.")
#    band level in dB relative to the 1 kHz band
#    generator        125   250   500    1k    2k    4k    8k  dB/oct
#    white            -0.4   0.3   0.0   0.0   0.0   0.0  -0.0    0.02
#    Voss-McCartney    8.6   5.8   3.1   0.0  -3.2  -6.5  -9.8   -3.08
#    IIR bank          8.9   7.1   3.5   0.0  -2.6  -5.2  -8.8   -2.99
#    brown            17.4  12.3   6.1   0.0  -6.0 -11.9 -17.6   -5.92
#    targets: white 0, pink -3.01, brown -6.02
#
# Reading: both pink generators land within 0.1 dB per
# octave of the target slope over seven octaves, while single
# bands wander by up to about 1 dB around the straight line.
# A file sold as pink noise can be checked the same way in a
# few seconds.

两种粉红噪声的斜率分别是每倍频程 3.08 dB 与 2.99 dB 的下降,离 3.01 dB 的目标都不到 0.1 dB;单个频带围绕直线有最多约 1 dB 的起伏。布朗噪声为 5.92 dB,白噪声为 0.02 dB。任何自称「粉红噪声」的音频文件都可以用同样的办法在几秒钟内检查。

四种噪声在七个倍频程上的相对声级(以 1 kHz 频带为 0 dB)。

同样的声级,不同的读数

声级计通常给出 A 计权声级(dBA)。A 计权曲线在低频处大幅衰减,在 1 kHz 处为 0 dB (International Electrotechnical Commission 2013)。因此,同样的未加权声级,低频成分越多的噪声,A 计权读数越低。这对睡眠掩蔽很重要:一台读数「只有」几十 dBA 的布朗噪声机,可能在低音区相当响。

推导

# Chapter 3. p06: A-weighting, masking margin and night-time arousals.
# Part 1. Three noises with the same flat (unweighted) level of 50 dB
# between 20 Hz and 20 kHz: white (flat density), pink (1/f) and brown
# (1/f^2). Their A-weighted levels follow from integrating the density
# times the IEC 61672 A-curve on a fine logarithmic grid:
#   RA(f) = 12194^2 f^4 / ((f^2 + 20.6^2)
#           sqrt((f^2 + 107.7^2)(f^2 + 737.9^2)) (f^2 + 12194^2)),
#   A(f) = 20 log10 RA(f) + 2.00 dB.
# Part 2. An illustrative arousal model: a noise event of maximum
# level Lmax (dBA) over a steady background B (dBA) has emergence
# E = Lmax - B. Probability of an EEG arousal per event:
#   p = 0.02 + 0.30 / (1 + exp(-(E - 25) / 5)).
# A steady masker raises B and so lowers E for every event, but it
# adds its own sound energy all night long.
import math

def ra(f):
    f2 = f * f
    return (12194.0 ** 2 * f2 * f2 /
            ((f2 + 20.6 ** 2) *
             math.sqrt((f2 + 107.7 ** 2) * (f2 + 737.9 ** 2)) *
             (f2 + 12194.0 ** 2)))

def a_db(f):
    return 20 * math.log10(ra(f)) + 2.00

def levels(alpha, flat_db=50.0, n=4000):
    lo, hi = math.log(20.0), math.log(20000.0)
    tot = wtot = 0.0
    for i in range(n):
        f = math.exp(lo + (hi - lo) * (i + 0.5) / n)
        d = f ** (-alpha) * f
        tot += d
        wtot += d * 10 ** (a_db(f) / 10)
    return flat_db + 10 * math.log10(wtot / tot)

def p_arousal(lmax, bg):
    e = lmax - bg
    return 0.02 + 0.30 / (1 + math.exp(-(e - 25) / 5))

if __name__ == "__main__":
    print("   A-curve at 31.5, 63, 125, 1000 Hz: " + ", ".join(
        "{:.1f}".format(a_db(f)) for f in (31.5, 63, 125, 1000)) + " dB")
    print("\n   noise   flat level   A-weighted   difference")
    for name, al in (("white", 0.0), ("pink", 1.0), ("brown", 2.0)):
        la = levels(al)
        print("   {:6s} {:9.1f} dB {:9.1f} dBA {:9.1f} dB".format(
            name, 50.0, la, la - 50.0))
    print("\n   arousal probability per event")
    print("   background dBA   event 50   event 60   event 70")
    for bg in (25, 35, 40):
        print("   {:14d}   ".format(bg) + "  ".join(
            "{:9.3f}".format(p_arousal(l, bg)) for l in (50, 60, 70)))
    print("\n   expected arousals in a night with 20 events of 60 dBA:")
    for bg in (25, 35, 40):
        print("     background {} dBA: {:.2f}".format(
            bg, 20 * p_arousal(60, bg)))
    print("\nReading: the same unweighted level reads very differently")
    print("on an A-weighted meter. Brown noise hides most of its energy")
    print("below the A-curve, so a 'quiet' brown masker can be loud in")
    print("the bass. Masking lowers arousal per event by shrinking the")
    print("emergence, at the price of a louder night.")
#    A-curve at 31.5, 63, 125, 1000 Hz: -39.5, -26.2, -16.2, 0.0 dB
#
#    noise   flat level   A-weighted   difference
#    white       50.0 dB      48.0 dBA      -2.0 dB
#    pink        50.0 dB      47.1 dBA      -2.9 dB
#    brown       50.0 dB      37.2 dBA     -12.8 dB
#
#    arousal probability per event
#    background dBA   event 50   event 60   event 70
#                25       0.170      0.284      0.315
#                35       0.056      0.170      0.284
#                40       0.034      0.101      0.239
#
#    expected arousals in a night with 20 events of 60 dBA:
#      background 25 dBA: 5.68
#      background 35 dBA: 3.40
#      background 40 dBA: 2.01
#
# Reading: the same unweighted level reads very differently
# on an A-weighted meter. Brown noise hides most of its energy
# below the A-curve, so a 'quiet' brown masker can be loud in
# the bass. Masking lowers arousal per event by shrinking the
# emergence, at the price of a louder night.

A 计权在 31.5 Hz、63 Hz、125 Hz 处分别衰减 39.5 dB、26.2 dB、16.2 dB。三种未加权声级同为 50 dB 的噪声,A 计权读数分别是:白噪声 48.0 dBA,粉红噪声 47.1 dBA,布朗噪声 37.2 dBA,后者比未加权读数低 12.8 dB。

掩蔽与微觉醒

夜间的交通噪声事件会引起脑电的微觉醒,概率随事件最大声级升高 (Basner et al. 2011)。程序的示意模型把觉醒概率写成事件「突显量」(事件最大声级减背景声级)的逻辑函数。背景从 25 dBA 提高到 40 dBA 时,60 dBA 事件的觉醒概率从 0.284 降到 0.101;一夜 20 个这样的事件,预期微觉醒从 5.68 次降到 2.01 次。这就是声音掩蔽的机制:它不靠任何特殊频率,只靠缩小突显量。

三种背景声级下单次噪声事件引起微觉醒的概率(示意模型)。

证据

已发表的证据。 一项小样本研究报告,稳态粉红噪声下受试者的稳定睡眠时间增加 (Zhou et al. 2012)。另一条完全不同的路线是闭环声刺激:在慢波的上升相位播放短促的粉红噪声脉冲,可以增强慢振荡并改善次日的记忆保持 (Ngo et al. 2013)。后者依赖与脑电相位同步的时间控制,与整夜播放的稳态噪声不是同一种干预。世界卫生组织的夜间噪声指南讨论了夜间噪声对睡眠的影响及其限值 (World Health Organization Regional Office for Europe 2009)。

掩蔽的代价是整夜多出一份声能。背景 40 dBA 本身并不安静;第五章会说明,它对听力剂量几乎没有影响,但对睡眠的长期影响需要试验,而不是推理。

假说 · 尚未验证

可检验的推论。 在噪声事件频繁的卧室中,40 dBA 的稳态粉红噪声相比安静对照,应降低每夜由事件引起的微觉醒次数;在事件稀少的安静卧室中,则不应有可测的益处。什么会证明这一推论错:若益处在安静卧室中同样出现,则其机制不是掩蔽,而需要另外解释;若在嘈杂卧室中也不出现,则掩蔽模型不成立。

小结

粉红噪声可以用两种简单的算法合成,并可在几秒钟内检验其斜率。A 计权读数会低估低频噪声的声能。粉红噪声的睡眠作用最可能来自掩蔽:提高背景、缩小噪声事件的突显量。

参考文献

Basner, Mathias, Uwe Müller, and Eva-Maria Elmenhorst. 2011. “Single and Combined Effects of Air, Road, and Rail Traffic Noise on Sleep and Recuperation.” Sleep 34 (1): 11–23.
Gardner, Martin. 1978. “Mathematical Games: White and Brown Music, Fractal Curves and One-over-f Fluctuations.” Scientific American 238 (4): 16–32.
International Electrotechnical Commission. 2013. IEC 61672-1:2013, Electroacoustics. Sound Level Meters. Part 1: Specifications. International Standard.
Ngo, Hong-Viet V., Thomas Martinetz, Jan Born, and Matthias Mölle. 2013. “Auditory Closed-Loop Stimulation of the Sleep Slow Oscillation Enhances Memory.” Neuron 78 (3): 545–53.
Voss, Richard F., and John Clarke. 1978. “‘1/f Noise’ in Music: Music from 1/f Noise.” Journal of the Acoustical Society of America 63 (1): 258–63.
World Health Organization Regional Office for Europe. 2009. Night Noise Guidelines for Europe. WHO Regional Office for Europe.
Zhou, Junhong, Dongdong Liu, Xin Li, Jing Ma, Jue Zhang, and Jing Fang. 2012. “Pink Noise: Effect on Complexity Synchronization of Brain Activity and Sleep Consolidation.” Journal of Theoretical Biology 306: 68–72.

Fan, Y. (2026). Rhythmic Acoustic Stimulation, Auditory Steady-State Responses and Modulation Signal Engineering: Binaural versus Isochronic Envelope Depth, 40-Hz Phase-Locking Bounds and Pink-Noise Spectral Masking [节律声刺激、听觉稳态反应与双耳等时调制工程] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090211 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).