recorder-client 1.0.1 → 1.0.2
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 +22 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm i recorder-client
|
|
|
18
18
|
| :-------------: | :-----------------------: | :-------------------------------------------------------------------------: | :-------: |
|
|
19
19
|
| sampleRate | number | audio sampling rate | undefined |
|
|
20
20
|
| chunkSize | number | number of samples in the audio data block (length of the audio buffer zone) | undefined |
|
|
21
|
-
| ignoreMute | boolean |
|
|
21
|
+
| ignoreMute | boolean | ignore mute | undefined |
|
|
22
22
|
| ondataavailable | (pcm: Int16Array) => void | real-time audio data | undefined |
|
|
23
23
|
| onpause | () => void | pause event | undefined |
|
|
24
24
|
| onresume | () => void | resume event | undefined |
|
|
@@ -31,11 +31,12 @@ npm i recorder-client
|
|
|
31
31
|
|
|
32
32
|
### Helper
|
|
33
33
|
|
|
34
|
-
|
|
|
35
|
-
|
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
|
34
|
+
| property | type | description |
|
|
35
|
+
| :--------: | :----------------------------------------------: | :-----------------------------------: |
|
|
36
|
+
| pcmMerge | (pcms: 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
|
+
| isSpeaking | (pcm: Int16Array, sampleRate: number) => boolean | check if there is any input of audio |
|
|
39
40
|
|
|
40
41
|
### Example
|
|
41
42
|
|
|
@@ -117,3 +118,18 @@ const getWav = async (file: File) => {
|
|
|
117
118
|
const wav: Wav = Recorder.parseWav(buffer);
|
|
118
119
|
};
|
|
119
120
|
```
|
|
121
|
+
|
|
122
|
+
> isSpeaking
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { Recorder } from 'recorder-client';
|
|
126
|
+
|
|
127
|
+
const recorder = new Recorder({
|
|
128
|
+
sampleRate: 16000,
|
|
129
|
+
chunkSize: 1900,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
recorder.ondataavailable = (pcm) => {
|
|
133
|
+
const flag = Recorder.isSpeaking(pcm, 16000);
|
|
134
|
+
};
|
|
135
|
+
```
|