{"_id":"@audio/spectral-target","_rev":"2-b003922494d2530c525543022475004f","name":"@audio/spectral-target","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@audio/spectral-target","version":"1.0.0","keywords":["audio","dsp","spectral","ltas","eq","target-curve","match-eq","adaptive-eq"],"author":{"name":"Dmitry Iv.","email":"dfcreative@gmail.com"},"license":"MIT","_id":"@audio/spectral-target@1.0.0","maintainers":[{"name":"jamen","email":"jamenmarz@gmail.com"},{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"df.creative@gmail.com"}],"dist":{"shasum":"600f4e4eb4ae75e78bea1b3f4f2c403085ae4c25","tarball":"https://registry.npmjs.org/@audio/spectral-target/-/spectral-target-1.0.0.tgz","fileCount":3,"integrity":"sha512-acvvIqWigOqt8a4FxSCIT9X0MWO+aF7RUB+nUxrlrm0QA0FpJjh1NFG2Q6Y1GSw2bUsGnpMct875BQmbWU0PKA==","signatures":[{"sig":"MEUCICs4gpWfWusFkOZL530AzldgeCuZj6p8qZwwPbthIwVRAiEArFtWFe28rAPpyExBQG6eQh8BAFaPZewzzk4Na8q2OfQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16076},"main":"target.js","type":"module","engines":{"node":">=18"},"exports":{".":"./target.js","./package.json":"./package.json"},"gitHead":"aa4b708be5b9e10345e540e7d333a63e3f1b733f","_npmUser":{"name":"dy","email":"df.creative@gmail.com"},"_npmVersion":"11.12.1","description":"Target-curve library — per-content-type LTAS targets (speech/music/pink/voice-music) + deviation math for adaptive/match EQ","directories":{},"sideEffects":false,"_nodeVersion":"25.9.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/spectral-target_1.0.0_1783722914663_0.007217908770145831","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@audio/spectral-target","version":"1.0.1","description":"Target-curve library — per-content-type LTAS targets (speech/music/pink/voice-music) + deviation math for adaptive/match EQ","type":"module","sideEffects":false,"main":"target.js","exports":{".":"./target.js","./package.json":"./package.json"},"keywords":["audio","dsp","spectral","ltas","eq","target-curve","match-eq","adaptive-eq"],"license":"MIT","author":{"name":"Dmitry Iv.","email":"dfcreative@gmail.com"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/audiojs/spectral.git","directory":"packages/spectral-target"},"funding":"https://github.com/sponsors/audiojs","gitHead":"0bf461273c2acb2401ff9842afec35a43fd05a9a","_id":"@audio/spectral-target@1.0.1","bugs":{"url":"https://github.com/audiojs/spectral/issues"},"homepage":"https://github.com/audiojs/spectral#readme","_nodeVersion":"25.9.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-gSE7zB29LjBNh/FdrfObovBHveEOB9CIZCHhveZbMjDlDdR/xWsRf6+DSwBC6SuhlNNI2EtAxqPLGixXwbR4oQ==","shasum":"39b555bdb3a12e631a435fcbca215a1aa2c38d62","tarball":"https://registry.npmjs.org/@audio/spectral-target/-/spectral-target-1.0.1.tgz","fileCount":4,"unpackedSize":17885,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCAcWBPKUv4BkXNw137hwKfk80dyPbQRgMkLPoRW8WHKAIhAK/0SYH5vZWddLv7x6RYrz6IHbSszpaXcKvZOM7rkMXM"}]},"_npmUser":{"name":"dy","email":"df.creative@gmail.com"},"directories":{},"maintainers":[{"name":"jamen","email":"jamenmarz@gmail.com"},{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"df.creative@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/spectral-target_1.0.1_1783731897809_0.170811057917861"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-10T22:35:14.518Z","modified":"2026-07-11T01:04:58.091Z","1.0.0":"2026-07-10T22:35:14.842Z","1.0.1":"2026-07-11T01:04:57.944Z"},"author":{"name":"Dmitry Iv.","email":"dfcreative@gmail.com"},"license":"MIT","keywords":["audio","dsp","spectral","ltas","eq","target-curve","match-eq","adaptive-eq"],"description":"Target-curve library — per-content-type LTAS targets (speech/music/pink/voice-music) + deviation math for adaptive/match EQ","maintainers":[{"name":"jamen","email":"jamenmarz@gmail.com"},{"name":"dfcreative","email":"df.creative@gmail.com"},{"name":"dy","email":"df.creative@gmail.com"}],"readme":"# @audio/spectral-target\n\n> Target-curve library — per-content-type LTAS targets + the deviation math that turns\n> (measured LTAS, target) into an EQ correction curve.\n\nCurve data + pure math, no DSP kernel of its own. Companion of [`@audio/spectral-ltas`](https://github.com/audiojs/spectral/tree/main/packages/spectral-ltas)\n(returns linear RMS magnitude per FFT bin, length `half+1`, bin `k ↔ k·fs/frameSize`) — every\ncurve here renders onto that exact bin grid.\n\n```js\nimport target, { deviation, smooth } from '@audio/spectral-target'\n\nlet curve = target('speech', { fs: 44100, bins: 2049 })      // Float32Array dB per bin\nlet custom = target([[100, 0], [1000, -10], [8000, -25]], { fs, bins })\n\nlet correction = deviation(measuredLtas, curve, { fs })      // target − measured, smoothed, clamped\nlet smoothed = smooth(someDbCurve, { fs, oct: 1 / 3 })\n```\n\n| export | role |\n|---|---|\n| `target(name \\| anchors, { fs=44100, bins=2049 })` | render `'speech'` \\| `'music'` \\| `'pink'` \\| `'voice-music'` or a custom `[[freqHz, dB], …]` table to a dB-per-bin curve |\n| `deviation(measuredLtas, targetDb, { fs=44100, smoothOct=1/3, clamp=12 })` | `target − measured` → EQ correction curve, dB per bin |\n| `smooth(db, { fs=44100, oct=1/3 })` | fractional-octave smoothing of any per-bin dB curve |\n\n## Sources\n\n**`'speech'`** — Byrne, Dillon, Tran et al. 1994, [\"An international comparison of long-term\naverage speech spectra,\"](https://doi.org/10.1121/1.410152) *JASA* 96(4):2108–2120. Table II,\np.2116, **\"Combined\"** column (male+female average across 17 samples / 12 languages, normalized\nto 70 dB SPL overall) — the paper's own \"universal LTASS.\" 1/3-octave, 100 Hz–10 kHz (the paper\nalso tabulates 63/80 Hz and 12.5/16 kHz; this module uses its stated 100 Hz–10 kHz range):\n\n| Hz | 100 | 125 | 160 | 200 | 250 | 315 | 400 | 500 | 630 | 800 | 1000 | 1250 | 1600 | 2000 | 2500 | 3150 | 4000 | 5000 | 6300 | 8000 | 10000 |\n|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n| dB | 54.4 | 57.7 | 56.8 | 60.2 | 60.3 | 59.0 | 62.1 | 62.1 | 60.5 | 56.8 | 53.7 | 53.0 | 52.0 | 48.7 | 48.1 | 46.8 | 45.6 | 44.5 | 44.3 | 43.4 | 43.4 |\n\n**`'music'`** — Pestana, Ma, Reiss, Barbosa & Black 2013, [\"Spectral Characteristics of Popular\nCommercial Recordings 1950–2010,\"](https://aes.org/publications/elibrary-page/?id=17010) AES\nConvention 135, Paper 8960, p.5: mean LTAS of 772 UK/US number-one hits shows *\"a linearly\ndecaying distribution of around 5 dB per octave between 100 and 4000 Hz.\"* (Quoted phrase\nverified via Schedin, [\"Target Spectrums For Mastering,\"](https://www.diva-portal.org/smash/get/diva2:1557981/FULLTEXT01.pdf)\nLuleå University of Technology bachelor's thesis, 2021, p.7, which cites the same page — the\nprimary AES paper wasn't directly reachable while sourcing this module; flagging the path\nhonestly rather than implying a direct read.) The paper also describes a low cut \"around 60 Hz\"\nand a slope that gets \"gradually steeper\" above 4 kHz, but publishes no numeric rate for either,\nso neither is modeled with an invented number — see Edge policies below for what happens instead.\n\n**`'pink'`** — analytic, −10·log10(2) ≈ −3.0103 dB/octave (equal energy per octave). Definitional,\nno citation needed: the neutral tonal-balance reference and the exact test anchor.\n\n**`'voice-music'`** — **audiojs-defined convention, not literature.** Bin-wise `max(speech, music)\n− 6 dB`: leans on whichever source curve is louder at each frequency (protects the speech\nformant bands from being swamped by a music-shaped target, while still tracking music's wider\nlow/high extension), pulled down 6 dB so the blend doesn't read hotter than either source. Pragmatic choice for voice-over-music content; revisit if a cited source surfaces.\n\n## Edge policies\n\n- **Below the lowest anchor**: hold its value (flat). Applies to bin 0 / DC — never returns\n  `-Infinity`.\n- **Above the highest anchor**: continue the last segment's slope, not flat.\n- **Interpolation**: log-frequency linear between anchors (exact for `'pink'`, since a\n  log-linear function sampled and re-interpolated log-linearly reproduces itself exactly at\n  every bin — not an approximation).\n- **Normalization**: every curve `target()` returns is mean-normalized to 0 dB over its own\n  *defined band* = `[lowest anchor, min(highest anchor, 0.45·fs)]`. For `'music'` that band is\n  `[100, 4000]` Hz — the paper's own measured range — so `deviation()` guidance built from a\n  *rendered* `'music'` curve is naturally quietest right at that band's edges; combine with\n  `'pink'` or a custom table if you need sourced full-band guidance.\n- **`deviation()`'s own band** is fixed at `[20 Hz, 0.45·fs]` regardless of which target was\n  rendered (it has no anchor metadata to read — `targetDb` is a plain array by design). Outside\n  that band, correction tapers to exactly 0 over a 0.5-octave raised-cosine ramp at each edge\n  (no ultrasonic/DC boosts, and no discontinuous jump in the correction curve).\n\n## Manifest\n\nNo `audio.js` — this atom is not a processor and not a per-signal stat, it's curve data + pure\nmath (same category as `@audio/spectral-pvoc`). A `balance` stat (deviation vs a named target)\nwas considered but doesn't drop out cleanly: computing it from raw `channels` would mean either\ndepending on `@audio/spectral-ltas` (no `@audio/spectral-*` package depends on a sibling today)\nor re-implementing Welch averaging here (duplicating it). Per the atom contract, a package\nwithout a manifest is still an atom — consumers that already hold a measured LTAS call\n`deviation()` directly.\n\n## Consumers\n\nMix Analyser's spectral-balance report, Speech/Music Enhancer's adaptive EQ, Auto-Chain's\nStage-2 EQ, and Match-by-Reference (where the \"target\" is a reference track's own measured LTAS\nvia `@audio/spectral-ltas`, passed straight into `deviation()` in place of a preset). MIT.\n","readmeFilename":"README.md","homepage":"https://github.com/audiojs/spectral#readme","repository":{"type":"git","url":"git+https://github.com/audiojs/spectral.git","directory":"packages/spectral-target"},"bugs":{"url":"https://github.com/audiojs/spectral/issues"}}