@audio/synth-risset 1.1.2 → 1.1.4

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/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @audio/synth-risset [![npm](https://img.shields.io/npm/v/@audio/synth-risset)](https://www.npmjs.com/package/@audio/synth-risset) [![MIT](https://img.shields.io/badge/MIT-%E0%A5%90-white)](https://github.com/krishnized/license)
2
+
3
+ Risset drum (inharmonic bell-drum)
4
+
5
+ ```
6
+ npm install @audio/synth-risset
7
+ ```
8
+
9
+ ```js
10
+ import risset from '@audio/synth-risset'
11
+ ```
12
+
13
+ Risset drum: a fixed set of five inharmonic partials plus a sub-sine an octave below with slower decay, a simplified take on Risset's classic bell-drum catalogue. Amplitude-normalized to `amp` at the peak. Pitched — `(freq, opts)`.
14
+
15
+ ```js
16
+ risset(100, { duration: 1.2 }) // → Float32Array
17
+ ```
18
+
19
+ | Param | Default | |
20
+ |---|---|---|
21
+ | `freq` | — | Hz (positional) |
22
+ | `duration` | `1.2` | Seconds |
23
+ | `amp` | `0.6` | Peak amplitude (post-normalization) |
24
+ | `fs` | `44100` | Sample rate |
25
+
26
+ **Use when:** a cheap inharmonic drum/bell hybrid distinct from the literature-grounded [`synth-modal`](https://github.com/audiojs/synth/tree/main/packages/synth-modal).
27
+
28
+ ---
29
+
30
+ Part of [@audio/synth](https://github.com/audiojs/synth) — the synth family umbrella.
31
+
32
+ MIT © [audiojs](https://github.com/audiojs)
package/audio.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  // Generated from the audio.js manifest (params metadata is the source of truth).
2
- // Regenerate: node tools/dts.js in @audio/compile. Do not edit by hand.
2
+ // Regenerate: node tools/dts.js in @audio/plugin. Do not edit by hand.
3
3
 
4
4
  /** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
5
5
  type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
6
6
  /** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
7
7
  type Live = Record<string, Float32Array | string | boolean>
8
- type Ctx = { sampleRate: number, maxBlockSize: number, maxChannels: number, currentTime: number, duration?: number, events?: readonly any[], emit?: (name: string, ...args: any[]) => void, [k: string]: unknown }
8
+ type Transport = Readonly<{ playing: boolean, bpm: number, beat: number, barStart: number, timeSig: [number, number] }>
9
+ /** What a host hands a processor it builds: the contract's Context (CONTRACT.d.ts, 1.0) */
10
+ type Ctx = { readonly sampleRate: number, readonly maxBlockSize: number, readonly maxChannels: number, readonly layouts?: { readonly inputs: readonly (string | undefined)[], readonly outputs: readonly (string | undefined)[] }, readonly params: Live, readonly buffers: Readonly<Record<string, Float32Array[] | undefined>>, readonly events?: readonly { time: number, kind: 'on' | 'off', midi: number, velocity: number, id: number }[], emit(name: string, value: number): void, readonly transport: Transport }
9
11
  type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
10
12
 
11
13
  /** Chainable-host options for 'risset' */
@@ -24,8 +26,8 @@ export declare const risset: {
24
26
  streaming: false
25
27
  params: {
26
28
  /** 30..1000 Hz (default 100) */
27
- "freq": { type: "number", default: 100 }
29
+ "freq": { type: "number", min: 30, max: 1000, default: 100, unit: "Hz", curve: "log" }
28
30
  /** 0..1 (default 0.6) */
29
- "amp": { type: "number", default: 0.6 }
31
+ "amp": { type: "number", min: 0, max: 1, default: 0.6 }
30
32
  }
31
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@audio/synth-risset",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Risset drum — inharmonic partial set with exponential decay",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -13,11 +13,16 @@
13
13
  },
14
14
  "./package.json": "./package.json"
15
15
  },
16
+ "scripts": {
17
+ "prepublishOnly": "node ../../../compile/tools/tested.js"
18
+ },
16
19
  "files": [
17
20
  "risset.js",
21
+ "risset.d.ts",
18
22
  "audio.js",
19
23
  "audio.d.ts"
20
24
  ],
25
+ "types": "risset.d.ts",
21
26
  "keywords": [
22
27
  "audio",
23
28
  "dsp",
@@ -32,5 +37,11 @@
32
37
  "publishConfig": {
33
38
  "access": "public"
34
39
  },
35
- "audio": "./audio.js"
40
+ "audio": "./audio.js",
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/audiojs/synth.git",
44
+ "directory": "packages/synth-risset"
45
+ },
46
+ "funding": "https://github.com/sponsors/audiojs"
36
47
  }
package/risset.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /** Risset drum — inharmonic partials + octave-below sub-sine, simplified bell-drum catalogue. */
2
+ export interface RissetOptions {
3
+ /** sample rate, default 44100 */
4
+ fs?: number
5
+ /** seconds, default 1.2 */
6
+ duration?: number
7
+ /** peak amplitude (post-normalization), default 0.6 */
8
+ amp?: number
9
+ }
10
+
11
+ /** freq: Hz (positional) */
12
+ export default function risset(freq?: number, options?: RissetOptions): Float32Array