@siteed/expo-audio-stream 1.3.0 → 1.4.0
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/CHANGELOG.md +20 -0
- package/android/build/.transforms/0588d516016bbd2e5b51abc80cc3d78d/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.s +1 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
- package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
- package/android/build.gradle +13 -5
- package/build/AudioAnalysis/extractAudioAnalysis.d.ts +3 -1
- package/build/AudioAnalysis/extractAudioAnalysis.d.ts.map +1 -1
- package/build/AudioAnalysis/extractAudioAnalysis.js +9 -11
- package/build/AudioAnalysis/extractAudioAnalysis.js.map +1 -1
- package/build/AudioAnalysis/extractWaveform.d.ts.map +1 -1
- package/build/AudioAnalysis/extractWaveform.js +0 -3
- package/build/AudioAnalysis/extractWaveform.js.map +1 -1
- package/build/ExpoAudioStream.types.d.ts +6 -0
- package/build/ExpoAudioStream.types.d.ts.map +1 -1
- package/build/ExpoAudioStream.types.js.map +1 -1
- package/build/ExpoAudioStream.web.d.ts +4 -2
- package/build/ExpoAudioStream.web.d.ts.map +1 -1
- package/build/ExpoAudioStream.web.js +6 -6
- package/build/ExpoAudioStream.web.js.map +1 -1
- package/build/WebRecorder.web.d.ts +4 -2
- package/build/WebRecorder.web.d.ts.map +1 -1
- package/build/WebRecorder.web.js +14 -13
- package/build/WebRecorder.web.js.map +1 -1
- package/build/events.d.ts.map +1 -1
- package/build/events.js +0 -4
- package/build/events.js.map +1 -1
- package/build/useAudioRecorder.d.ts +3 -3
- package/build/useAudioRecorder.d.ts.map +1 -1
- package/build/useAudioRecorder.js +26 -28
- package/build/useAudioRecorder.js.map +1 -1
- package/build/utils/convertPCMToFloat32.d.ts +3 -1
- package/build/utils/convertPCMToFloat32.d.ts.map +1 -1
- package/build/utils/convertPCMToFloat32.js +3 -5
- package/build/utils/convertPCMToFloat32.js.map +1 -1
- package/package.json +1 -3
- package/plugin/src/index.ts +5 -4
- package/src/AudioAnalysis/extractAudioAnalysis.ts +13 -13
- package/src/AudioAnalysis/extractWaveform.ts +0 -3
- package/src/ExpoAudioStream.types.ts +7 -0
- package/src/ExpoAudioStream.web.ts +8 -6
- package/src/WebRecorder.web.ts +15 -14
- package/src/events.ts +0 -4
- package/src/useAudioRecorder.tsx +32 -36
- package/src/utils/convertPCMToFloat32.ts +5 -5
- package/build/logger.d.ts +0 -9
- package/build/logger.d.ts.map +0 -1
- package/build/logger.js +0 -13
- package/build/logger.js.map +0 -1
- package/src/logger.ts +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
## [1.4.0] - 2024-12-05
|
|
12
|
+
- chore: remove unusded dependencies ([ad81dd5](https://github.com/deeeed/expo-audio-stream/commit/ad81dd560c93dd1d04995a323a4ae72d4de20f3e))
|
|
13
|
+
|
|
14
|
+
## [1.3.1] - 2024-12-05
|
|
15
|
+
- feat(web): implement throttling and optimize event processing (#49) ([da28765](https://github.com/deeeed/expo-audio-stream/commit/da2876524c2c9d6e0a980fde40a0197b929d8a7f))
|
|
16
|
+
|
|
17
|
+
|
|
11
18
|
## [1.3.0] - 2024-11-28
|
|
12
19
|
### Added
|
|
13
20
|
- refactor(permissions): standardize permission status response structure across platforms (#44) ([7c9c800](https://github.com/deeeed/expo-audio-stream/commit/7c9c800d83b7cea3516643371484d5e1f3b99e4c))
|
|
@@ -16,11 +23,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
23
|
- feat: latest expo fixes ([9cc5ac3](https://github.com/deeeed/expo-audio-stream/commit/9cc5ac39751999e5b33e11c16355557143d68d10))
|
|
17
24
|
- feat: latest expo sdk ([258ef6c](https://github.com/deeeed/expo-audio-stream/commit/258ef6cf68e70c7855f696a01204f79b0793fdc0))
|
|
18
25
|
|
|
26
|
+
|
|
27
|
+
|
|
19
28
|
## [1.2.5] - 2024-11-12
|
|
20
29
|
### Added
|
|
21
30
|
- docs(license): add MIT license to all packages (6 files changed)
|
|
22
31
|
- fix(expo-audio-stream): return actual recording settings from startRecording on iOS #37
|
|
23
32
|
|
|
33
|
+
|
|
34
|
+
|
|
24
35
|
## [1.2.4] - 2024-11-05
|
|
25
36
|
### Changed
|
|
26
37
|
- Android minimum audio interval set to 10ms.
|
|
@@ -29,6 +40,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
40
|
### Fixed
|
|
30
41
|
- Remove frequently firing log statements on web.
|
|
31
42
|
|
|
43
|
+
|
|
44
|
+
|
|
32
45
|
## [1.2.0] - 2024-10-24
|
|
33
46
|
### Added
|
|
34
47
|
- Feature: Keep device awake during recording with `keepAwake` option
|
|
@@ -37,11 +50,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
37
50
|
- Android: Configurable notification actions, colors, and priorities
|
|
38
51
|
- iOS: Integration with media player
|
|
39
52
|
|
|
53
|
+
|
|
54
|
+
|
|
40
55
|
## [1.1.17] - 2024-10-21
|
|
41
56
|
### Added
|
|
42
57
|
- Support bluetooth headset on ios
|
|
43
58
|
- Fixes: android not reading custom interval audio update
|
|
44
59
|
|
|
60
|
+
|
|
61
|
+
|
|
45
62
|
## [1.0.0] - 2024-04-01
|
|
46
63
|
|
|
47
64
|
### Added
|
|
@@ -53,5 +70,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
53
70
|
- Feature: Audio features extraction during recording.
|
|
54
71
|
- Feature: Consistent WAV PCM recording format across all platforms.
|
|
55
72
|
|
|
73
|
+
[unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.4.0...HEAD
|
|
74
|
+
[1.4.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.3.1...@siteed/expo-audio-stream@1.4.0
|
|
75
|
+
[1.3.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.3.0...@siteed/expo-audio-stream@1.3.1
|
|
56
76
|
[Unreleased]: https://github.com/deeeed/expo-audio-stream/compare/v1.0.0...HEAD
|
|
57
77
|
[1.0.0]: https://github.com/deeeed/expo-audio-stream/releases/tag/v1.0.0
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
23
|
|
2
2
|
0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values
ADDED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
CHANGED
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.s
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
�Q�a�c�f
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin
CHANGED
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -51,17 +51,19 @@ afterEvaluate {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
android {
|
|
54
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
54
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
55
55
|
|
|
56
56
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
57
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
58
58
|
compileOptions {
|
|
59
|
-
sourceCompatibility JavaVersion.
|
|
60
|
-
targetCompatibility JavaVersion.
|
|
59
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
60
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
64
|
+
kotlinOptions {
|
|
65
|
+
jvmTarget = '17'
|
|
66
|
+
}
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
|
|
@@ -95,3 +97,9 @@ dependencies {
|
|
|
95
97
|
testImplementation 'org.jetbrains.kotlin:kotlin-test:1.8.10'
|
|
96
98
|
testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.8.10'
|
|
97
99
|
}
|
|
100
|
+
|
|
101
|
+
kotlin {
|
|
102
|
+
jvmToolchain {
|
|
103
|
+
languageVersion.set(JavaLanguageVersion.of(17))
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ConsoleLike } from '../ExpoAudioStream.types';
|
|
1
2
|
import { AmplitudeAlgorithm, AudioAnalysis, AudioFeaturesOptions } from './AudioAnalysis.types';
|
|
2
3
|
import { WavFileInfo } from '../utils/getWavFileInfo';
|
|
3
4
|
export interface ExtractAudioAnalysisProps {
|
|
@@ -15,6 +16,7 @@ export interface ExtractAudioAnalysisProps {
|
|
|
15
16
|
pointsPerSecond?: number;
|
|
16
17
|
features?: AudioFeaturesOptions;
|
|
17
18
|
featuresExtratorUrl?: string;
|
|
19
|
+
logger?: ConsoleLike;
|
|
18
20
|
}
|
|
19
|
-
export declare const extractAudioAnalysis: ({ fileUri, pointsPerSecond, arrayBuffer, bitDepth, skipWavHeader, durationMs, sampleRate, numberOfChannels, algorithm, features, featuresExtratorUrl, }: ExtractAudioAnalysisProps) => Promise<AudioAnalysis>;
|
|
21
|
+
export declare const extractAudioAnalysis: ({ fileUri, pointsPerSecond, arrayBuffer, bitDepth, skipWavHeader, durationMs, sampleRate, numberOfChannels, algorithm, features, featuresExtratorUrl, logger, }: ExtractAudioAnalysisProps) => Promise<AudioAnalysis>;
|
|
20
22
|
//# sourceMappingURL=extractAudioAnalysis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractAudioAnalysis.d.ts","sourceRoot":"","sources":["../../src/AudioAnalysis/extractAudioAnalysis.ts"],"names":[],"mappings":"AACA,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACvB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"extractAudioAnalysis.d.ts","sourceRoot":"","sources":["../../src/AudioAnalysis/extractAudioAnalysis.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACvB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAkB,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGrE,MAAM,WAAW,yBAAyB;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,oBAAoB,CAAA;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,MAAM,CAAC,EAAE,WAAW,CAAA;CACvB;AAED,eAAO,MAAM,oBAAoB,oKAa9B,yBAAyB,KAAG,OAAO,CAAC,aAAa,CAsGnD,CAAA"}
|
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
import ExpoAudioStreamModule from '../ExpoAudioStreamModule';
|
|
2
2
|
import { isWeb } from '../constants';
|
|
3
|
-
import { getLogger } from '../logger';
|
|
4
3
|
import { convertPCMToFloat32 } from '../utils/convertPCMToFloat32';
|
|
5
4
|
import { getWavFileInfo } from '../utils/getWavFileInfo';
|
|
6
5
|
import { InlineFeaturesExtractor } from '../workers/InlineFeaturesExtractor.web';
|
|
7
|
-
const
|
|
8
|
-
export const extractAudioAnalysis = async ({ fileUri, pointsPerSecond = 20, arrayBuffer, bitDepth, skipWavHeader = true, durationMs, sampleRate, numberOfChannels, algorithm = 'rms', features, featuresExtratorUrl, }) => {
|
|
6
|
+
export const extractAudioAnalysis = async ({ fileUri, pointsPerSecond = 20, arrayBuffer, bitDepth, skipWavHeader = true, durationMs, sampleRate, numberOfChannels, algorithm = 'rms', features, featuresExtratorUrl, logger, }) => {
|
|
9
7
|
if (isWeb) {
|
|
10
8
|
if (!arrayBuffer && !fileUri) {
|
|
11
9
|
throw new Error('Either arrayBuffer or fileUri must be provided');
|
|
12
10
|
}
|
|
13
11
|
if (!arrayBuffer) {
|
|
14
|
-
logger
|
|
12
|
+
logger?.log(`fetching fileUri`, fileUri);
|
|
15
13
|
const response = await fetch(fileUri);
|
|
16
14
|
if (!response.ok) {
|
|
17
15
|
throw new Error(`Failed to fetch fileUri: ${response.statusText}`);
|
|
18
16
|
}
|
|
19
17
|
arrayBuffer = await response.arrayBuffer();
|
|
20
|
-
logger
|
|
18
|
+
logger?.log(`fetched fileUri`, arrayBuffer.byteLength, arrayBuffer);
|
|
21
19
|
}
|
|
22
20
|
// Create a new copy of the ArrayBuffer to avoid detachment issues
|
|
23
21
|
const bufferCopy = arrayBuffer.slice(0);
|
|
24
|
-
logger
|
|
22
|
+
logger?.log(`extractAudioAnalysis skipWavHeader=${skipWavHeader} bitDepth=${bitDepth} len=${bufferCopy.byteLength}`, bufferCopy.slice(0, 100));
|
|
25
23
|
let actualBitDepth = bitDepth;
|
|
26
24
|
if (!actualBitDepth) {
|
|
27
|
-
logger
|
|
25
|
+
logger?.log(`extractAudioAnalysis bitDepth not provided -- getting wav file info`);
|
|
28
26
|
const fileInfo = await getWavFileInfo(bufferCopy);
|
|
29
27
|
actualBitDepth = fileInfo.bitDepth;
|
|
30
28
|
}
|
|
31
|
-
logger
|
|
29
|
+
logger?.log(`extractAudioAnalysis actualBitDepth=${actualBitDepth}`);
|
|
32
30
|
const { pcmValues: channelData, min, max, } = await convertPCMToFloat32({
|
|
33
31
|
buffer: arrayBuffer,
|
|
34
32
|
bitDepth: actualBitDepth,
|
|
35
33
|
skipWavHeader,
|
|
36
34
|
});
|
|
37
|
-
logger
|
|
35
|
+
logger?.log(`extractAudioAnalysis skipWaveHeader=${skipWavHeader} convertPCMToFloat32 length=${channelData.length} range: [ ${min} :: ${max} ]`);
|
|
38
36
|
return new Promise((resolve, reject) => {
|
|
39
37
|
let worker;
|
|
40
38
|
if (featuresExtratorUrl) {
|
|
@@ -69,7 +67,7 @@ export const extractAudioAnalysis = async ({ fileUri, pointsPerSecond = 20, arra
|
|
|
69
67
|
if (!fileUri) {
|
|
70
68
|
throw new Error('fileUri is required');
|
|
71
69
|
}
|
|
72
|
-
logger
|
|
70
|
+
logger?.log(`extractAudioAnalysis`, {
|
|
73
71
|
fileUri,
|
|
74
72
|
pointsPerSecond,
|
|
75
73
|
algorithm,
|
|
@@ -81,7 +79,7 @@ export const extractAudioAnalysis = async ({ fileUri, pointsPerSecond = 20, arra
|
|
|
81
79
|
algorithm,
|
|
82
80
|
features,
|
|
83
81
|
});
|
|
84
|
-
logger
|
|
82
|
+
logger?.log(`extractAudioAnalysis`, res);
|
|
85
83
|
return res;
|
|
86
84
|
}
|
|
87
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractAudioAnalysis.js","sourceRoot":"","sources":["../../src/AudioAnalysis/extractAudioAnalysis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractAudioAnalysis.js","sourceRoot":"","sources":["../../src/AudioAnalysis/extractAudioAnalysis.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAMpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,E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,MAAM,CAAC,KAAK,CAAC,CAAA;YACjB,CAAC,CAAA;YAED,MAAM,CAAC,WAAW,CAAC;gBACf,OAAO,EAAE,SAAS;gBAClB,WAAW;gBACX,UAAU;gBACV,eAAe;gBACf,SAAS;gBACT,QAAQ;gBACR,mBAAmB,EAAE,UAAU;gBAC/B,gBAAgB;aACnB,CAAC,CAAA;QACN,CAAC,CAAC,CAAA;IACN,CAAC;SAAM,CAAC;QACJ,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAC1C,CAAC;QACD,MAAM,EAAE,GAAG,CAAC,sBAAsB,EAAE;YAChC,OAAO;YACP,eAAe;YACf,SAAS;SACZ,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,oBAAoB,CAAC;YACzD,OAAO;YACP,eAAe;YACf,aAAa;YACb,SAAS;YACT,QAAQ;SACX,CAAC,CAAA;QACF,MAAM,EAAE,GAAG,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAA;QACxC,OAAO,GAAG,CAAA;IACd,CAAC;AACL,CAAC,CAAA","sourcesContent":["// packages/expo-audio-stream/src/AudioAnalysis/extractAudioAnalysis.ts\nimport { ConsoleLike } from '../ExpoAudioStream.types'\nimport ExpoAudioStreamModule from '../ExpoAudioStreamModule'\nimport { isWeb } from '../constants'\nimport {\n AmplitudeAlgorithm,\n AudioAnalysis,\n AudioFeaturesOptions,\n} from './AudioAnalysis.types'\nimport { convertPCMToFloat32 } from '../utils/convertPCMToFloat32'\nimport { getWavFileInfo, WavFileInfo } from '../utils/getWavFileInfo'\nimport { InlineFeaturesExtractor } from '../workers/InlineFeaturesExtractor.web'\n\nexport interface ExtractAudioAnalysisProps {\n fileUri?: string // should provide either fileUri or arrayBuffer\n wavMetadata?: WavFileInfo\n arrayBuffer?: ArrayBuffer\n bitDepth?: number\n skipWavHeader?: boolean\n durationMs?: number\n sampleRate?: number\n numberOfChannels?: number\n algorithm?: AmplitudeAlgorithm\n position?: number // Optional number of bytes to skip. Default is 0\n length?: number // Optional number of bytes to read.\n pointsPerSecond?: number // Optional number of points per second. Use to reduce the number of points and compute the number of datapoints to return.\n features?: AudioFeaturesOptions\n featuresExtratorUrl?: string\n logger?: ConsoleLike\n}\n\nexport const extractAudioAnalysis = async ({\n fileUri,\n pointsPerSecond = 20,\n arrayBuffer,\n bitDepth,\n skipWavHeader = true,\n durationMs,\n sampleRate,\n numberOfChannels,\n algorithm = 'rms',\n features,\n featuresExtratorUrl,\n logger,\n}: ExtractAudioAnalysisProps): Promise<AudioAnalysis> => {\n if (isWeb) {\n if (!arrayBuffer && !fileUri) {\n throw new Error('Either arrayBuffer or fileUri must be provided')\n }\n\n if (!arrayBuffer) {\n logger?.log(`fetching fileUri`, fileUri)\n const response = await fetch(fileUri!)\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch fileUri: ${response.statusText}`\n )\n }\n\n arrayBuffer = await response.arrayBuffer()\n logger?.log(`fetched fileUri`, arrayBuffer.byteLength, arrayBuffer)\n }\n\n // Create a new copy of the ArrayBuffer to avoid detachment issues\n const bufferCopy = arrayBuffer.slice(0)\n logger?.log(\n `extractAudioAnalysis skipWavHeader=${skipWavHeader} bitDepth=${bitDepth} len=${bufferCopy.byteLength}`,\n bufferCopy.slice(0, 100)\n )\n\n let actualBitDepth = bitDepth\n if (!actualBitDepth) {\n logger?.log(\n `extractAudioAnalysis bitDepth not provided -- getting wav file info`\n )\n const fileInfo = await getWavFileInfo(bufferCopy)\n actualBitDepth = fileInfo.bitDepth\n }\n logger?.log(`extractAudioAnalysis actualBitDepth=${actualBitDepth}`)\n\n const {\n pcmValues: channelData,\n min,\n max,\n } = await convertPCMToFloat32({\n buffer: arrayBuffer,\n bitDepth: actualBitDepth,\n skipWavHeader,\n })\n logger?.log(\n `extractAudioAnalysis skipWaveHeader=${skipWavHeader} convertPCMToFloat32 length=${channelData.length} range: [ ${min} :: ${max} ]`\n )\n\n return new Promise((resolve, reject) => {\n let worker: Worker\n if (featuresExtratorUrl) {\n worker = new Worker(\n new URL(featuresExtratorUrl, window.location.href)\n )\n } else {\n const blob = new Blob([InlineFeaturesExtractor], {\n type: 'application/javascript',\n })\n const url = URL.createObjectURL(blob)\n worker = new Worker(url)\n }\n\n worker.onmessage = (event) => {\n resolve(event.data.result)\n }\n\n worker.onerror = (error) => {\n reject(error)\n }\n\n worker.postMessage({\n command: 'process',\n channelData,\n sampleRate,\n pointsPerSecond,\n algorithm,\n bitDepth,\n fullAudioDurationMs: durationMs,\n numberOfChannels,\n })\n })\n } else {\n if (!fileUri) {\n throw new Error('fileUri is required')\n }\n logger?.log(`extractAudioAnalysis`, {\n fileUri,\n pointsPerSecond,\n algorithm,\n })\n const res = await ExpoAudioStreamModule.extractAudioAnalysis({\n fileUri,\n pointsPerSecond,\n skipWavHeader,\n algorithm,\n features,\n })\n logger?.log(`extractAudioAnalysis`, res)\n return res\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractWaveform.d.ts","sourceRoot":"","sources":["../../src/AudioAnalysis/extractWaveform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extractWaveform.d.ts","sourceRoot":"","sources":["../../src/AudioAnalysis/extractWaveform.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AACD,eAAO,MAAM,eAAe,kDAKzB,oBAAoB,KAAG,OAAO,CAAC,OAAO,CAQxC,CAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import ExpoAudioStreamModule from '../ExpoAudioStreamModule';
|
|
2
|
-
import { getLogger } from '../logger';
|
|
3
|
-
const logger = getLogger('extractWaveform');
|
|
4
2
|
export const extractWaveform = async ({ fileUri, numberOfSamples, offset = 0, length, }) => {
|
|
5
3
|
const res = await ExpoAudioStreamModule.extractAudioAnalysis({
|
|
6
4
|
fileUri,
|
|
@@ -8,7 +6,6 @@ export const extractWaveform = async ({ fileUri, numberOfSamples, offset = 0, le
|
|
|
8
6
|
offset,
|
|
9
7
|
length,
|
|
10
8
|
});
|
|
11
|
-
logger.log(`extractWaveform`, res);
|
|
12
9
|
return res;
|
|
13
10
|
};
|
|
14
11
|
//# sourceMappingURL=extractWaveform.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractWaveform.js","sourceRoot":"","sources":["../../src/AudioAnalysis/extractWaveform.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"extractWaveform.js","sourceRoot":"","sources":["../../src/AudioAnalysis/extractWaveform.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,0BAA0B,CAAA;AAQ5D,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,EAClC,OAAO,EACP,eAAe,EACf,MAAM,GAAG,CAAC,EACV,MAAM,GACa,EAAoB,EAAE;IACzC,MAAM,GAAG,GAAG,MAAM,qBAAqB,CAAC,oBAAoB,CAAC;QACzD,OAAO;QACP,eAAe;QACf,MAAM;QACN,MAAM;KACT,CAAC,CAAA;IACF,OAAO,GAAG,CAAA;AACd,CAAC,CAAA","sourcesContent":["import ExpoAudioStreamModule from '../ExpoAudioStreamModule'\n\nexport interface ExtractWaveformProps {\n fileUri: string\n numberOfSamples: number\n offset?: number\n length?: number\n}\nexport const extractWaveform = async ({\n fileUri,\n numberOfSamples,\n offset = 0,\n length,\n}: ExtractWaveformProps): Promise<unknown> => {\n const res = await ExpoAudioStreamModule.extractAudioAnalysis({\n fileUri,\n numberOfSamples,\n offset,\n length,\n })\n return res\n}\n"]}
|
|
@@ -18,6 +18,12 @@ export interface AudioDataEvent {
|
|
|
18
18
|
export type EncodingType = 'pcm_32bit' | 'pcm_16bit' | 'pcm_8bit';
|
|
19
19
|
export type SampleRate = 16000 | 44100 | 48000;
|
|
20
20
|
export type BitDepth = 8 | 16 | 32;
|
|
21
|
+
export type ConsoleLike = {
|
|
22
|
+
log: (message: string, ...args: unknown[]) => void;
|
|
23
|
+
debug: (message: string, ...args: unknown[]) => void;
|
|
24
|
+
warn: (message: string, ...args: unknown[]) => void;
|
|
25
|
+
error: (message: string, ...args: unknown[]) => void;
|
|
26
|
+
};
|
|
21
27
|
export interface Chunk {
|
|
22
28
|
text: string;
|
|
23
29
|
timestamp: [number, number | null];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudioStream.types.d.ts","sourceRoot":"","sources":["../src/ExpoAudioStream.types.ts"],"names":[],"mappings":"AACA,OAAO,EACH,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACvB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,GAAG,YAAY,CAAA;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAAA;AACjE,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;AAC9C,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAA;AAElC,MAAM,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EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,EAAE,aAAa,CAAA;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudioStream.types.js","sourceRoot":"","sources":["../src/ExpoAudioStream.types.ts"],"names":[],"mappings":"","sourcesContent":["// packages/expo-audio-stream/src/ExpoAudioStream.types.ts\nimport {\n AmplitudeAlgorithm,\n AudioAnalysis,\n AudioFeaturesOptions,\n} from './AudioAnalysis/AudioAnalysis.types'\nimport { AudioAnalysisEvent } from './events'\n\nexport interface AudioStreamStatus {\n isRecording: boolean\n isPaused: boolean\n durationMs: number\n size: number\n interval: number\n mimeType: string\n}\n\nexport interface AudioDataEvent {\n data: string | Float32Array\n position: number\n fileUri: string\n eventDataSize: number\n totalSize: number\n}\n\nexport type EncodingType = 'pcm_32bit' | 'pcm_16bit' | 'pcm_8bit'\nexport type SampleRate = 16000 | 44100 | 48000\nexport type BitDepth = 8 | 16 | 32\n\nexport interface Chunk {\n text: string\n timestamp: [number, number | null]\n}\n\nexport interface TranscriberData {\n id: string\n isBusy: boolean\n text: string\n startTime: number\n endTime: number\n chunks: Chunk[]\n}\n\nexport interface AudioRecording {\n fileUri: string\n filename: string\n durationMs: number\n size: number\n mimeType: string\n channels: number\n bitDepth: BitDepth\n sampleRate: SampleRate\n transcripts?: TranscriberData[]\n wavPCMData?: Float32Array // Full PCM data for the recording in WAV format (only on web, for native use the fileUri)\n analysisData?: AudioAnalysis // Analysis data for the recording depending on enableProcessing flag\n}\n\nexport interface StartRecordingResult {\n fileUri: string\n mimeType: string\n channels?: number\n bitDepth?: BitDepth\n sampleRate?: SampleRate\n}\n\nexport interface RecordingConfig {\n // Sample rate for recording (16000, 44100, or 48000 Hz)\n sampleRate?: SampleRate\n\n // Number of audio channels (1 for mono, 2 for stereo)\n channels?: 1 | 2\n\n // Encoding type for the recording (pcm_32bit, pcm_16bit, pcm_8bit)\n encoding?: EncodingType\n\n // Interval in milliseconds at which to emit recording data\n interval?: number\n\n // Keep the device awake while recording (default is false)\n keepAwake?: boolean\n\n // Show a notification during recording (default is false)\n showNotification?: boolean\n\n // Show waveform in the notification (Android only, when showNotification is true)\n showWaveformInNotification?: boolean\n\n // Configuration for the notification\n notification?: NotificationConfig\n\n // Enable audio processing (default is false)\n enableProcessing?: boolean\n\n // Number of data points to extract per second of audio (default is 1000)\n pointsPerSecond?: number\n\n // Algorithm to use for amplitude computation (default is \"rms\")\n algorithm?: AmplitudeAlgorithm\n\n // Feature options to extract (default is empty)\n features?: AudioFeaturesOptions\n\n // Callback function to handle audio stream\n onAudioStream?: (_: AudioDataEvent) => Promise<void>\n\n // Callback function to handle audio features extraction results\n onAudioAnalysis?: (_: AudioAnalysisEvent) => Promise<void>\n}\n\nexport interface NotificationConfig {\n // Title of the notification\n title?: string\n\n // Main text content of the notification\n text?: string\n\n // Icon to be displayed in the notification (resource name or URI)\n icon?: string\n\n // Android-specific notification configuration\n android?: {\n // Unique identifier for the notification channel\n channelId?: string\n\n // User-visible name of the notification channel\n channelName?: string\n\n // User-visible description of the notification channel\n channelDescription?: string\n\n // Unique identifier for this notification\n notificationId?: number\n\n // List of actions that can be performed from the notification\n actions?: NotificationAction[]\n\n // Configuration for the waveform visualization in the notification\n waveform?: WaveformConfig\n\n // Color of the notification LED (if device supports it)\n lightColor?: string\n\n // Priority of the notification (affects how it's displayed)\n priority?: 'min' | 'low' | 'default' | 'high' | 'max'\n\n // Accent color for the notification (used for the app icon and buttons)\n accentColor?: string\n }\n\n // iOS-specific notification configuration\n ios?: {\n // Identifier for the notification category (used for grouping similar notifications)\n categoryIdentifier?: string\n }\n}\n\nexport interface NotificationAction {\n // Display title for the action\n title: string\n\n // Unique identifier for the action\n identifier: string\n\n // Icon to be displayed for the action (Android only)\n icon?: string\n}\n\nexport interface WaveformConfig {\n color?: string // The color of the waveform (e.g., \"#FFFFFF\" for white)\n opacity?: number // Opacity of the waveform (0.0 - 1.0)\n strokeWidth?: number // Width of the waveform line (default: 1.5)\n style?: 'stroke' | 'fill' // Drawing style: \"stroke\" for outline, \"fill\" for solid\n mirror?: boolean // Whether to mirror the waveform (symmetrical display)\n height?: number // Height of the waveform view in dp (default: 64)\n}\n\nexport interface UseAudioRecorderState {\n startRecording: (_: RecordingConfig) => Promise<StartRecordingResult>\n stopRecording: () => Promise<AudioRecording | null>\n pauseRecording: () => Promise<void>\n resumeRecording: () => Promise<void>\n isRecording: boolean\n isPaused: boolean\n durationMs: number // Duration of the recording\n size: number // Size in bytes of the recorded audio\n analysisData?: AudioAnalysis // Analysis data for the recording depending on enableProcessing flag\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ExpoAudioStream.types.js","sourceRoot":"","sources":["../src/ExpoAudioStream.types.ts"],"names":[],"mappings":"","sourcesContent":["// packages/expo-audio-stream/src/ExpoAudioStream.types.ts\nimport {\n AmplitudeAlgorithm,\n AudioAnalysis,\n AudioFeaturesOptions,\n} from './AudioAnalysis/AudioAnalysis.types'\nimport { AudioAnalysisEvent } from './events'\n\nexport interface AudioStreamStatus {\n isRecording: boolean\n isPaused: boolean\n durationMs: number\n size: number\n interval: number\n mimeType: string\n}\n\nexport interface AudioDataEvent {\n data: string | Float32Array\n position: number\n fileUri: string\n eventDataSize: number\n totalSize: number\n}\n\nexport type EncodingType = 'pcm_32bit' | 'pcm_16bit' | 'pcm_8bit'\nexport type SampleRate = 16000 | 44100 | 48000\nexport type BitDepth = 8 | 16 | 32\n\nexport type ConsoleLike = {\n log: (message: string, ...args: unknown[]) => void\n debug: (message: string, ...args: unknown[]) => void\n warn: (message: string, ...args: unknown[]) => void\n error: (message: string, ...args: unknown[]) => void\n}\n\nexport interface Chunk {\n text: string\n timestamp: [number, number | null]\n}\n\nexport interface TranscriberData {\n id: string\n isBusy: boolean\n text: string\n startTime: number\n endTime: number\n chunks: Chunk[]\n}\n\nexport interface AudioRecording {\n fileUri: string\n filename: string\n durationMs: number\n size: number\n mimeType: string\n channels: number\n bitDepth: BitDepth\n sampleRate: SampleRate\n transcripts?: TranscriberData[]\n wavPCMData?: Float32Array // Full PCM data for the recording in WAV format (only on web, for native use the fileUri)\n analysisData?: AudioAnalysis // Analysis data for the recording depending on enableProcessing flag\n}\n\nexport interface StartRecordingResult {\n fileUri: string\n mimeType: string\n channels?: number\n bitDepth?: BitDepth\n sampleRate?: SampleRate\n}\n\nexport interface RecordingConfig {\n // Sample rate for recording (16000, 44100, or 48000 Hz)\n sampleRate?: SampleRate\n\n // Number of audio channels (1 for mono, 2 for stereo)\n channels?: 1 | 2\n\n // Encoding type for the recording (pcm_32bit, pcm_16bit, pcm_8bit)\n encoding?: EncodingType\n\n // Interval in milliseconds at which to emit recording data\n interval?: number\n\n // Keep the device awake while recording (default is false)\n keepAwake?: boolean\n\n // Show a notification during recording (default is false)\n showNotification?: boolean\n\n // Show waveform in the notification (Android only, when showNotification is true)\n showWaveformInNotification?: boolean\n\n // Configuration for the notification\n notification?: NotificationConfig\n\n // Enable audio processing (default is false)\n enableProcessing?: boolean\n\n // Number of data points to extract per second of audio (default is 1000)\n pointsPerSecond?: number\n\n // Algorithm to use for amplitude computation (default is \"rms\")\n algorithm?: AmplitudeAlgorithm\n\n // Feature options to extract (default is empty)\n features?: AudioFeaturesOptions\n\n // Callback function to handle audio stream\n onAudioStream?: (_: AudioDataEvent) => Promise<void>\n\n // Callback function to handle audio features extraction results\n onAudioAnalysis?: (_: AudioAnalysisEvent) => Promise<void>\n}\n\nexport interface NotificationConfig {\n // Title of the notification\n title?: string\n\n // Main text content of the notification\n text?: string\n\n // Icon to be displayed in the notification (resource name or URI)\n icon?: string\n\n // Android-specific notification configuration\n android?: {\n // Unique identifier for the notification channel\n channelId?: string\n\n // User-visible name of the notification channel\n channelName?: string\n\n // User-visible description of the notification channel\n channelDescription?: string\n\n // Unique identifier for this notification\n notificationId?: number\n\n // List of actions that can be performed from the notification\n actions?: NotificationAction[]\n\n // Configuration for the waveform visualization in the notification\n waveform?: WaveformConfig\n\n // Color of the notification LED (if device supports it)\n lightColor?: string\n\n // Priority of the notification (affects how it's displayed)\n priority?: 'min' | 'low' | 'default' | 'high' | 'max'\n\n // Accent color for the notification (used for the app icon and buttons)\n accentColor?: string\n }\n\n // iOS-specific notification configuration\n ios?: {\n // Identifier for the notification category (used for grouping similar notifications)\n categoryIdentifier?: string\n }\n}\n\nexport interface NotificationAction {\n // Display title for the action\n title: string\n\n // Unique identifier for the action\n identifier: string\n\n // Icon to be displayed for the action (Android only)\n icon?: string\n}\n\nexport interface WaveformConfig {\n color?: string // The color of the waveform (e.g., \"#FFFFFF\" for white)\n opacity?: number // Opacity of the waveform (0.0 - 1.0)\n strokeWidth?: number // Width of the waveform line (default: 1.5)\n style?: 'stroke' | 'fill' // Drawing style: \"stroke\" for outline, \"fill\" for solid\n mirror?: boolean // Whether to mirror the waveform (symmetrical display)\n height?: number // Height of the waveform view in dp (default: 64)\n}\n\nexport interface UseAudioRecorderState {\n startRecording: (_: RecordingConfig) => Promise<StartRecordingResult>\n stopRecording: () => Promise<AudioRecording | null>\n pauseRecording: () => Promise<void>\n resumeRecording: () => Promise<void>\n isRecording: boolean\n isPaused: boolean\n durationMs: number // Duration of the recording\n size: number // Size in bytes of the recorded audio\n analysisData?: AudioAnalysis // Analysis data for the recording depending on enableProcessing flag\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LegacyEventEmitter } from 'expo-modules-core';
|
|
2
2
|
import { AudioAnalysis } from './AudioAnalysis/AudioAnalysis.types';
|
|
3
|
-
import { AudioRecording, AudioStreamStatus, BitDepth, RecordingConfig, StartRecordingResult } from './ExpoAudioStream.types';
|
|
3
|
+
import { AudioRecording, AudioStreamStatus, BitDepth, ConsoleLike, RecordingConfig, StartRecordingResult } from './ExpoAudioStream.types';
|
|
4
4
|
import { WebRecorder } from './WebRecorder.web';
|
|
5
5
|
export interface EmitAudioEventProps {
|
|
6
6
|
data: Float32Array;
|
|
@@ -9,6 +9,7 @@ export interface EmitAudioEventProps {
|
|
|
9
9
|
export type EmitAudioEventFunction = (_: EmitAudioEventProps) => void;
|
|
10
10
|
export type EmitAudioAnalysisFunction = (_: AudioAnalysis) => void;
|
|
11
11
|
export interface ExpoAudioStreamWebProps {
|
|
12
|
+
logger?: ConsoleLike;
|
|
12
13
|
audioWorkletUrl: string;
|
|
13
14
|
featuresExtratorUrl: string;
|
|
14
15
|
}
|
|
@@ -30,7 +31,8 @@ export declare class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
30
31
|
bitDepth: BitDepth;
|
|
31
32
|
audioWorkletUrl: string;
|
|
32
33
|
featuresExtratorUrl: string;
|
|
33
|
-
|
|
34
|
+
logger?: ConsoleLike;
|
|
35
|
+
constructor({ audioWorkletUrl, featuresExtratorUrl, logger, }: ExpoAudioStreamWebProps);
|
|
34
36
|
getMediaStream(): Promise<MediaStream>;
|
|
35
37
|
startRecording(recordingConfig?: RecordingConfig): Promise<StartRecordingResult>;
|
|
36
38
|
emitAudioEvent({ data, position }: EmitAudioEventProps): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudioStream.web.d.ts","sourceRoot":"","sources":["../src/ExpoAudioStream.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,eAAe,EACf,oBAAoB,EACvB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ExpoAudioStream.web.d.ts","sourceRoot":"","sources":["../src/ExpoAudioStream.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,QAAQ,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AAe,GAAE,eAAoB;IAkE1D,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,mBAAmB;IAiBhD,aAAa,IAAI,OAAO,CAAC,cAAc,CAAC;IA6CxC,cAAc;IAad,eAAe;IAarB,MAAM;CAWT"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// src/ExpoAudioStreamModule.web.ts
|
|
2
2
|
import { LegacyEventEmitter } from 'expo-modules-core';
|
|
3
3
|
import { WebRecorder } from './WebRecorder.web';
|
|
4
|
-
import { getLogger } from './logger';
|
|
5
4
|
import { encodingToBitDepth } from './utils/encodingToBitDepth';
|
|
6
5
|
import { writeWavHeader } from './utils/writeWavHeader';
|
|
7
|
-
const logger = getLogger('ExpoAudioStreamWeb');
|
|
8
6
|
export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
9
7
|
customRecorder;
|
|
10
8
|
audioChunks;
|
|
@@ -23,7 +21,8 @@ export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
23
21
|
bitDepth; // Bit depth of the audio
|
|
24
22
|
audioWorkletUrl;
|
|
25
23
|
featuresExtratorUrl;
|
|
26
|
-
|
|
24
|
+
logger;
|
|
25
|
+
constructor({ audioWorkletUrl, featuresExtratorUrl, logger, }) {
|
|
27
26
|
const mockNativeModule = {
|
|
28
27
|
addListener: () => {
|
|
29
28
|
// Not used on web
|
|
@@ -33,6 +32,7 @@ export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
33
32
|
},
|
|
34
33
|
};
|
|
35
34
|
super(mockNativeModule); // Pass the mock native module to the parent class
|
|
35
|
+
this.logger = logger;
|
|
36
36
|
this.customRecorder = null;
|
|
37
37
|
this.audioChunks = [];
|
|
38
38
|
this.isRecording = false;
|
|
@@ -86,7 +86,7 @@ export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
86
86
|
this.lastEmittedSize = this.currentSize;
|
|
87
87
|
},
|
|
88
88
|
emitAudioAnalysisCallback: (audioAnalysisData) => {
|
|
89
|
-
logger
|
|
89
|
+
this.logger?.log(`Emitted AudioAnalysis:`, audioAnalysisData);
|
|
90
90
|
this.emit('AudioAnalysis', audioAnalysisData);
|
|
91
91
|
},
|
|
92
92
|
});
|
|
@@ -137,7 +137,7 @@ export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
137
137
|
}
|
|
138
138
|
const fullPcmBufferArray = await this.customRecorder.stop();
|
|
139
139
|
// concat all audio chunks
|
|
140
|
-
logger
|
|
140
|
+
this.logger?.debug(`Stopped recording`, fullPcmBufferArray);
|
|
141
141
|
this.isRecording = false;
|
|
142
142
|
this.isPaused = false;
|
|
143
143
|
this.currentDurationMs = Date.now() - this.recordingStartTime;
|
|
@@ -148,7 +148,7 @@ export class ExpoAudioStreamWeb extends LegacyEventEmitter {
|
|
|
148
148
|
numChannels: this.recordingConfig?.channels ?? 1,
|
|
149
149
|
bitDepth: this.bitDepth,
|
|
150
150
|
};
|
|
151
|
-
logger
|
|
151
|
+
this.logger?.debug(`Writing wav header`, wavConfig);
|
|
152
152
|
const wavBuffer = writeWavHeader(wavConfig).slice(0);
|
|
153
153
|
// Create blob fileUri from audio chunks
|
|
154
154
|
const blob = new Blob([wavBuffer], {
|