LingSys
↓ 0 downloadsYour machine's memory, GPU, motherboard and network, drawn and played in the Ling design system: LingSys, a small build for USB liquid-cooler displays, LingNet for IPv4/IPv6, DNS and packets, and a LingOS edition. 64-bit and 32-bit Windows builds included.
Keywords system-monitor, visualization, network, ipv6, gpu, lcd, lingos, ling
lingfu install LingSysCode / Files (48)
src/50_audio.ling
# ───────────────────────────── synth ─────────────────────────────────────────
# 28 category partials (7 categories x 4 harmonics) + 4 shimmer partials = slots 0..31.
fn synth(Z, f0, level) {
bind cats = Z[Z_CATS]
bind total = Z[Z_TOTAL]
bind en = Z[Z_ENERGY]
bind rot = Z[Z_ROT]
bind wr = log10(1.0 + Z[Z_WR]) / 4.0
bind c = 0
while c < 7 {
bind w = 0.12 + 0.88 * sqrt(cats[c] / total)
if c == 6 { bind w = w * 0.5 }
bind ang = c * TAU / 7.0 + rot * 0.25
bind h = 1
while h <= 4 {
bind a = level * 0.05 * w * pow(0.62, h - 1) * (0.55 + 0.9 * en[c])
audio_tone(c * 4 + h - 1, 4.0 * cos(ang), 0.0, 4.0 * sin(ang) + 6.0, wr * 2.5, f0 * RATIO[c] * h, a, 0.09 + en[c] * 2.2 + h * 0.03, 0.0015 + 0.012 * en[c])
bind h = h + 1
}
bind c = c + 1
}
# shimmer: upper partials that open with reads, writes, faults and overall activity
bind sh = [Z[Z_RD], Z[Z_WR], Z[Z_FLT], Z[Z_ACT] * 1000.0]
bind s = 0
while s < 4 {
bind lv = clamp(log10(1.0 + sh[s]) / 4.5, 0.0, 1.0)
bind ang = s * TAU / 4.0 + rot * 0.6
audio_tone(28 + s, 5.0 * cos(ang), 1.0, 5.0 * sin(ang) + 6.0, 1.0 + lv * 2.0, f0 * (12.0 + 4.0 * s + 0.25 * s * s), level * 0.012 * lv, 0.3 + lv * 5.0, 0.004 + 0.01 * lv)
bind s = s + 1
}
}
# one chime for a pulse. With pluck = 1 there is no ring: a noise click on the attack, then a short
# plucked note (triangle for in, square for out, so an out pulse is a harder tick).
fn chime(kind, cat, mag, f0, seed, pluck) {
bind oct = 4.0
if seed > 0.5 { bind oct = 8.0 }
if pluck == 1 {
bind ang = seed * TAU
bind px_ = 4.0 * cos(ang)
bind pz_ = 4.0 * sin(ang) + 6.0
audio_sfx(px_, 0.0, pz_, 1.0 + mag, 3000.0 + 2500.0 * seed, 0.05 * (0.4 + 0.6 * mag), 0.012, "noise")
bind wv = "tri"
bind dd = 0.11
if kind == 1 {
bind wv = "square"
bind dd = 0.045
}
audio_sfx(px_, 0.0, pz_, 1.0 + mag, f0 * RATIO[cat] * oct * 2.0, 0.045 * (0.4 + 0.6 * mag), dd, wv)
return 0
}
bind wave = "sine"
bind dur = 1.1
if kind == 1 {
bind wave = "tri"
bind dur = 0.6
}
bind ang = seed * TAU
audio_sfx(4.0 * cos(ang), 0.0, 4.0 * sin(ang) + 6.0, 1.0 + mag, f0 * RATIO[cat] * oct, 0.07 * (0.4 + 0.6 * mag), dur, wave)
}