recorder-client 1.0.2 → 1.0.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 +28 -23
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,29 +14,34 @@ npm i recorder-client
|
|
|
14
14
|
|
|
15
15
|
### API
|
|
16
16
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
|
|
|
17
|
+
| property | type | description | default |
|
|
18
|
+
| :--------: | :-----: | :-------------------------------------------------------------------------: | :-------: |
|
|
19
|
+
| sampleRate | number | audio sampling rate | undefined |
|
|
20
|
+
| chunkSize | number | number of samples in the audio data block (length of the audio buffer zone) | undefined |
|
|
21
|
+
| ignoreMute | boolean | ignore mute | undefined |
|
|
22
|
+
|
|
23
|
+
### Event
|
|
24
|
+
|
|
25
|
+
| property | type | description |
|
|
26
|
+
| :-------------: | :-----------------------: | :------------------: |
|
|
27
|
+
| ondataavailable | (pcm: Int16Array) => void | real-time audio data |
|
|
28
|
+
| onpause | () => void | pause event |
|
|
29
|
+
| onresume | () => void | resume event |
|
|
30
|
+
| onstart | () => void | start event |
|
|
31
|
+
| onstop | (pcm: Int16Array) => void | stop event |
|
|
32
|
+
| pause | () => void | audio pause |
|
|
33
|
+
| resume | () => void | audio resume |
|
|
34
|
+
| start | () => void | audio start |
|
|
35
|
+
| stop | () => void | audio stop |
|
|
31
36
|
|
|
32
37
|
### Helper
|
|
33
38
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
39
|
-
|
|
|
39
|
+
| property | type | description |
|
|
40
|
+
| :------: | :----------------------------------------------: | :-----------------------------------: |
|
|
41
|
+
| pcmMerge | (pcms: Int16Array[]) => Int16Array | merge multiple pcm streams |
|
|
42
|
+
| pcmToWav | (pcm: Int16Array, sampleRate: number) => Blob | convert PCM to WAV |
|
|
43
|
+
| parseWav | (buffer: ArrayBuffer) => object | obtain information about the wav file |
|
|
44
|
+
| isSpeak | (pcm: Int16Array, sampleRate: number) => boolean | check if there is any input of audio |
|
|
40
45
|
|
|
41
46
|
### Example
|
|
42
47
|
|
|
@@ -81,7 +86,7 @@ recorder.ondataavailable = (pcm) => {
|
|
|
81
86
|
};
|
|
82
87
|
|
|
83
88
|
const onMerge = () => {
|
|
84
|
-
|
|
89
|
+
const data = Recorder.pcmMerge(pcms);
|
|
85
90
|
};
|
|
86
91
|
```
|
|
87
92
|
|
|
@@ -119,7 +124,7 @@ const getWav = async (file: File) => {
|
|
|
119
124
|
};
|
|
120
125
|
```
|
|
121
126
|
|
|
122
|
-
>
|
|
127
|
+
> isSpeak
|
|
123
128
|
|
|
124
129
|
```ts
|
|
125
130
|
import { Recorder } from 'recorder-client';
|
|
@@ -130,6 +135,6 @@ const recorder = new Recorder({
|
|
|
130
135
|
});
|
|
131
136
|
|
|
132
137
|
recorder.ondataavailable = (pcm) => {
|
|
133
|
-
const flag = Recorder.
|
|
138
|
+
const flag = Recorder.isSpeak(pcm, 16000);
|
|
134
139
|
};
|
|
135
140
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "recorder-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "audio recording client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@rollup/plugin-typescript": "^12.1.4",
|
|
32
32
|
"@types/node": "^24.3.0",
|
|
33
33
|
"happy-dom": "^18.0.1",
|
|
34
|
-
"rollup": "^4.
|
|
34
|
+
"rollup": "^4.48.0",
|
|
35
35
|
"rollup-plugin-dts": "^6.2.3",
|
|
36
36
|
"tslib": "^2.8.1",
|
|
37
|
-
"typescript": "^5.
|
|
38
|
-
"typescript-eslint-standard": "^9.
|
|
37
|
+
"typescript": "^5.9.2",
|
|
38
|
+
"typescript-eslint-standard": "^9.60.0",
|
|
39
39
|
"vitest": "^3.2.4"
|
|
40
40
|
},
|
|
41
41
|
"author": "mivui",
|