@audio/synth-chirp 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/chirp.d.ts +19 -0
- package/package.json +10 -2
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @audio/synth-chirp [](https://www.npmjs.com/package/@audio/synth-chirp) [](https://github.com/krishnized/license)
|
|
2
|
+
|
|
3
|
+
Frequency sweep — exp/linear
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
npm install @audio/synth-chirp
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
import chirp from '@audio/synth-chirp'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Frequency sweep generator. Exponential (log) sweep is the ESS measurement signal (Farina 2000, used by [`@audio/measure-ir`](https://github.com/audiojs/measure-ir)); linear sweep is for response plots. Instantaneous frequency: linear `f(t) = f0 + (f1-f0)·t/T`, exponential `f(t) = f0·(f1/f0)^(t/T)`. Unpitched — single opts argument, edges fade to avoid clicks.
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
chirp({ f0: 20, f1: 20000, duration: 1, method: 'exp' }) // → Float32Array
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Param | Default | |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| `f0` | `20` | Start frequency, Hz |
|
|
22
|
+
| `f1` | `fs/2 · 0.95` | End frequency, Hz |
|
|
23
|
+
| `duration` | `1` | Seconds |
|
|
24
|
+
| `method` | `'exp'` | `'exp'` or `'lin'` |
|
|
25
|
+
| `amp` | `0.9` | Peak amplitude |
|
|
26
|
+
| `fade` | `0.005` | Edge fade, seconds (anti-click) |
|
|
27
|
+
| `fs` | `44100` | Sample rate |
|
|
28
|
+
|
|
29
|
+
**Use when:** measuring an impulse response (ESS deconvolution) or sweeping a filter/effect for a Bode-style plot.
|
|
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/chirp.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Frequency sweep generator — exponential (ESS) or linear. */
|
|
2
|
+
export interface ChirpOptions {
|
|
3
|
+
/** start frequency, Hz, default 20 */
|
|
4
|
+
f0?: number
|
|
5
|
+
/** end frequency, Hz, default fs/2 * 0.95 */
|
|
6
|
+
f1?: number
|
|
7
|
+
/** seconds, default 1 */
|
|
8
|
+
duration?: number
|
|
9
|
+
/** sample rate, default 44100 */
|
|
10
|
+
fs?: number
|
|
11
|
+
/** sweep shape, default 'exp' */
|
|
12
|
+
method?: 'exp' | 'lin'
|
|
13
|
+
/** peak amplitude, default 0.9 */
|
|
14
|
+
amp?: number
|
|
15
|
+
/** edge fade, seconds, default 0.005 */
|
|
16
|
+
fade?: number
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function chirp(options?: ChirpOptions): Float32Array
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/synth-chirp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Chirp — linear/exponential frequency sweep (ESS measurement signal, Farina 2000)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,9 +15,11 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"chirp.js",
|
|
18
|
+
"chirp.d.ts",
|
|
18
19
|
"audio.js",
|
|
19
20
|
"audio.d.ts"
|
|
20
21
|
],
|
|
22
|
+
"types": "chirp.d.ts",
|
|
21
23
|
"keywords": [
|
|
22
24
|
"audio",
|
|
23
25
|
"dsp",
|
|
@@ -34,5 +36,11 @@
|
|
|
34
36
|
"publishConfig": {
|
|
35
37
|
"access": "public"
|
|
36
38
|
},
|
|
37
|
-
"audio": "./audio.js"
|
|
39
|
+
"audio": "./audio.js",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "git+https://github.com/audiojs/synth.git",
|
|
43
|
+
"directory": "packages/synth-chirp"
|
|
44
|
+
},
|
|
45
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
38
46
|
}
|