@audio/synth-rhythm 1.1.1 → 1.1.3

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,35 @@
1
+ # @audio/synth-rhythm [![npm](https://img.shields.io/npm/v/@audio/synth-rhythm)](https://www.npmjs.com/package/@audio/synth-rhythm) [![MIT](https://img.shields.io/badge/MIT-%E0%A5%90-white)](https://github.com/krishnized/license)
2
+
3
+ Grid-timed pattern renderer (metronome/click track)
4
+
5
+ ```
6
+ npm install @audio/synth-rhythm
7
+ ```
8
+
9
+ ```js
10
+ import rhythm from '@audio/synth-rhythm'
11
+ ```
12
+
13
+ Metronome/click-track generator: decaying tone bursts on a BPM grid, downbeats accented with a higher frequency and full amplitude. Unpitched — single opts argument.
14
+
15
+ ```js
16
+ rhythm({ bpm: 120, bars: 4, beats: 4 }) // → Float32Array
17
+ ```
18
+
19
+ | Param | Default | |
20
+ |---|---|---|
21
+ | `bpm` | `120` | Beats per minute |
22
+ | `bars` | `4` | Number of bars |
23
+ | `beats` | `4` | Beats per bar |
24
+ | `freq` | `1000` | Regular-beat click frequency, Hz |
25
+ | `accentFreq` | `1500` | Downbeat click frequency, Hz |
26
+ | `amp` | `0.7` | Downbeat amplitude (regular beats: `amp * 0.7`) |
27
+ | `fs` | `44100` | Sample rate |
28
+
29
+ **Use when:** a click track / metronome reference for tempo-synced tests or arrangement scratch tracks.
30
+
31
+ ---
32
+
33
+ Part of [@audio/synth](https://github.com/audiojs/synth) — the synth family umbrella.
34
+
35
+ MIT © [audiojs](https://github.com/audiojs)
package/audio.d.ts ADDED
@@ -0,0 +1,43 @@
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.
3
+
4
+ /** Automatable number — scalar, `t => value` fn, or breakpoint curve {t, v} */
5
+ type Auto = number | ((t: number) => number) | { t: number[], v: number[] }
6
+ /** Per-block param values as delivered by hosts (numbers arrive as 1-length Float32Array) */
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 }
9
+ type Process = (inputs: Float32Array[][], outputs: Float32Array[][], params: Live) => void
10
+
11
+ /** Chainable-host options for 'rhythm' */
12
+ export interface RhythmOptions {
13
+ /** 20..300 (default 120) */
14
+ "bpm"?: Auto
15
+ /** 1..12 (default 4) */
16
+ "beats"?: Auto
17
+ /** 200..4000 Hz (default 1000) */
18
+ "freq"?: Auto
19
+ /** 200..6000 Hz (default 1500) */
20
+ "accentFreq"?: Auto
21
+ /** 0..1 (default 0.7) */
22
+ "amp"?: Auto
23
+ at?: number | string
24
+ duration?: number | string
25
+ }
26
+
27
+ export declare const rhythm: {
28
+ (ctx: Ctx): Process
29
+ channels: {"inputs":[],"outputs":"any"}
30
+ streaming: false
31
+ params: {
32
+ /** 20..300 (default 120) */
33
+ "bpm": { type: "number", default: 120 }
34
+ /** 1..12 (default 4) */
35
+ "beats": { type: "number", default: 4 }
36
+ /** 200..4000 Hz (default 1000) */
37
+ "freq": { type: "number", default: 1000 }
38
+ /** 200..6000 Hz (default 1500) */
39
+ "accentFreq": { type: "number", default: 1500 }
40
+ /** 0..1 (default 0.7) */
41
+ "amp": { type: "number", default: 0.7 }
42
+ }
43
+ }
package/package.json CHANGED
@@ -1,19 +1,25 @@
1
1
  {
2
2
  "name": "@audio/synth-rhythm",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Rhythm / click track — BPM grid with accented downbeats",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "rhythm.js",
8
8
  "exports": {
9
9
  ".": "./rhythm.js",
10
- "./audio": "./audio.js",
10
+ "./audio": {
11
+ "types": "./audio.d.ts",
12
+ "default": "./audio.js"
13
+ },
11
14
  "./package.json": "./package.json"
12
15
  },
13
16
  "files": [
14
17
  "rhythm.js",
15
- "audio.js"
18
+ "rhythm.d.ts",
19
+ "audio.js",
20
+ "audio.d.ts"
16
21
  ],
22
+ "types": "rhythm.d.ts",
17
23
  "keywords": [
18
24
  "audio",
19
25
  "dsp",
@@ -28,5 +34,11 @@
28
34
  "publishConfig": {
29
35
  "access": "public"
30
36
  },
31
- "audio": "./audio.js"
37
+ "audio": "./audio.js",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/audiojs/synth.git",
41
+ "directory": "packages/synth-rhythm"
42
+ },
43
+ "funding": "https://github.com/sponsors/audiojs"
32
44
  }
package/rhythm.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /** Metronome/click-track generator — decaying tone bursts on a BPM grid, accented downbeats. */
2
+ export interface RhythmOptions {
3
+ /** beats per minute, default 120 */
4
+ bpm?: number
5
+ /** number of bars, default 4 */
6
+ bars?: number
7
+ /** beats per bar, default 4 */
8
+ beats?: number
9
+ /** sample rate, default 44100 */
10
+ fs?: number
11
+ /** regular-beat click frequency, Hz, default 1000 */
12
+ freq?: number
13
+ /** downbeat click frequency, Hz, default 1500 */
14
+ accentFreq?: number
15
+ /** downbeat amplitude (regular beats: amp*0.7), default 0.7 */
16
+ amp?: number
17
+ }
18
+
19
+ export default function rhythm(options?: RhythmOptions): Float32Array