recorder-client 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +40 -19
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -14,28 +14,34 @@ npm i recorder-client
14
14
 
15
15
  ### API
16
16
 
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 or not | undefined |
22
- | ondataavailable | (pcm: Int16Array) => void | real-time audio data | undefined |
23
- | onpause | () => void | pause event | undefined |
24
- | onresume | () => void | resume event | undefined |
25
- | onstart | () => void | start event | undefined |
26
- | onstop | (wav: Blob) => void | stop event | undefined |
27
- | pause | () => void | audio pause | undefined |
28
- | resume | () => void | audio resume | undefined |
29
- | start | () => void | audio start | undefined |
30
- | stop | () => void | audio stop | undefined |
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 | (wav: Blob) => 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
- | property | type | description |
35
- | :------: | :----------------------------------------------: | :-----------------------------------: |
36
- | pcmMerge | (arrays: Int16Array[])=> Int16Array<ArrayBuffer> | merge multiple pcm streams |
37
- | pcmToWav | (pcm: Int16Array, sampleRate: number)=> Blob | convert PCM to WAV |
38
- | parseWav | (buffer: ArrayBuffer)=> object | obtain information about the wav file |
39
+ | property | type | description |
40
+ | :--------: | :----------------------------------------------: | :-----------------------------------: |
41
+ | pcmMerge | (pcms: Int16Array[]) => Int16Array<ArrayBuffer> | 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
+ | isSpeaking | (pcm: Int16Array, sampleRate: number) => boolean | check if there is any input of audio |
39
45
 
40
46
  ### Example
41
47
 
@@ -117,3 +123,18 @@ const getWav = async (file: File) => {
117
123
  const wav: Wav = Recorder.parseWav(buffer);
118
124
  };
119
125
  ```
126
+
127
+ > isSpeaking
128
+
129
+ ```ts
130
+ import { Recorder } from 'recorder-client';
131
+
132
+ const recorder = new Recorder({
133
+ sampleRate: 16000,
134
+ chunkSize: 1900,
135
+ });
136
+
137
+ recorder.ondataavailable = (pcm) => {
138
+ const flag = Recorder.isSpeaking(pcm, 16000);
139
+ };
140
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recorder-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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.47.1",
34
+ "rollup": "^4.48.0",
35
35
  "rollup-plugin-dts": "^6.2.3",
36
36
  "tslib": "^2.8.1",
37
- "typescript": "^5.8.3",
38
- "typescript-eslint-standard": "^9.59.0",
37
+ "typescript": "^5.9.2",
38
+ "typescript-eslint-standard": "^9.60.0",
39
39
  "vitest": "^3.2.4"
40
40
  },
41
41
  "author": "mivui",