@siteed/expo-audio-stream 1.1.5 → 1.1.7
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/.eslintrc.js +2 -0
- package/.size-limit.json +6 -0
- package/.yarn/install-state.gz +0 -0
- package/android/.gradle/8.1.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.1.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/8.1.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.1.1/gc.properties +0 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/results.bin +1 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioAnalysisData$AmplitudeRange.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioAnalysisData$SpeakerChange.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioAnalysisData.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioDataEncoder.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioFileHandler.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioFormatUtils.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioProcessor$AudioData.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioProcessor$Companion.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioProcessor$extractMFCC$powerSpectrum$2.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioProcessor.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/AudioRecorderManager.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/BuildConfig.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/Constants.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/DataPoint.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/EventSender.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$1.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$10.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$11.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$12.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$13.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$14.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$15.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$16.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$17.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$18.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$2.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$3.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$4.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$5.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$6.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$7.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$8.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$9.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$1.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$2.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$3.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$4.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$1.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$2.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/ExpoAudioStreamModule.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/FFT.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/Features.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/PermissionUtils.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/debug_dex/net/siteed/audiostream/RecordingConfig.dex +0 -0
- package/android/build/.transforms/10769ccaccd8850af4ffc5504c4368cb/transformed/debug/desugar_graph.bin +0 -0
- package/android/build/.transforms/7bc0cb35da9eb644120553a3af66f984/results.bin +1 -0
- package/android/build/.transforms/7bc0cb35da9eb644120553a3af66f984/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/949f6bd23bdf38f67d1eb7de8f618950/results.bin +1 -0
- package/android/build/.transforms/949f6bd23bdf38f67d1eb7de8f618950/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +10 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/java_res/debug/out/META-INF/siteed-expo-audio-stream_debug.kotlin_module +0 -0
- package/android/build/intermediates/javac/debug/classes/net/siteed/audiostream/BuildConfig.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +14 -0
- package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +10 -0
- package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/META-INF/siteed-expo-audio-stream_debug.kotlin_module +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioAnalysisData$AmplitudeRange.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioAnalysisData$SpeakerChange.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioAnalysisData.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioDataEncoder.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioFileHandler.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioFormatUtils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioProcessor$AudioData.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioProcessor$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioProcessor$extractMFCC$powerSpectrum$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioProcessor.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/AudioRecorderManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/Constants.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/DataPoint.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/EventSender.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$10.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$11.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$12.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$13.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$14.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$15.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$16.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$17.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$18.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$5.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$6.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$7.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$8.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$9.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$3.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$4.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/ExpoAudioStreamModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/FFT.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/Features.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/PermissionUtils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/net/siteed/audiostream/RecordingConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1 -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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +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/inputs/source-to-output.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +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-attributes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +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/class-fq-name-to-source.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i.len +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/internal-name-to-source.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values +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/proto.tab.values.s +1 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +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/source-to-classes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +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/subtypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +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/jvm/kotlin/supertypes.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
- 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.keystream +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +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/file-to-id.tab_i +0 -0
- package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +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/id-to-file.tab_i.len +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/caches-jvm/lookups/lookups.tab_i.len +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/outputs/logs/manifest-merger-debug-report.txt +24 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/debug/META-INF/siteed-expo-audio-stream_debug.kotlin_module +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioAnalysisData$AmplitudeRange.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioAnalysisData$SpeakerChange.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioAnalysisData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioDataEncoder.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioFileHandler.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioFormatUtils.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioProcessor$AudioData.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioProcessor$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioProcessor$extractMFCC$powerSpectrum$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioProcessor.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/AudioRecorderManager.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/Constants.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/DataPoint.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/EventSender.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$10.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$11.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$12.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$13.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$14.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$15.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$16.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$17.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$18.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$5.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$6.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$7.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$8.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunction$9.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$3.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$AsyncFunctionWithPromise$4.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$1.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule$definition$lambda$14$$inlined$FunctionWithoutArgs$2.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/ExpoAudioStreamModule.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/FFT.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/Features.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/PermissionUtils.class +0 -0
- package/android/build/tmp/kotlin-classes/debug/net/siteed/audiostream/RecordingConfig.class +0 -0
- package/app.plugin.js +1 -0
- package/build/ExpoAudioStream.web.d.ts.map +1 -1
- package/build/ExpoAudioStream.web.js +1 -0
- package/build/ExpoAudioStream.web.js.map +1 -1
- package/build/WebRecorder.web.d.ts.map +1 -1
- package/build/WebRecorder.web.js +12 -2
- package/build/WebRecorder.web.js.map +1 -1
- package/build/utils/writeWavHeader.d.ts +43 -3
- package/build/utils/writeWavHeader.d.ts.map +1 -1
- package/build/utils/writeWavHeader.js +65 -19
- package/build/utils/writeWavHeader.js.map +1 -1
- package/expo-module.config.json +9 -0
- package/package.json +2 -22
- package/plugin/build/index.d.ts +5 -0
- package/plugin/build/index.js +28 -0
- package/plugin/src/index.ts +53 -0
- package/plugin/tsconfig.json +9 -0
- package/publish.sh +9 -0
- package/src/AudioAnalysis/AudioAnalysis.types.ts +84 -0
- package/src/AudioAnalysis/extractAudioAnalysis.ts +147 -0
- package/src/AudioAnalysis/extractWaveform.ts +25 -0
- package/src/AudioRecorder.provider.tsx +53 -0
- package/src/ExpoAudioStream.native.ts +6 -0
- package/src/ExpoAudioStream.types.ts +93 -0
- package/src/ExpoAudioStream.web.ts +256 -0
- package/src/ExpoAudioStreamModule.ts +31 -0
- package/src/WebRecorder.web.ts +448 -0
- package/src/constants.ts +18 -0
- package/src/events.ts +39 -0
- package/src/index.ts +24 -0
- package/src/logger.ts +22 -0
- package/src/useAudioRecorder.tsx +420 -0
- package/src/utils/BlobFix.ts +550 -0
- package/src/utils/concatenateBuffers.ts +24 -0
- package/src/utils/convertPCMToFloat32.ts +75 -0
- package/src/utils/encodingToBitDepth.ts +18 -0
- package/src/utils/getWavFileInfo.ts +132 -0
- package/src/utils/writeWavHeader.ts +114 -0
- package/src/workers/InlineFeaturesExtractor.web.tsx +312 -0
- package/src/workers/inlineAudioWebWorker.web.tsx +250 -0
- package/tsconfig.json +14 -0
|
@@ -1,7 +1,40 @@
|
|
|
1
|
+
// packages/expo-audio-stream/src/utils/writeWavHeader.ts
|
|
2
|
+
/**
|
|
3
|
+
* Writes or updates a WAV (RIFF) header based on the provided options.
|
|
4
|
+
*
|
|
5
|
+
* This function can be used in three ways:
|
|
6
|
+
* 1. To create a standalone WAV header (when no buffer is provided).
|
|
7
|
+
* 2. To create a WAV header and combine it with existing audio data (when a buffer without a header is provided).
|
|
8
|
+
* 3. To update an existing WAV header in the provided buffer.
|
|
9
|
+
*
|
|
10
|
+
* For streaming audio where the final size is unknown, this function sets the size fields
|
|
11
|
+
* to the maximum 32-bit value (0xFFFFFFFF). These can be updated later using the
|
|
12
|
+
* `updateWavHeaderSize` function once the final size is known.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The options for creating or updating the WAV header.
|
|
15
|
+
* @returns An ArrayBuffer containing the WAV header, or the header combined with the provided audio data.
|
|
16
|
+
*
|
|
17
|
+
* @throws {Error} Throws an error if the provided options are invalid or if the buffer is too small.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Create a standalone WAV header
|
|
21
|
+
* const header = writeWavHeader({
|
|
22
|
+
* sampleRate: 44100,
|
|
23
|
+
* numChannels: 2,
|
|
24
|
+
* bitDepth: 16
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Create a WAV header and combine it with audio data
|
|
29
|
+
* const completeWav = writeWavHeader({
|
|
30
|
+
* buffer: audioData,
|
|
31
|
+
* sampleRate: 44100,
|
|
32
|
+
* numChannels: 2,
|
|
33
|
+
* bitDepth: 16
|
|
34
|
+
* });
|
|
35
|
+
*/
|
|
1
36
|
export const writeWavHeader = ({ buffer, sampleRate, numChannels, bitDepth, }) => {
|
|
2
37
|
const bytesPerSample = bitDepth / 8;
|
|
3
|
-
const numSamples = buffer.byteLength / (numChannels * bytesPerSample);
|
|
4
|
-
const view = new DataView(buffer);
|
|
5
38
|
const blockAlign = numChannels * bytesPerSample;
|
|
6
39
|
const byteRate = sampleRate * blockAlign;
|
|
7
40
|
// Function to write a string to the DataView
|
|
@@ -10,16 +43,10 @@ export const writeWavHeader = ({ buffer, sampleRate, numChannels, bitDepth, }) =
|
|
|
10
43
|
view.setUint8(offset + i, string.charCodeAt(i));
|
|
11
44
|
}
|
|
12
45
|
};
|
|
13
|
-
//
|
|
14
|
-
const
|
|
15
|
-
if (!existingHeader) {
|
|
16
|
-
// Ensure the buffer is large enough for the WAV header
|
|
17
|
-
if (buffer.byteLength < 44) {
|
|
18
|
-
throw new Error('Buffer is too small to contain a valid WAV header');
|
|
19
|
-
}
|
|
20
|
-
// Write the WAV header
|
|
46
|
+
// Function to write or update the header
|
|
47
|
+
const writeHeader = (view, dataSize = 0xffffffff) => {
|
|
21
48
|
writeString(view, 0, 'RIFF'); // ChunkID
|
|
22
|
-
view.setUint32(4, 36 +
|
|
49
|
+
view.setUint32(4, 36 + dataSize, true); // ChunkSize
|
|
23
50
|
writeString(view, 8, 'WAVE'); // Format
|
|
24
51
|
writeString(view, 12, 'fmt '); // Subchunk1ID
|
|
25
52
|
view.setUint32(16, 16, true); // Subchunk1Size (16 for PCM)
|
|
@@ -30,16 +57,35 @@ export const writeWavHeader = ({ buffer, sampleRate, numChannels, bitDepth, }) =
|
|
|
30
57
|
view.setUint16(32, blockAlign, true); // BlockAlign
|
|
31
58
|
view.setUint16(34, bitDepth, true); // BitsPerSample
|
|
32
59
|
writeString(view, 36, 'data'); // Subchunk2ID
|
|
33
|
-
view.setUint32(40,
|
|
60
|
+
view.setUint32(40, dataSize, true); // Subchunk2Size
|
|
61
|
+
};
|
|
62
|
+
if (buffer) {
|
|
63
|
+
if (buffer.byteLength < 44) {
|
|
64
|
+
throw new Error('Buffer is too small to contain a valid WAV header');
|
|
65
|
+
}
|
|
66
|
+
const view = new DataView(buffer);
|
|
67
|
+
// Check if the buffer already has a WAV header by looking for "RIFF" at the start
|
|
68
|
+
const existingHeader = view.getUint32(0, false) === 0x52494646; // "RIFF" in ASCII
|
|
69
|
+
if (existingHeader) {
|
|
70
|
+
// Update the existing header
|
|
71
|
+
writeHeader(view, buffer.byteLength - 44);
|
|
72
|
+
return buffer;
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// Combine the new header with the existing buffer
|
|
76
|
+
const newBuffer = new ArrayBuffer(44 + buffer.byteLength);
|
|
77
|
+
const newView = new DataView(newBuffer);
|
|
78
|
+
writeHeader(newView, buffer.byteLength);
|
|
79
|
+
new Uint8Array(newBuffer).set(new Uint8Array(buffer), 44);
|
|
80
|
+
return newBuffer;
|
|
81
|
+
}
|
|
34
82
|
}
|
|
35
83
|
else {
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
view
|
|
39
|
-
view
|
|
40
|
-
|
|
41
|
-
view.setUint32(40, numSamples * blockAlign, true); // Update Subchunk2Size
|
|
84
|
+
// Create a standalone header
|
|
85
|
+
const headerBuffer = new ArrayBuffer(44);
|
|
86
|
+
const view = new DataView(headerBuffer);
|
|
87
|
+
writeHeader(view);
|
|
88
|
+
return headerBuffer;
|
|
42
89
|
}
|
|
43
|
-
return buffer;
|
|
44
90
|
};
|
|
45
91
|
//# sourceMappingURL=writeWavHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeWavHeader.js","sourceRoot":"","sources":["../../src/utils/writeWavHeader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"writeWavHeader.js","sourceRoot":"","sources":["../../src/utils/writeWavHeader.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAgBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,MAAM,EACN,UAAU,EACV,WAAW,EACX,QAAQ,GACO,EAAe,EAAE;IAChC,MAAM,cAAc,GAAG,QAAQ,GAAG,CAAC,CAAA;IACnC,MAAM,UAAU,GAAG,WAAW,GAAG,cAAc,CAAA;IAC/C,MAAM,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAA;IAExC,6CAA6C;IAC7C,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,MAAc,EAAE,MAAc,EAAE,EAAE;QACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;QACnD,CAAC;IACL,CAAC,CAAA;IAED,yCAAyC;IACzC,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,WAAmB,UAAU,EAAE,EAAE;QAClE,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA,CAAC,UAAU;QACvC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,GAAG,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,YAAY;QACnD,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAA,CAAC,SAAS;QACtC,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA,CAAC,cAAc;QAC5C,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,CAAA,CAAC,6BAA6B;QAC1D,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,uCAAuC;QACzF,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA,CAAC,cAAc;QACpD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA,CAAC,aAAa;QAClD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;QAC9C,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA,CAAC,aAAa;QAClD,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,gBAAgB;QACnD,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA,CAAC,cAAc;QAC5C,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA,CAAC,gBAAgB;IACvD,CAAC,CAAA;IAED,IAAI,MAAM,EAAE,CAAC;QACT,IAAI,MAAM,CAAC,UAAU,GAAG,EAAE,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;QACxE,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAA;QAEjC,kFAAkF;QAClF,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,UAAU,CAAA,CAAC,kBAAkB;QAEjF,IAAI,cAAc,EAAE,CAAC;YACjB,6BAA6B;YAC7B,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;YACzC,OAAO,MAAM,CAAA;QACjB,CAAC;aAAM,CAAC;YACJ,kDAAkD;YAClD,MAAM,SAAS,GAAG,IAAI,WAAW,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;YACzD,MAAM,OAAO,GAAG,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAA;YACvC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;YACvC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAA;YACzD,OAAO,SAAS,CAAA;QACpB,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,6BAA6B;QAC7B,MAAM,YAAY,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAA;QACxC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAA;QACvC,WAAW,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,YAAY,CAAA;IACvB,CAAC;AACL,CAAC,CAAA","sourcesContent":["// packages/expo-audio-stream/src/utils/writeWavHeader.ts\n\n/**\n * Options for creating a WAV header.\n */\nexport interface WavHeaderOptions {\n /** Optional buffer containing audio data. If provided, it will be combined with the header. */\n buffer?: ArrayBuffer\n /** The sample rate of the audio in Hz (e.g., 44100). */\n sampleRate: number\n /** The number of audio channels (e.g., 1 for mono, 2 for stereo). */\n numChannels: number\n /** The bit depth of the audio (e.g., 16, 24, or 32). */\n bitDepth: number\n}\n\n/**\n * Writes or updates a WAV (RIFF) header based on the provided options.\n *\n * This function can be used in three ways:\n * 1. To create a standalone WAV header (when no buffer is provided).\n * 2. To create a WAV header and combine it with existing audio data (when a buffer without a header is provided).\n * 3. To update an existing WAV header in the provided buffer.\n *\n * For streaming audio where the final size is unknown, this function sets the size fields\n * to the maximum 32-bit value (0xFFFFFFFF). These can be updated later using the\n * `updateWavHeaderSize` function once the final size is known.\n *\n * @param options - The options for creating or updating the WAV header.\n * @returns An ArrayBuffer containing the WAV header, or the header combined with the provided audio data.\n *\n * @throws {Error} Throws an error if the provided options are invalid or if the buffer is too small.\n *\n * @example\n * // Create a standalone WAV header\n * const header = writeWavHeader({\n * sampleRate: 44100,\n * numChannels: 2,\n * bitDepth: 16\n * });\n *\n * @example\n * // Create a WAV header and combine it with audio data\n * const completeWav = writeWavHeader({\n * buffer: audioData,\n * sampleRate: 44100,\n * numChannels: 2,\n * bitDepth: 16\n * });\n */\nexport const writeWavHeader = ({\n buffer,\n sampleRate,\n numChannels,\n bitDepth,\n}: WavHeaderOptions): ArrayBuffer => {\n const bytesPerSample = bitDepth / 8\n const blockAlign = numChannels * bytesPerSample\n const byteRate = sampleRate * blockAlign\n\n // Function to write a string to the DataView\n const writeString = (view: DataView, offset: number, string: string) => {\n for (let i = 0; i < string.length; i++) {\n view.setUint8(offset + i, string.charCodeAt(i))\n }\n }\n\n // Function to write or update the header\n const writeHeader = (view: DataView, dataSize: number = 0xffffffff) => {\n writeString(view, 0, 'RIFF') // ChunkID\n view.setUint32(4, 36 + dataSize, true) // ChunkSize\n writeString(view, 8, 'WAVE') // Format\n writeString(view, 12, 'fmt ') // Subchunk1ID\n view.setUint32(16, 16, true) // Subchunk1Size (16 for PCM)\n view.setUint16(20, bitDepth === 32 ? 3 : 1, true) // AudioFormat (3 for float, 1 for PCM)\n view.setUint16(22, numChannels, true) // NumChannels\n view.setUint32(24, sampleRate, true) // SampleRate\n view.setUint32(28, byteRate, true) // ByteRate\n view.setUint16(32, blockAlign, true) // BlockAlign\n view.setUint16(34, bitDepth, true) // BitsPerSample\n writeString(view, 36, 'data') // Subchunk2ID\n view.setUint32(40, dataSize, true) // Subchunk2Size\n }\n\n if (buffer) {\n if (buffer.byteLength < 44) {\n throw new Error('Buffer is too small to contain a valid WAV header')\n }\n\n const view = new DataView(buffer)\n\n // Check if the buffer already has a WAV header by looking for \"RIFF\" at the start\n const existingHeader = view.getUint32(0, false) === 0x52494646 // \"RIFF\" in ASCII\n\n if (existingHeader) {\n // Update the existing header\n writeHeader(view, buffer.byteLength - 44)\n return buffer\n } else {\n // Combine the new header with the existing buffer\n const newBuffer = new ArrayBuffer(44 + buffer.byteLength)\n const newView = new DataView(newBuffer)\n writeHeader(newView, buffer.byteLength)\n new Uint8Array(newBuffer).set(new Uint8Array(buffer), 44)\n return newBuffer\n }\n } else {\n // Create a standalone header\n const headerBuffer = new ArrayBuffer(44)\n const view = new DataView(headerBuffer)\n writeHeader(view)\n return headerBuffer\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siteed/expo-audio-stream",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "stream audio crossplatform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
8
8
|
"author": "Arthur Breton <abreton@siteed.net> (https://github.com/deeeed)",
|
|
9
|
-
"homepage": "https://github.com/deeeed/expo-audio-stream
|
|
9
|
+
"homepage": "https://github.com/deeeed/expo-audio-stream/blob/main/packages/expo-audio-stream/README.md",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/deeeed/expo-audio-stream.git",
|
|
@@ -21,26 +21,6 @@
|
|
|
21
21
|
"expo-audio-stream",
|
|
22
22
|
"ExpoAudioStream"
|
|
23
23
|
],
|
|
24
|
-
"files": [
|
|
25
|
-
"android",
|
|
26
|
-
"ios",
|
|
27
|
-
"cpp",
|
|
28
|
-
"build",
|
|
29
|
-
"generated",
|
|
30
|
-
"README.md",
|
|
31
|
-
"package.json",
|
|
32
|
-
"*.podspec",
|
|
33
|
-
"!ios/build",
|
|
34
|
-
"!android/build",
|
|
35
|
-
"!android/gradle",
|
|
36
|
-
"!android/gradlew",
|
|
37
|
-
"!android/gradlew.bat",
|
|
38
|
-
"!android/local.properties",
|
|
39
|
-
"!**/__tests__",
|
|
40
|
-
"!**/__fixtures__",
|
|
41
|
-
"!**/__mocks__",
|
|
42
|
-
"!**/.*"
|
|
43
|
-
],
|
|
44
24
|
"scripts": {
|
|
45
25
|
"build": "expo-module build",
|
|
46
26
|
"clean": "expo-module clean",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
4
|
+
const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone';
|
|
5
|
+
const withRecordingPermission = (config, existingPerms) => {
|
|
6
|
+
if (!existingPerms) {
|
|
7
|
+
console.warn('No previous permissions provided');
|
|
8
|
+
}
|
|
9
|
+
config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
|
|
10
|
+
config.modResults['NSMicrophoneUsageDescription'] = MICROPHONE_USAGE;
|
|
11
|
+
// Add audio to UIBackgroundModes to allow background audio recording
|
|
12
|
+
const existingBackgroundModes = config.modResults.UIBackgroundModes || [];
|
|
13
|
+
if (!existingBackgroundModes.includes('audio')) {
|
|
14
|
+
existingBackgroundModes.push('audio');
|
|
15
|
+
}
|
|
16
|
+
config.modResults.UIBackgroundModes = existingBackgroundModes;
|
|
17
|
+
return config;
|
|
18
|
+
});
|
|
19
|
+
config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
|
|
20
|
+
const mainApplication = config_plugins_1.AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults);
|
|
21
|
+
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, 'android.permission.RECORD_AUDIO', MICROPHONE_USAGE);
|
|
22
|
+
// Add FOREGROUND_SERVICE permission for handling background recording
|
|
23
|
+
config_plugins_1.AndroidConfig.Manifest.addMetaDataItemToMainApplication(mainApplication, 'android.permission.FOREGROUND_SERVICE', 'This apps needs access to the foreground service to record audio in the background');
|
|
24
|
+
return config;
|
|
25
|
+
});
|
|
26
|
+
return config;
|
|
27
|
+
};
|
|
28
|
+
exports.default = withRecordingPermission;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AndroidConfig,
|
|
3
|
+
ConfigPlugin,
|
|
4
|
+
withAndroidManifest,
|
|
5
|
+
withInfoPlist,
|
|
6
|
+
} from '@expo/config-plugins'
|
|
7
|
+
|
|
8
|
+
const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone'
|
|
9
|
+
|
|
10
|
+
const withRecordingPermission: ConfigPlugin<{
|
|
11
|
+
microphonePermission: string
|
|
12
|
+
}> = (config, existingPerms) => {
|
|
13
|
+
if (!existingPerms) {
|
|
14
|
+
console.warn('No previous permissions provided')
|
|
15
|
+
}
|
|
16
|
+
config = withInfoPlist(config, (config) => {
|
|
17
|
+
config.modResults['NSMicrophoneUsageDescription'] = MICROPHONE_USAGE
|
|
18
|
+
|
|
19
|
+
// Add audio to UIBackgroundModes to allow background audio recording
|
|
20
|
+
const existingBackgroundModes =
|
|
21
|
+
config.modResults.UIBackgroundModes || []
|
|
22
|
+
if (!existingBackgroundModes.includes('audio')) {
|
|
23
|
+
existingBackgroundModes.push('audio')
|
|
24
|
+
}
|
|
25
|
+
config.modResults.UIBackgroundModes = existingBackgroundModes
|
|
26
|
+
|
|
27
|
+
return config
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
config = withAndroidManifest(config, (config) => {
|
|
31
|
+
const mainApplication =
|
|
32
|
+
AndroidConfig.Manifest.getMainApplicationOrThrow(config.modResults)
|
|
33
|
+
|
|
34
|
+
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
|
|
35
|
+
mainApplication,
|
|
36
|
+
'android.permission.RECORD_AUDIO',
|
|
37
|
+
MICROPHONE_USAGE
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
// Add FOREGROUND_SERVICE permission for handling background recording
|
|
41
|
+
AndroidConfig.Manifest.addMetaDataItemToMainApplication(
|
|
42
|
+
mainApplication,
|
|
43
|
+
'android.permission.FOREGROUND_SERVICE',
|
|
44
|
+
'This apps needs access to the foreground service to record audio in the background'
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return config
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
return config
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default withRecordingPermission
|
package/publish.sh
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// packages/expo-audio-stream/src/AudioAnalysis/AudioAnalysis.types.ts
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents various audio features extracted from an audio signal.
|
|
5
|
+
*/
|
|
6
|
+
export interface AudioFeatures {
|
|
7
|
+
energy: number // The infinite integral of the squared signal, representing the overall energy of the audio.
|
|
8
|
+
mfcc: number[] // Mel-frequency cepstral coefficients, describing the short-term power spectrum of a sound.
|
|
9
|
+
rms: number // Root mean square value, indicating the amplitude of the audio signal.
|
|
10
|
+
minAmplitude: number // Minimum amplitude value in the audio signal.
|
|
11
|
+
maxAmplitude: number // Maximum amplitude value in the audio signal.
|
|
12
|
+
zcr: number // Zero-crossing rate, indicating the rate at which the signal changes sign.
|
|
13
|
+
spectralCentroid: number // The center of mass of the spectrum, indicating the brightness of the sound.
|
|
14
|
+
spectralFlatness: number // Measure of the flatness of the spectrum, indicating how noise-like the signal is.
|
|
15
|
+
spectralRolloff: number // The frequency below which a specified percentage (usually 85%) of the total spectral energy lies.
|
|
16
|
+
spectralBandwidth: number // The width of the spectrum, indicating the range of frequencies present.
|
|
17
|
+
chromagram: number[] // Chromagram, representing the 12 different pitch classes of the audio.
|
|
18
|
+
tempo: number // Estimated tempo of the audio signal, measured in beats per minute (BPM).
|
|
19
|
+
hnr: number // Harmonics-to-noise ratio, indicating the proportion of harmonics to noise in the audio signal.
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Options to specify which audio features to extract.
|
|
24
|
+
*/
|
|
25
|
+
export interface AudioFeaturesOptions {
|
|
26
|
+
energy?: boolean
|
|
27
|
+
mfcc?: boolean
|
|
28
|
+
rms?: boolean
|
|
29
|
+
zcr?: boolean
|
|
30
|
+
spectralCentroid?: boolean
|
|
31
|
+
spectralFlatness?: boolean
|
|
32
|
+
spectralRolloff?: boolean
|
|
33
|
+
spectralBandwidth?: boolean
|
|
34
|
+
chromagram?: boolean
|
|
35
|
+
tempo?: boolean
|
|
36
|
+
hnr?: boolean
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Represents a single data point in the audio analysis.
|
|
41
|
+
*/
|
|
42
|
+
export interface DataPoint {
|
|
43
|
+
id: number
|
|
44
|
+
amplitude: number
|
|
45
|
+
activeSpeech?: boolean
|
|
46
|
+
dB?: number
|
|
47
|
+
silent?: boolean
|
|
48
|
+
features?: AudioFeatures
|
|
49
|
+
startTime?: number
|
|
50
|
+
endTime?: number
|
|
51
|
+
// start / end position in bytes
|
|
52
|
+
startPosition?: number
|
|
53
|
+
endPosition?: number
|
|
54
|
+
// number of audio samples for this point (samples size depends on bit depth)
|
|
55
|
+
samples?: number
|
|
56
|
+
// TODO: speaker detection
|
|
57
|
+
speaker?: number
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type AmplitudeAlgorithm = 'peak' | 'rms'
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Represents the complete data from the audio analysis.
|
|
64
|
+
*/
|
|
65
|
+
export interface AudioAnalysis {
|
|
66
|
+
pointsPerSecond: number // How many consolidated value per second
|
|
67
|
+
durationMs: number // Duration of the audio in milliseconds
|
|
68
|
+
bitDepth: number // Bit depth of the audio
|
|
69
|
+
samples: number // Size of the audio in bytes
|
|
70
|
+
numberOfChannels: number // Number of audio channels
|
|
71
|
+
sampleRate: number // Sample rate of the audio
|
|
72
|
+
dataPoints: DataPoint[] // Array of data points from the analysis.
|
|
73
|
+
amplitudeAlgorithm: AmplitudeAlgorithm // Algorithm used to calculate amplitude values.
|
|
74
|
+
amplitudeRange: {
|
|
75
|
+
min: number
|
|
76
|
+
max: number
|
|
77
|
+
}
|
|
78
|
+
// TODO: speaker detection
|
|
79
|
+
speakerChanges?: {
|
|
80
|
+
timestamp: number // Timestamp of the speaker change in milliseconds.
|
|
81
|
+
speaker: number // Speaker identifier.
|
|
82
|
+
}[]
|
|
83
|
+
}
|
|
84
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// packages/expo-audio-stream/src/AudioAnalysis/extractAudioAnalysis.ts
|
|
2
|
+
import {
|
|
3
|
+
AmplitudeAlgorithm,
|
|
4
|
+
AudioAnalysis,
|
|
5
|
+
AudioFeaturesOptions,
|
|
6
|
+
} from './AudioAnalysis.types'
|
|
7
|
+
import ExpoAudioStreamModule from '../ExpoAudioStreamModule'
|
|
8
|
+
import { isWeb } from '../constants'
|
|
9
|
+
import { getLogger } from '../logger'
|
|
10
|
+
import { convertPCMToFloat32 } from '../utils/convertPCMToFloat32'
|
|
11
|
+
import { getWavFileInfo, WavFileInfo } from '../utils/getWavFileInfo'
|
|
12
|
+
import { InlineFeaturesExtractor } from '../workers/InlineFeaturesExtractor.web'
|
|
13
|
+
|
|
14
|
+
const logger = getLogger('extractAudioAnalysis')
|
|
15
|
+
|
|
16
|
+
export interface ExtractAudioAnalysisProps {
|
|
17
|
+
fileUri?: string // should provide either fileUri or arrayBuffer
|
|
18
|
+
wavMetadata?: WavFileInfo
|
|
19
|
+
arrayBuffer?: ArrayBuffer
|
|
20
|
+
bitDepth?: number
|
|
21
|
+
skipWavHeader?: boolean
|
|
22
|
+
durationMs?: number
|
|
23
|
+
sampleRate?: number
|
|
24
|
+
numberOfChannels?: number
|
|
25
|
+
algorithm?: AmplitudeAlgorithm
|
|
26
|
+
position?: number // Optional number of bytes to skip. Default is 0
|
|
27
|
+
length?: number // Optional number of bytes to read.
|
|
28
|
+
pointsPerSecond?: number // Optional number of points per second. Use to reduce the number of points and compute the number of datapoints to return.
|
|
29
|
+
features?: AudioFeaturesOptions
|
|
30
|
+
featuresExtratorUrl?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const extractAudioAnalysis = async ({
|
|
34
|
+
fileUri,
|
|
35
|
+
pointsPerSecond = 20,
|
|
36
|
+
arrayBuffer,
|
|
37
|
+
bitDepth,
|
|
38
|
+
skipWavHeader = true,
|
|
39
|
+
durationMs,
|
|
40
|
+
sampleRate,
|
|
41
|
+
numberOfChannels,
|
|
42
|
+
algorithm = 'rms',
|
|
43
|
+
features,
|
|
44
|
+
featuresExtratorUrl,
|
|
45
|
+
}: ExtractAudioAnalysisProps): Promise<AudioAnalysis> => {
|
|
46
|
+
if (isWeb) {
|
|
47
|
+
if (!arrayBuffer && !fileUri) {
|
|
48
|
+
throw new Error('Either arrayBuffer or fileUri must be provided')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!arrayBuffer) {
|
|
52
|
+
logger.log(`fetching fileUri`, fileUri)
|
|
53
|
+
const response = await fetch(fileUri!)
|
|
54
|
+
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Failed to fetch fileUri: ${response.statusText}`
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
arrayBuffer = await response.arrayBuffer()
|
|
62
|
+
logger.log(`fetched fileUri`, arrayBuffer.byteLength, arrayBuffer)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Create a new copy of the ArrayBuffer to avoid detachment issues
|
|
66
|
+
const bufferCopy = arrayBuffer.slice(0)
|
|
67
|
+
logger.log(
|
|
68
|
+
`extractAudioAnalysis skipWavHeader=${skipWavHeader} bitDepth=${bitDepth} len=${bufferCopy.byteLength}`,
|
|
69
|
+
bufferCopy.slice(0, 100)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
let actualBitDepth = bitDepth
|
|
73
|
+
if (!actualBitDepth) {
|
|
74
|
+
logger.log(
|
|
75
|
+
`extractAudioAnalysis bitDepth not provided -- getting wav file info`
|
|
76
|
+
)
|
|
77
|
+
const fileInfo = await getWavFileInfo(bufferCopy)
|
|
78
|
+
actualBitDepth = fileInfo.bitDepth
|
|
79
|
+
}
|
|
80
|
+
logger.log(`extractAudioAnalysis actualBitDepth=${actualBitDepth}`)
|
|
81
|
+
|
|
82
|
+
const {
|
|
83
|
+
pcmValues: channelData,
|
|
84
|
+
min,
|
|
85
|
+
max,
|
|
86
|
+
} = await convertPCMToFloat32({
|
|
87
|
+
buffer: arrayBuffer,
|
|
88
|
+
bitDepth: actualBitDepth,
|
|
89
|
+
skipWavHeader,
|
|
90
|
+
})
|
|
91
|
+
logger.log(
|
|
92
|
+
`extractAudioAnalysis skipWaveHeader=${skipWavHeader} convertPCMToFloat32 length=${channelData.length} range: [ ${min} :: ${max} ]`
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return new Promise((resolve, reject) => {
|
|
96
|
+
let worker: Worker
|
|
97
|
+
if (featuresExtratorUrl) {
|
|
98
|
+
worker = new Worker(
|
|
99
|
+
new URL(featuresExtratorUrl, window.location.href)
|
|
100
|
+
)
|
|
101
|
+
} else {
|
|
102
|
+
const blob = new Blob([InlineFeaturesExtractor], {
|
|
103
|
+
type: 'application/javascript',
|
|
104
|
+
})
|
|
105
|
+
const url = URL.createObjectURL(blob)
|
|
106
|
+
worker = new Worker(url)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
worker.onmessage = (event) => {
|
|
110
|
+
resolve(event.data.result)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
worker.onerror = (error) => {
|
|
114
|
+
reject(error)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
worker.postMessage({
|
|
118
|
+
command: 'process',
|
|
119
|
+
channelData,
|
|
120
|
+
sampleRate,
|
|
121
|
+
pointsPerSecond,
|
|
122
|
+
algorithm,
|
|
123
|
+
bitDepth,
|
|
124
|
+
fullAudioDurationMs: durationMs,
|
|
125
|
+
numberOfChannels,
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
} else {
|
|
129
|
+
if (!fileUri) {
|
|
130
|
+
throw new Error('fileUri is required')
|
|
131
|
+
}
|
|
132
|
+
logger.log(`extractAudioAnalysis`, {
|
|
133
|
+
fileUri,
|
|
134
|
+
pointsPerSecond,
|
|
135
|
+
algorithm,
|
|
136
|
+
})
|
|
137
|
+
const res = await ExpoAudioStreamModule.extractAudioAnalysis({
|
|
138
|
+
fileUri,
|
|
139
|
+
pointsPerSecond,
|
|
140
|
+
skipWavHeader,
|
|
141
|
+
algorithm,
|
|
142
|
+
features,
|
|
143
|
+
})
|
|
144
|
+
logger.log(`extractAudioAnalysis`, res)
|
|
145
|
+
return res
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import ExpoAudioStreamModule from '../ExpoAudioStreamModule'
|
|
2
|
+
import { getLogger } from '../logger'
|
|
3
|
+
|
|
4
|
+
const logger = getLogger('extractWaveform')
|
|
5
|
+
export interface ExtractWaveformProps {
|
|
6
|
+
fileUri: string
|
|
7
|
+
numberOfSamples: number
|
|
8
|
+
offset?: number
|
|
9
|
+
length?: number
|
|
10
|
+
}
|
|
11
|
+
export const extractWaveform = async ({
|
|
12
|
+
fileUri,
|
|
13
|
+
numberOfSamples,
|
|
14
|
+
offset = 0,
|
|
15
|
+
length,
|
|
16
|
+
}: ExtractWaveformProps): Promise<unknown> => {
|
|
17
|
+
const res = await ExpoAudioStreamModule.extractAudioAnalysis({
|
|
18
|
+
fileUri,
|
|
19
|
+
numberOfSamples,
|
|
20
|
+
offset,
|
|
21
|
+
length,
|
|
22
|
+
})
|
|
23
|
+
logger.log(`extractWaveform`, res)
|
|
24
|
+
return res
|
|
25
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// packages/expo-audio-stream/src/AudioRecorder.provider.tsx
|
|
2
|
+
import React, { createContext, useContext } from 'react'
|
|
3
|
+
|
|
4
|
+
import { UseAudioRecorderState } from './ExpoAudioStream.types'
|
|
5
|
+
import { UseAudioRecorderProps, useAudioRecorder } from './useAudioRecorder'
|
|
6
|
+
|
|
7
|
+
const initContext: UseAudioRecorderState = {
|
|
8
|
+
isRecording: false,
|
|
9
|
+
isPaused: false,
|
|
10
|
+
durationMs: 0,
|
|
11
|
+
size: 0,
|
|
12
|
+
startRecording: async () => {
|
|
13
|
+
throw new Error('AudioRecorderProvider not found')
|
|
14
|
+
},
|
|
15
|
+
stopRecording: async () => {
|
|
16
|
+
throw new Error('AudioRecorderProvider not found')
|
|
17
|
+
},
|
|
18
|
+
pauseRecording: () => {
|
|
19
|
+
throw new Error('AudioRecorderProvider not found')
|
|
20
|
+
},
|
|
21
|
+
resumeRecording: () => {
|
|
22
|
+
throw new Error('AudioRecorderProvider not found')
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AudioRecorderContext = createContext<UseAudioRecorderState>(initContext)
|
|
27
|
+
|
|
28
|
+
interface AudioRecorderProviderProps {
|
|
29
|
+
children: React.ReactNode
|
|
30
|
+
config?: UseAudioRecorderProps
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const AudioRecorderProvider: React.FC<AudioRecorderProviderProps> = ({
|
|
34
|
+
children,
|
|
35
|
+
config = {},
|
|
36
|
+
}) => {
|
|
37
|
+
const audioRecorder = useAudioRecorder(config)
|
|
38
|
+
return (
|
|
39
|
+
<AudioRecorderContext.Provider value={audioRecorder}>
|
|
40
|
+
{children}
|
|
41
|
+
</AudioRecorderContext.Provider>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const useSharedAudioRecorder = () => {
|
|
46
|
+
const context = useContext(AudioRecorderContext)
|
|
47
|
+
if (!context) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
'useSharedAudioRecorder must be used within an AudioRecorderProvider'
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
return context
|
|
53
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/ExpoAudioStreamModule.ts
|
|
2
|
+
import { requireNativeModule } from 'expo-modules-core'
|
|
3
|
+
|
|
4
|
+
// It loads the native module object from the JSI or falls back to
|
|
5
|
+
// the bridge module (from NativeModulesProxy) if the remote debugger is on.
|
|
6
|
+
export default requireNativeModule('ExpoAudioStream')
|