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.
Files changed (2) hide show
  1. package/README.md +22 -6
  2. 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 | ignore mute or not | undefined |
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
- | 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 |
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
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "recorder-client",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "audio recording client",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",