cnhis-design-vue 3.3.1-beta.54 → 3.3.1-beta.57
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/es/components/ai-chat/src/hooks/useChartAudioContext.js +1 -1
- package/es/components/audio-sdk/index.d.ts +37 -6
- package/es/components/audio-sdk/index.js +1 -0
- package/es/components/audio-sdk/src/Index.vue.d.ts +35 -6
- package/es/components/audio-sdk/src/Index.vue2.js +12 -4
- package/es/components/audio-sdk/src/audioSDK.d.ts +3 -4
- package/es/components/audio-sdk/src/audioSDK.js +12 -6
- package/es/components/audio-sdk/src/components/recording-modal.vue.d.ts +17 -3
- package/es/components/audio-sdk/src/components/recording.vue.d.ts +17 -3
- package/es/components/audio-sdk/src/components/recording.vue2.js +9 -6
- package/es/components/audio-sdk/src/utils/recorder/fft.js +75 -0
- package/es/components/audio-sdk/src/utils/recorder/index.d.ts +3 -0
- package/es/components/audio-sdk/src/utils/recorder/index.js +12 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3-engine.js +12435 -0
- package/es/components/audio-sdk/src/utils/recorder/mp3.js +343 -0
- package/es/components/audio-sdk/src/utils/recorder/recorder.js +1324 -0
- package/es/components/audio-sdk/src/utils/recorder/wave.js +258 -0
- package/es/components/index.js +1 -0
- package/es/shared/package.json.js +1 -1
- package/es/shared/utils/index.js +3 -2
- package/package.json +1 -2
@@ -0,0 +1,75 @@
|
|
1
|
+
function useFFT(Recorder) {
|
2
|
+
Recorder.LibFFT = function(bufferSize) {
|
3
|
+
var FFT_N_LOG, FFT_N, MINY;
|
4
|
+
var real, imag, sintable, costable;
|
5
|
+
var bitReverse;
|
6
|
+
var FFT_Fn = function(bufferSize2) {
|
7
|
+
FFT_N_LOG = Math.round(Math.log(bufferSize2) / Math.log(2));
|
8
|
+
FFT_N = 1 << FFT_N_LOG;
|
9
|
+
MINY = (FFT_N << 2) * Math.sqrt(2);
|
10
|
+
real = [];
|
11
|
+
imag = [];
|
12
|
+
sintable = [0];
|
13
|
+
costable = [0];
|
14
|
+
bitReverse = [];
|
15
|
+
var i, j, k, reve;
|
16
|
+
for (i = 0; i < FFT_N; i++) {
|
17
|
+
k = i;
|
18
|
+
for (j = 0, reve = 0; j != FFT_N_LOG; j++) {
|
19
|
+
reve <<= 1;
|
20
|
+
reve |= k & 1;
|
21
|
+
k >>>= 1;
|
22
|
+
}
|
23
|
+
bitReverse[i] = reve;
|
24
|
+
}
|
25
|
+
var theta, dt = 2 * Math.PI / FFT_N;
|
26
|
+
for (i = (FFT_N >> 1) - 1; i > 0; i--) {
|
27
|
+
theta = i * dt;
|
28
|
+
costable[i] = Math.cos(theta);
|
29
|
+
sintable[i] = Math.sin(theta);
|
30
|
+
}
|
31
|
+
};
|
32
|
+
var getModulus = function(inBuffer) {
|
33
|
+
var i, j, k, ir, j0 = 1, idx = FFT_N_LOG - 1;
|
34
|
+
var cosv, sinv, tmpr, tmpi;
|
35
|
+
for (i = 0; i != FFT_N; i++) {
|
36
|
+
real[i] = inBuffer[bitReverse[i]];
|
37
|
+
imag[i] = 0;
|
38
|
+
}
|
39
|
+
for (i = FFT_N_LOG; i != 0; i--) {
|
40
|
+
for (j = 0; j != j0; j++) {
|
41
|
+
cosv = costable[j << idx];
|
42
|
+
sinv = sintable[j << idx];
|
43
|
+
for (k = j; k < FFT_N; k += j0 << 1) {
|
44
|
+
ir = k + j0;
|
45
|
+
tmpr = cosv * real[ir] - sinv * imag[ir];
|
46
|
+
tmpi = cosv * imag[ir] + sinv * real[ir];
|
47
|
+
real[ir] = real[k] - tmpr;
|
48
|
+
imag[ir] = imag[k] - tmpi;
|
49
|
+
real[k] += tmpr;
|
50
|
+
imag[k] += tmpi;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
j0 <<= 1;
|
54
|
+
idx--;
|
55
|
+
}
|
56
|
+
j = FFT_N >> 1;
|
57
|
+
var outBuffer = new Float64Array(j);
|
58
|
+
sinv = MINY;
|
59
|
+
cosv = -MINY;
|
60
|
+
for (i = j; i != 0; i--) {
|
61
|
+
tmpr = real[i];
|
62
|
+
tmpi = imag[i];
|
63
|
+
if (tmpr > cosv && tmpr < sinv && tmpi > cosv && tmpi < sinv)
|
64
|
+
outBuffer[i - 1] = 0;
|
65
|
+
else
|
66
|
+
outBuffer[i - 1] = Math.round(tmpr * tmpr + tmpi * tmpi);
|
67
|
+
}
|
68
|
+
return outBuffer;
|
69
|
+
};
|
70
|
+
FFT_Fn(bufferSize);
|
71
|
+
return { transform: getModulus, bufferSize: FFT_N };
|
72
|
+
};
|
73
|
+
}
|
74
|
+
|
75
|
+
export { useFFT };
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { useFFT } from './fft.js';
|
2
|
+
import { useMP3 } from './mp3.js';
|
3
|
+
import { useMP3Engine } from './mp3-engine.js';
|
4
|
+
import { useWave } from './wave.js';
|
5
|
+
import Recorder from './recorder.js';
|
6
|
+
export { default } from './recorder.js';
|
7
|
+
|
8
|
+
function loadRecorderPlugins() {
|
9
|
+
return [useMP3(Recorder), useMP3Engine(Recorder), useFFT(Recorder), useWave(Recorder)];
|
10
|
+
}
|
11
|
+
|
12
|
+
export { loadRecorderPlugins };
|