@edkimmel/expo-audio-stream 0.3.2-beta.1 → 0.3.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.
|
@@ -37,6 +37,7 @@ class AudioRecorderManager(
|
|
|
37
37
|
// Flag to control whether actual audio data or silence is sent
|
|
38
38
|
private var isSilent = false
|
|
39
39
|
private var frequencyBandAnalyzer: FrequencyBandAnalyzer? = null
|
|
40
|
+
private val gainNormalizer = GainNormalizer()
|
|
40
41
|
|
|
41
42
|
private lateinit var recordingConfig: RecordingConfig
|
|
42
43
|
private var mimeType = "audio/wav"
|
|
@@ -69,7 +69,11 @@ class GainNormalizer(
|
|
|
69
69
|
|
|
70
70
|
if (currentGain < 1.01f) return data // unity, skip work
|
|
71
71
|
|
|
72
|
-
// --- apply gain ---
|
|
72
|
+
// --- apply gain only to non-silent chunks ---
|
|
73
|
+
// If this chunk is silence, don't amplify it — keeps the noise floor
|
|
74
|
+
// untouched so server-side VAD sees a clean gap between speech and quiet.
|
|
75
|
+
if (rmsDbfs <= silenceThresholdDbfs) return data
|
|
76
|
+
|
|
73
77
|
for (i in 0 until sampleCount) {
|
|
74
78
|
val offset = i * 2
|
|
75
79
|
val sample = buf.getShort(offset).toInt()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edkimmel/expo-audio-stream",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Expo Play Audio Stream module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public",
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
|
-
}
|
|
49
|
-
"stableVersion": "0.3.1"
|
|
48
|
+
}
|
|
50
49
|
}
|