@audio/saturate-tape 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +32 -0
- package/tape.js +12 -0
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@audio/saturate-tape",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Tape saturation — tanh transfer + playback HF rolloff (simplified machine model)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "tape.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./tape.js",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"tape.js"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@audio/saturate-core": "^1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"audio",
|
|
20
|
+
"dsp",
|
|
21
|
+
"saturation",
|
|
22
|
+
"tape"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Dmitry Iv. <dfcreative@gmail.com>",
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=18"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/tape.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Tape saturation — simplified machine model: tanh transfer with gentle post HF
|
|
2
|
+
// rolloff (playback-head loss). Even/odd blend milder than tube/transistor.
|
|
3
|
+
import { shape, onepole } from '@audio/saturate-core'
|
|
4
|
+
|
|
5
|
+
export default function tape (data, { drive = 1.5, warmth = 0.25, fs = 44100, oversample = 4, mix = 1 } = {}) {
|
|
6
|
+
let dry = mix < 1 ? Float32Array.from(data) : null
|
|
7
|
+
let norm = Math.tanh(drive)
|
|
8
|
+
shape(data, x => Math.tanh(drive * x + 0.08 * drive * x * x) / norm, { fs, oversample, mix: 1 })
|
|
9
|
+
onepole(data, 0.35 + 0.45 * warmth)
|
|
10
|
+
if (dry) for (let i = 0; i < data.length; i++) data[i] = dry[i] * (1 - mix) + data[i] * mix
|
|
11
|
+
return data
|
|
12
|
+
}
|