@audio/synth-rhythm 1.1.2 → 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 +35 -0
- package/package.json +10 -2
- package/rhythm.d.ts +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @audio/synth-rhythm [](https://www.npmjs.com/package/@audio/synth-rhythm) [](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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-rhythm",
|
|
3
|
-
"version": "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,
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"rhythm.js",
|
|
18
|
+
"rhythm.d.ts",
|
|
18
19
|
"audio.js",
|
|
19
20
|
"audio.d.ts"
|
|
20
21
|
],
|
|
22
|
+
"types": "rhythm.d.ts",
|
|
21
23
|
"keywords": [
|
|
22
24
|
"audio",
|
|
23
25
|
"dsp",
|
|
@@ -32,5 +34,11 @@
|
|
|
32
34
|
"publishConfig": {
|
|
33
35
|
"access": "public"
|
|
34
36
|
},
|
|
35
|
-
"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"
|
|
36
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
|