@audio/saturate-transistor 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.
Files changed (2) hide show
  1. package/package.json +32 -0
  2. package/transistor.js +12 -0
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@audio/saturate-transistor",
3
+ "version": "1.0.0",
4
+ "description": "Transistor/console saturation — odd-symmetric cubic, 3rd-harmonic dominant",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "transistor.js",
8
+ "exports": {
9
+ ".": "./transistor.js",
10
+ "./package.json": "./package.json"
11
+ },
12
+ "files": [
13
+ "transistor.js"
14
+ ],
15
+ "dependencies": {
16
+ "@audio/saturate-core": "^1.0.0"
17
+ },
18
+ "keywords": [
19
+ "audio",
20
+ "dsp",
21
+ "saturation",
22
+ "transistor"
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/transistor.js ADDED
@@ -0,0 +1,12 @@
1
+ // Transistor/console saturation — odd-symmetric cubic soft clip:
2
+ // pure odd harmonics (3rd-dominant), the solid-state/console color.
3
+ import { shape } from '@audio/saturate-core'
4
+
5
+ export default function transistor (data, { drive = 2, fs = 44100, oversample = 4, mix = 1 } = {}) {
6
+ let fn = x => {
7
+ let v = drive * x
8
+ let y = v >= 1 ? 2 / 3 : v <= -1 ? -2 / 3 : v - v * v * v / 3
9
+ return y * 1.5 / Math.max(1, drive * 0.75)
10
+ }
11
+ return shape(data, fn, { fs, oversample, mix })
12
+ }