@logue/reverb 0.5.0 → 0.5.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2021 Masashi Yoshikawa <https://logue.dev>
3
+ Copyright (c) 2019-2022 Masashi Yoshikawa <https://logue.dev>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,93 +1,74 @@
1
- # vue-codemirror6
1
+ # Reverb.js
2
2
 
3
- A component for using [CodeMirror6](https://codemirror.net/6/) with Vue. Unlike [surmon-china's vue-codemirror](https://github.com/surmon-china/vue-codemirror), it is for CodeMirror6.
3
+ [![jsdelivr CDN](https://data.jsdelivr.com/v1/package/npm/@logue/reverb/badge)](https://www.jsdelivr.com/package/npm/@logue/reverb)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/vuetify-swatches.svg?style=flat)](https://www.npmjs.com/package/@logue/reverb)
5
+ [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@logue/reverb/file/README.md)
6
+ [![npm version](https://img.shields.io/npm/v/@logue/reverb.svg)](https://www.npmjs.com/package/@logue/reverb)
7
+ [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/Reverb.js)
8
+
9
+ Append reverb effect to audio source.
10
+
11
+ This script is originally a spin out of [sf2synth.js](https://github.com/logue/smfplayer.js)'s reverb effect.
12
+
13
+ ## Sample
14
+
15
+ - <https://logue.dev/Reverb.js/>
16
+ - <https://logue.dev/Reverb.js/localaudio.html>
17
+
18
+ ## Syntax
19
+
20
+ ```js
21
+ const reverb = new Reverb(ctx, {
22
+ noise: 0, // Inpulse Response Noise algorithm (0: White noise, 1: Pink noise, 2: Brown noise)
23
+ decay: 5, // Amount of IR (Inpulse Response) decay. 0~100
24
+ delay: 0, // Delay time o IR. (NOT delay effect) 0~100 [sec]
25
+ filterFreq: 2200, // Filter frequency. 20~5000 [Hz]
26
+ filterQ: 1, // Filter quality. 0~10
27
+ filterType: 'lowpass', // Filter type. 'bandpass' etc. See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/type .
28
+ mix: 0.5, // Dry (Original Sound) and Wet (Effected sound) raito. 0~1
29
+ reverse: false, // Reverse IR.
30
+ time: 3, // Time length of IR. 0~50 [sec]
31
+ });
32
+ ```
4
33
 
5
34
  ## Usage
6
35
 
7
- When using as a Markdown editor on Vuetify.
8
-
9
- ```vue
10
- <template>
11
- <codemirror
12
- v-model="value"
13
- :lang="lang"
14
- :phrases="phreses"
15
- :extensions="extensions"
16
- :dark="$vuetify.theme.dark"
17
- />
18
- </template>
19
-
20
- <script lang="ts">
21
- import { Component, Vue } from 'vue-property-decorator';
22
-
23
- // Load component
24
- import CodeMirror from 'vue-codemirror6';
25
-
26
- // CodeMirror extensions
27
- import { basicSetup } from '@codemirror/basic-setup';
28
- import { LanguageSupport } from '@codemirror/language';
29
- import { markdown } from '@codemirror/lang-markdown';
30
-
31
- @Component({ components: { CodeMirror } })
32
- export default class Home extends Vue {
33
- /** text */
34
- value: string;
35
-
36
- /**
37
- * CodeMirror Language
38
- *
39
- * @see {@link https://codemirror.net/6/docs/ref/#language|@codemirror/language}
40
- */
41
- lang: LanguageSupport = markdown();
42
-
43
- /**
44
- * Internationalization Config
45
- *
46
- * @see {@link https://codemirror.net/6/examples/translate/|Example: Internationalization}
47
- */
48
- phrases: Record<string, string> = {
49
- // @codemirror/view
50
- 'Control character': '制御文字',
51
- // @codemirror/fold
52
- 'Folded lines': '折り畳まれた行',
53
- 'Unfolded lines': '折り畳める行',
54
- to: '行き先',
55
- 'folded code': '折り畳まれたコード',
56
- unfold: '折り畳む解除',
57
- 'Fold line': '行を折り畳む',
58
- 'Unfold line': '行の折り畳む解除',
59
- // @codemirror/search
60
- 'Go to line': '行き先の行',
61
- go: 'OK',
62
- Find: '検索',
63
- Replace: '置き換え',
64
- next: '▼',
65
- previous: '▲',
66
- all: 'すべて',
67
- 'match case': '一致条件',
68
- regexp: '正規表現',
69
- replace: '置き換え',
70
- 'replace all': 'すべてを置き換え',
71
- close: '閉じる',
72
- 'current match': '現在の一致',
73
- 'on line': 'した行',
74
- // @codemirror/lint
75
- Diagnostics: 'エラー',
76
- 'No diagnostics': 'エラーなし',
77
- }
78
-
79
- /**
80
- * CodeMirror Extensions
81
- *
82
- * @see {@link:https://codemirror.net/6/docs/ref/#state.Extension|Extending Editor State}
83
- */
84
- extensions: [
85
- /** @see {@link:https://codemirror.net/6/docs/ref/#basic-setup|basic-setup} */
86
- basicSetup
87
- ]
36
+ ```js
37
+ // Setup Audio Context
38
+ const ctx = new (window.AudioContext || window.webkitAudioContext)();
39
+
40
+ // iOS fix.
41
+ document.addEventListener('touchstart', initAudioContext);
42
+ function initAudioContext() {
43
+ document.removeEventListener('touchstart', initAudioContext);
44
+ // wake up AudioContext
45
+ const emptySource = ctx.createBufferSource();
46
+ emptySource.start();
47
+ emptySource.stop();
88
48
  }
49
+
50
+ // Setup Reverb Class
51
+ const reverb = new Reverb(ctx, {});
52
+
53
+ // put Audio data to audio buffer source
54
+ const sourceNode = ctx.createBufferSource();
55
+ sourceNode.buffer = [AudioBuffer];
56
+
57
+ // Connect Reverb
58
+ reverb.connect(sourceNode);
59
+ sourceNode.connect(ctx.destination);
60
+
61
+ // fire
62
+ sourceNode.play();
89
63
  ```
90
64
 
91
- ## LICENSE
65
+ ## Reference
66
+
67
+ - [Web Audio API](https://www.w3.org/TR/webaudio/)
68
+ - [Web Audio API 日本語訳](https://g200kg.github.io/web-audio-api-ja/)
69
+ - [コンボルバーの使い方](https://www.g200kg.com/jp/docs/webaudio/convolver.html)
70
+ - [WebAudio の闇](https://qiita.com/zprodev/items/7fcd8335d7e8e613a01f)
71
+
72
+ ## License
92
73
 
93
74
  [MIT](LICENSE)
package/dist/Meta.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type MetaInterface from './interfaces/MetaInterface';
2
+ declare const meta: MetaInterface;
3
+ export default meta;
4
+ //# sourceMappingURL=Meta.d.ts.map
File without changes
@@ -1,14 +1,14 @@
1
1
  /** Impulse response noise generation algorithm */
2
2
  declare const Noise: {
3
- /** White noise */
4
- readonly WHITE: 'white';
5
- /** Pink noise */
6
- readonly PINK: 'pink';
7
- /** Brown Noise */
8
- readonly BROWN: 'brown';
3
+ /** White noise */
4
+ readonly WHITE: "white";
5
+ /** Pink noise */
6
+ readonly PINK: "pink";
7
+ /** Brown Noise */
8
+ readonly BROWN: "brown";
9
9
  };
10
10
  /** Noise Type */
11
11
  export declare type NoiseType = typeof Noise[keyof typeof Noise];
12
12
  /** Noise */
13
13
  export default Noise;
14
- // # sourceMappingURL=NoiseType.d.ts.map
14
+ //# sourceMappingURL=NoiseType.d.ts.map
File without changes
@@ -0,0 +1,118 @@
1
+ import type OptionInterface from './interfaces/OptionInterface';
2
+ import { type NoiseType } from './NoiseType';
3
+ /**
4
+ * JS reverb effect class
5
+ *
6
+ * @license MIT
7
+ * @author Logue {@link logue@hotmail.co.jp}
8
+ * @copyright 2019-2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
9
+ * @see {@link https://github.com/logue/Reverb.js}
10
+ */
11
+ export default class Reverb {
12
+ /** Version strings */
13
+ readonly version: string;
14
+ /** Build date */
15
+ readonly build: string;
16
+ /** AudioContext */
17
+ private readonly ctx;
18
+ /** Wet Level (Reverberated node) */
19
+ private readonly wetGainNode;
20
+ /** Dry Level (Original sound node) */
21
+ private readonly dryGainNode;
22
+ /** Impulse response filter */
23
+ private readonly filterNode;
24
+ /** Convolution node for applying impulse response */
25
+ private readonly convolverNode;
26
+ /** Output nodse */
27
+ private readonly outputNode;
28
+ /** Option */
29
+ private readonly _options;
30
+ /** Connected flag */
31
+ private isConnected;
32
+ /**
33
+ * Constructor
34
+ *
35
+ * @param ctx - Root AudioContext
36
+ * @param options - Configure
37
+ */
38
+ constructor(ctx: AudioContext, options: OptionInterface | undefined);
39
+ /**
40
+ * Connect the node for the reverb effect to the original sound node.
41
+ *
42
+ * @param sourceNode - Input source node
43
+ */
44
+ connect(sourceNode: AudioNode): AudioNode;
45
+ /**
46
+ * Disconnect the reverb node
47
+ *
48
+ * @param sourceNode - Input source node
49
+ */
50
+ disconnect(sourceNode: AudioNode | undefined): AudioNode | undefined;
51
+ /**
52
+ * Dry/Wet ratio
53
+ *
54
+ * @param mix - Ratio (0~1)
55
+ */
56
+ mix(mix: number): void;
57
+ /**
58
+ * Set Impulse Response time length (second)
59
+ *
60
+ * @param value - IR length
61
+ */
62
+ time(value: number): void;
63
+ /**
64
+ * Impulse response decay rate.
65
+ *
66
+ * @param value - Decay value
67
+ */
68
+ decay(value: number): void;
69
+ /**
70
+ * Delay before reverberation starts
71
+ *
72
+ * @param value - Time[ms]
73
+ */
74
+ delay(value: number): void;
75
+ /**
76
+ * Reverse the impulse response.
77
+ *
78
+ * @param reverse - Reverse IR
79
+ */
80
+ reverse(reverse: boolean): void;
81
+ /**
82
+ * Filter for impulse response
83
+ *
84
+ * @param type - Filiter Type
85
+ */
86
+ filterType(type: BiquadFilterType): void;
87
+ /**
88
+ * Filter frequency applied to impulse response
89
+ *
90
+ * @param freq - Frequency
91
+ */
92
+ filterFreq(freq: number): void;
93
+ /**
94
+ * Filter quality.
95
+ *
96
+ * @param q - Quality
97
+ */
98
+ filterQ(q: number): void;
99
+ /**
100
+ * Inpulse Response Noise algorithm.
101
+ *
102
+ * @param type - IR noise algorithm type.
103
+ */
104
+ setNoise(type: NoiseType): void;
105
+ /**
106
+ * Return true if in range, otherwise false
107
+ *
108
+ * @param x - Target value
109
+ * @param min - Minimum value
110
+ * @param max - Maximum value
111
+ */
112
+ private inRange;
113
+ /** Utility function for building an impulse response from the module parameters. */
114
+ private buildImpulse;
115
+ /** Generate white noise */
116
+ private static whiteNoise;
117
+ }
118
+ //# sourceMappingURL=Reverb.d.ts.map
File without changes
@@ -0,0 +1,8 @@
1
+ /** Meta Information Interface */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build Date */
6
+ date: string;
7
+ }
8
+ //# sourceMappingURL=MetaInterface.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { NoiseType } from '../NoiseType';
2
+ /** Reverb Option */
3
+ export default interface OptionInterface {
4
+ /** Types of impulse response noise generation algorithms */
5
+ noise: NoiseType;
6
+ /** Decay */
7
+ decay: number;
8
+ /** Delay until impulse response is generated */
9
+ delay: number;
10
+ /** Filter frequency applied to impulse response[Hz] */
11
+ filterFreq: number;
12
+ /** Filter quality for impulse response */
13
+ filterQ: number;
14
+ /** Filter type for impulse response */
15
+ filterType: BiquadFilterType;
16
+ /** Dry/Wet ratio */
17
+ mix: number;
18
+ /** Invert the impulse response */
19
+ reverse: boolean;
20
+ /** Impulse response length */
21
+ time: number;
22
+ /** Prevents multiple effectors from being connected. */
23
+ once: boolean;
24
+ }
25
+ //# sourceMappingURL=OptionInterface.d.ts.map
package/dist/reverb.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const meta = {
2
- version: "0.5.0",
3
- date: "2022-02-21T09:25:39.234Z"
2
+ version: "0.5.3",
3
+ date: "2022-06-05T00:53:37.175Z"
4
4
  };
5
5
  const Noise = {
6
6
  WHITE: "white",
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Reverb=t()}(this,(function(){"use strict";const e="0.5.0",t="2022-02-21T09:25:39.234Z",i="white",s="pink",o="brown";
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Reverb=t()}(this,(function(){"use strict";const e="0.5.3",t="2022-06-05T00:53:37.175Z",i="white",s="pink",o="brown";
2
2
  /**
3
3
  * JS reverb effect class
4
4
  *
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@logue/reverb",
4
- "version": "0.5.0",
4
+ "version": "0.5.3",
5
5
  "description": "Reverb effect.",
6
6
  "files": [
7
- "dist",
8
- "types"
7
+ "dist"
9
8
  ],
10
9
  "main": "./dist/reverb.umd.js",
11
10
  "module": "./dist/reverb.es.js",
@@ -15,7 +14,7 @@
15
14
  "require": "./dist/reverb.umd.js"
16
15
  }
17
16
  },
18
- "types": "./types/Reverb.d.ts",
17
+ "types": "./dist/Reverb.d.ts",
19
18
  "directories": {
20
19
  "doc": "docs"
21
20
  },
@@ -39,38 +38,42 @@
39
38
  "url": "https://github.com/logue/Reverb.js/issues"
40
39
  },
41
40
  "engines": {
42
- "node": ">=16"
41
+ "node": ">=16.15.0",
42
+ "yarn": ">=1.22.4"
43
43
  },
44
+ "packageManager": "yarn@3.2.1",
44
45
  "license": "MIT",
45
46
  "sideEffects": false,
46
47
  "scripts": {
47
48
  "dev": "vite",
48
- "build": "tsc && vite build",
49
+ "build": "vite build && tsc --declaration --emitDeclarationOnly",
49
50
  "build:clean": "rimraf dist",
50
51
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
51
52
  "prepare": "husky install"
52
53
  },
53
54
  "devDependencies": {
54
- "@types/node": "^17.0.18",
55
- "@typescript-eslint/eslint-plugin": "^5.12.0",
56
- "@typescript-eslint/parser": "^5.12.0",
57
- "eslint": "^8.9.0",
55
+ "@microsoft/api-extractor": "^7.24.2",
56
+ "@types/eslint": "^8.4.2",
57
+ "@types/node": "^17.0.39",
58
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
59
+ "@typescript-eslint/parser": "^5.27.0",
60
+ "eslint": "^8.17.0",
58
61
  "eslint-config-google": "^0.14.0",
59
- "eslint-config-prettier": "^8.4.0",
62
+ "eslint-config-prettier": "^8.5.0",
60
63
  "eslint-import-resolver-alias": "^1.1.2",
61
- "eslint-import-resolver-typescript": "^2.5.0",
62
- "eslint-plugin-import": "^2.25.4",
64
+ "eslint-import-resolver-typescript": "^2.7.1",
65
+ "eslint-plugin-import": "^2.26.0",
66
+ "eslint-plugin-jsdoc": "^39.3.2",
63
67
  "eslint-plugin-prettier": "^4.0.0",
64
- "eslint-plugin-tsdoc": "^0.2.14",
65
- "husky": "^7.0.4",
66
- "lint-staged": "^12.3.4",
67
- "prettier": "^2.5.1",
68
- "prettier-plugin-jsdoc": "^0.3.30",
69
- "prettier-plugin-md-nocjsp": "^1.2.0",
68
+ "eslint-plugin-tsdoc": "^0.2.16",
69
+ "husky": "^8.0.1",
70
+ "lint-staged": "^13.0.0",
71
+ "optionator": "^0.9.1",
72
+ "prettier": "^2.6.2",
70
73
  "rimraf": "^3.0.2",
71
- "typescript": "^4.5.5",
72
- "vite": "^2.8.4",
73
- "vite-plugin-eslint": "^1.3.0"
74
+ "typescript": "^4.7.3",
75
+ "vite": "^2.9.9",
76
+ "vite-plugin-checker": "^0.4.6"
74
77
  },
75
78
  "husky": {
76
79
  "hooks": {
package/types/Meta.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type MetaInterface from '@/interfaces/MetaInterface';
2
- declare const meta: MetaInterface;
3
- export default meta;
4
- // # sourceMappingURL=Meta.d.ts.map
package/types/Reverb.d.ts DELETED
@@ -1,118 +0,0 @@
1
- import type OptionInterface from './interfaces/OptionInterface';
2
- import { type NoiseType } from './NoiseType';
3
- /**
4
- * JS reverb effect class
5
- *
6
- * @license MIT
7
- * @author Logue {@link logue@hotmail.co.jp}
8
- * @copyright 2019-2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
9
- * @see {@link https://github.com/logue/Reverb.js}
10
- */
11
- export default class Reverb {
12
- /** Version strings */
13
- readonly version: string;
14
- /** Build date */
15
- readonly build: string;
16
- /** AudioContext */
17
- private readonly ctx;
18
- /** Wet Level (Reverberated node) */
19
- private readonly wetGainNode;
20
- /** Dry Level (Original sound node) */
21
- private readonly dryGainNode;
22
- /** Impulse response filter */
23
- private readonly filterNode;
24
- /** Convolution node for applying impulse response */
25
- private readonly convolverNode;
26
- /** Output nodse */
27
- private readonly outputNode;
28
- /** Option */
29
- private readonly _options;
30
- /** Connected flag */
31
- private isConnected;
32
- /**
33
- * Constructor
34
- *
35
- * @param ctx - Root AudioContext
36
- * @param options - Configure
37
- */
38
- constructor(ctx: AudioContext, options: OptionInterface | undefined);
39
- /**
40
- * Connect the node for the reverb effect to the original sound node.
41
- *
42
- * @param sourceNode - Input source node
43
- */
44
- connect(sourceNode: AudioNode): AudioNode;
45
- /**
46
- * Disconnect the reverb node
47
- *
48
- * @param sourceNode - Input source node
49
- */
50
- disconnect(sourceNode: AudioNode | undefined): AudioNode | undefined;
51
- /**
52
- * Dry/Wet ratio
53
- *
54
- * @param mix - Ratio (0~1)
55
- */
56
- mix(mix: number): void;
57
- /**
58
- * Set Impulse Response time length (second)
59
- *
60
- * @param value - IR length
61
- */
62
- time(value: number): void;
63
- /**
64
- * Impulse response decay rate.
65
- *
66
- * @param value - Decay value
67
- */
68
- decay(value: number): void;
69
- /**
70
- * Delay before reverberation starts
71
- *
72
- * @param value - Time[ms]
73
- */
74
- delay(value: number): void;
75
- /**
76
- * Reverse the impulse response.
77
- *
78
- * @param reverse - Reverse IR
79
- */
80
- reverse(reverse: boolean): void;
81
- /**
82
- * Filter for impulse response
83
- *
84
- * @param type - Filiter Type
85
- */
86
- filterType(type: BiquadFilterType): void;
87
- /**
88
- * Filter frequency applied to impulse response
89
- *
90
- * @param freq - Frequency
91
- */
92
- filterFreq(freq: number): void;
93
- /**
94
- * Filter quality.
95
- *
96
- * @param q - Quality
97
- */
98
- filterQ(q: number): void;
99
- /**
100
- * Inpulse Response Noise algorithm.
101
- *
102
- * @param type - IR noise algorithm type.
103
- */
104
- setNoise(type: NoiseType): void;
105
- /**
106
- * Return true if in range, otherwise false
107
- *
108
- * @param x - Target value
109
- * @param min - Minimum value
110
- * @param max - Maximum value
111
- */
112
- private inRange;
113
- /** Utility function for building an impulse response from the module parameters. */
114
- private buildImpulse;
115
- /** Generate white noise */
116
- private static whiteNoise;
117
- }
118
- // # sourceMappingURL=Reverb.d.ts.map
@@ -1,8 +0,0 @@
1
- /** Meta Information Interface */
2
- export default interface MetaInterface {
3
- /** Version */
4
- version: string;
5
- /** Build Date */
6
- date: string;
7
- }
8
- // # sourceMappingURL=MetaInterface.d.ts.map
@@ -1,25 +0,0 @@
1
- import { NoiseType } from '../NoiseType';
2
- /** Reverb Option */
3
- export default interface OptionInterface {
4
- /** Types of impulse response noise generation algorithms */
5
- noise: NoiseType;
6
- /** Decay */
7
- decay: number;
8
- /** Delay until impulse response is generated */
9
- delay: number;
10
- /** Filter frequency applied to impulse response[Hz] */
11
- filterFreq: number;
12
- /** Filter quality for impulse response */
13
- filterQ: number;
14
- /** Filter type for impulse response */
15
- filterType: BiquadFilterType;
16
- /** Dry/Wet ratio */
17
- mix: number;
18
- /** Invert the impulse response */
19
- reverse: boolean;
20
- /** Impulse response length */
21
- time: number;
22
- /** Prevents multiple effectors from being connected. */
23
- once: boolean;
24
- }
25
- // # sourceMappingURL=OptionInterface.d.ts.map