@siteed/expo-audio-studio 2.18.6 → 3.0.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.
Files changed (329) hide show
  1. package/README.md +13 -297
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/package.json +6 -135
  5. package/CHANGELOG.md +0 -501
  6. package/LICENSE +0 -21
  7. package/android/build.gradle +0 -129
  8. package/android/src/androidTest/assets/chorus.wav +0 -0
  9. package/android/src/androidTest/assets/jfk.wav +0 -0
  10. package/android/src/androidTest/assets/osr_us_000_0010_8k.wav +0 -0
  11. package/android/src/androidTest/assets/recorder_hello_world.wav +0 -0
  12. package/android/src/androidTest/java/net/siteed/audiostream/AudioProcessorInstrumentedTest.kt +0 -197
  13. package/android/src/androidTest/java/net/siteed/audiostream/AudioRecorderInstrumentedTest.kt +0 -541
  14. package/android/src/androidTest/java/net/siteed/audiostream/AudioRecorderPerformanceInstrumentedTest.kt +0 -234
  15. package/android/src/androidTest/java/net/siteed/audiostream/integration/AudioFocusStrategyIntegrationTest.kt +0 -332
  16. package/android/src/androidTest/java/net/siteed/audiostream/integration/BufferDurationIntegrationTest.kt +0 -324
  17. package/android/src/androidTest/java/net/siteed/audiostream/integration/CompressedOnlyOutputTest.kt +0 -253
  18. package/android/src/androidTest/java/net/siteed/audiostream/integration/DeviceDisconnectionFallbackTest.kt +0 -218
  19. package/android/src/androidTest/java/net/siteed/audiostream/integration/EventEmissionIntervalTest.kt +0 -120
  20. package/android/src/androidTest/java/net/siteed/audiostream/integration/M4aFormatTest.kt +0 -345
  21. package/android/src/androidTest/java/net/siteed/audiostream/integration/OutputControlIntegrationTest.kt +0 -340
  22. package/android/src/androidTest/java/net/siteed/audiostream/integration/PcmStreamingDurationTest.kt +0 -252
  23. package/android/src/androidTest/java/net/siteed/audiostream/integration/README.md +0 -95
  24. package/android/src/androidTest/java/net/siteed/audiostream/integration/run_integration_tests.sh +0 -43
  25. package/android/src/main/AndroidManifest.xml +0 -30
  26. package/android/src/main/java/net/siteed/audiostream/AudioAnalysisData.kt +0 -188
  27. package/android/src/main/java/net/siteed/audiostream/AudioDataEncoder.kt +0 -9
  28. package/android/src/main/java/net/siteed/audiostream/AudioDeviceManager.kt +0 -1741
  29. package/android/src/main/java/net/siteed/audiostream/AudioFileHandler.kt +0 -136
  30. package/android/src/main/java/net/siteed/audiostream/AudioFormatUtils.kt +0 -354
  31. package/android/src/main/java/net/siteed/audiostream/AudioNotificationsManager.kt +0 -439
  32. package/android/src/main/java/net/siteed/audiostream/AudioProcessor.kt +0 -2237
  33. package/android/src/main/java/net/siteed/audiostream/AudioRecorderManager.kt +0 -2141
  34. package/android/src/main/java/net/siteed/audiostream/AudioRecordingService.kt +0 -167
  35. package/android/src/main/java/net/siteed/audiostream/AudioTrimmer.kt +0 -1099
  36. package/android/src/main/java/net/siteed/audiostream/Constants.kt +0 -37
  37. package/android/src/main/java/net/siteed/audiostream/EventSender.kt +0 -7
  38. package/android/src/main/java/net/siteed/audiostream/ExpoAudioStreamModule.kt +0 -1113
  39. package/android/src/main/java/net/siteed/audiostream/FFT.kt +0 -99
  40. package/android/src/main/java/net/siteed/audiostream/Features.kt +0 -98
  41. package/android/src/main/java/net/siteed/audiostream/LogUtils.kt +0 -93
  42. package/android/src/main/java/net/siteed/audiostream/NotificationConfig.kt +0 -72
  43. package/android/src/main/java/net/siteed/audiostream/PermissionUtils.kt +0 -68
  44. package/android/src/main/java/net/siteed/audiostream/RecordingActionReceiver.kt +0 -59
  45. package/android/src/main/java/net/siteed/audiostream/RecordingConfig.kt +0 -257
  46. package/android/src/main/java/net/siteed/audiostream/WaveformConfig.kt +0 -19
  47. package/android/src/main/java/net/siteed/audiostream/WaveformRenderer.kt +0 -159
  48. package/android/src/main/res/drawable/ic_default_action_icon.xml +0 -16
  49. package/android/src/main/res/drawable/ic_microphone.xml +0 -13
  50. package/android/src/main/res/drawable/ic_pause.xml +0 -10
  51. package/android/src/main/res/drawable/ic_play.xml +0 -10
  52. package/android/src/main/res/drawable/ic_stop.xml +0 -10
  53. package/android/src/main/res/layout/notification_recording.xml +0 -37
  54. package/android/src/test/java/net/siteed/audiostream/AudioFileHandlerTest.kt +0 -279
  55. package/android/src/test/java/net/siteed/audiostream/AudioFocusStrategyTest.kt +0 -249
  56. package/android/src/test/java/net/siteed/audiostream/AudioFormatTest.kt +0 -151
  57. package/android/src/test/java/net/siteed/audiostream/AudioFormatUtilsTest.kt +0 -273
  58. package/android/src/test/java/net/siteed/audiostream/DeviceDisconnectionFallbackUnitTest.kt +0 -140
  59. package/android/src/test/resources/chorus.wav +0 -0
  60. package/android/src/test/resources/generate_test_audio.py +0 -94
  61. package/android/src/test/resources/jfk.wav +0 -0
  62. package/android/src/test/resources/osr_us_000_0010_8k.wav +0 -0
  63. package/android/src/test/resources/recorder_hello_world.wav +0 -0
  64. package/app.plugin.js +0 -3
  65. package/build/cjs/AudioAnalysis/AudioAnalysis.types.js +0 -4
  66. package/build/cjs/AudioAnalysis/AudioAnalysis.types.js.map +0 -1
  67. package/build/cjs/AudioAnalysis/extractAudioAnalysis.js +0 -210
  68. package/build/cjs/AudioAnalysis/extractAudioAnalysis.js.map +0 -1
  69. package/build/cjs/AudioAnalysis/extractAudioData.js +0 -21
  70. package/build/cjs/AudioAnalysis/extractAudioData.js.map +0 -1
  71. package/build/cjs/AudioAnalysis/extractMelSpectrogram.js +0 -92
  72. package/build/cjs/AudioAnalysis/extractMelSpectrogram.js.map +0 -1
  73. package/build/cjs/AudioAnalysis/extractPreview.js +0 -28
  74. package/build/cjs/AudioAnalysis/extractPreview.js.map +0 -1
  75. package/build/cjs/AudioAnalysis/extractWaveform.js +0 -18
  76. package/build/cjs/AudioAnalysis/extractWaveform.js.map +0 -1
  77. package/build/cjs/AudioDeviceManager.js +0 -689
  78. package/build/cjs/AudioDeviceManager.js.map +0 -1
  79. package/build/cjs/AudioRecorder.provider.js +0 -78
  80. package/build/cjs/AudioRecorder.provider.js.map +0 -1
  81. package/build/cjs/ExpoAudioStream.native.js +0 -8
  82. package/build/cjs/ExpoAudioStream.native.js.map +0 -1
  83. package/build/cjs/ExpoAudioStream.types.js +0 -11
  84. package/build/cjs/ExpoAudioStream.types.js.map +0 -1
  85. package/build/cjs/ExpoAudioStream.web.js +0 -708
  86. package/build/cjs/ExpoAudioStream.web.js.map +0 -1
  87. package/build/cjs/ExpoAudioStreamModule.js +0 -718
  88. package/build/cjs/ExpoAudioStreamModule.js.map +0 -1
  89. package/build/cjs/WebRecorder.web.js +0 -777
  90. package/build/cjs/WebRecorder.web.js.map +0 -1
  91. package/build/cjs/constants/platformLimitations.js +0 -99
  92. package/build/cjs/constants/platformLimitations.js.map +0 -1
  93. package/build/cjs/constants.js +0 -17
  94. package/build/cjs/constants.js.map +0 -1
  95. package/build/cjs/events.js +0 -29
  96. package/build/cjs/events.js.map +0 -1
  97. package/build/cjs/hooks/useAudioDevices.js +0 -179
  98. package/build/cjs/hooks/useAudioDevices.js.map +0 -1
  99. package/build/cjs/index.js +0 -58
  100. package/build/cjs/index.js.map +0 -1
  101. package/build/cjs/trimAudio.js +0 -76
  102. package/build/cjs/trimAudio.js.map +0 -1
  103. package/build/cjs/useAudioRecorder.js +0 -518
  104. package/build/cjs/useAudioRecorder.js.map +0 -1
  105. package/build/cjs/utils/BlobFix.js +0 -502
  106. package/build/cjs/utils/BlobFix.js.map +0 -1
  107. package/build/cjs/utils/audioProcessing.js +0 -136
  108. package/build/cjs/utils/audioProcessing.js.map +0 -1
  109. package/build/cjs/utils/cleanNativeOptions.js +0 -22
  110. package/build/cjs/utils/cleanNativeOptions.js.map +0 -1
  111. package/build/cjs/utils/concatenateBuffers.js +0 -25
  112. package/build/cjs/utils/concatenateBuffers.js.map +0 -1
  113. package/build/cjs/utils/convertPCMToFloat32.js +0 -124
  114. package/build/cjs/utils/convertPCMToFloat32.js.map +0 -1
  115. package/build/cjs/utils/crc32.js +0 -52
  116. package/build/cjs/utils/crc32.js.map +0 -1
  117. package/build/cjs/utils/encodingToBitDepth.js +0 -17
  118. package/build/cjs/utils/encodingToBitDepth.js.map +0 -1
  119. package/build/cjs/utils/getWavFileInfo.js +0 -96
  120. package/build/cjs/utils/getWavFileInfo.js.map +0 -1
  121. package/build/cjs/utils/writeWavHeader.js +0 -88
  122. package/build/cjs/utils/writeWavHeader.js.map +0 -1
  123. package/build/cjs/workers/InlineFeaturesExtractor.web.js +0 -859
  124. package/build/cjs/workers/InlineFeaturesExtractor.web.js.map +0 -1
  125. package/build/cjs/workers/inlineAudioWebWorker.web.js +0 -184
  126. package/build/cjs/workers/inlineAudioWebWorker.web.js.map +0 -1
  127. package/build/esm/AudioAnalysis/AudioAnalysis.types.js +0 -3
  128. package/build/esm/AudioAnalysis/AudioAnalysis.types.js.map +0 -1
  129. package/build/esm/AudioAnalysis/extractAudioAnalysis.js +0 -202
  130. package/build/esm/AudioAnalysis/extractAudioAnalysis.js.map +0 -1
  131. package/build/esm/AudioAnalysis/extractAudioData.js +0 -14
  132. package/build/esm/AudioAnalysis/extractAudioData.js.map +0 -1
  133. package/build/esm/AudioAnalysis/extractMelSpectrogram.js +0 -89
  134. package/build/esm/AudioAnalysis/extractMelSpectrogram.js.map +0 -1
  135. package/build/esm/AudioAnalysis/extractPreview.js +0 -25
  136. package/build/esm/AudioAnalysis/extractPreview.js.map +0 -1
  137. package/build/esm/AudioAnalysis/extractWaveform.js +0 -11
  138. package/build/esm/AudioAnalysis/extractWaveform.js.map +0 -1
  139. package/build/esm/AudioDeviceManager.js +0 -682
  140. package/build/esm/AudioDeviceManager.js.map +0 -1
  141. package/build/esm/AudioRecorder.provider.js +0 -40
  142. package/build/esm/AudioRecorder.provider.js.map +0 -1
  143. package/build/esm/ExpoAudioStream.native.js +0 -6
  144. package/build/esm/ExpoAudioStream.native.js.map +0 -1
  145. package/build/esm/ExpoAudioStream.types.js +0 -8
  146. package/build/esm/ExpoAudioStream.types.js.map +0 -1
  147. package/build/esm/ExpoAudioStream.web.js +0 -704
  148. package/build/esm/ExpoAudioStream.web.js.map +0 -1
  149. package/build/esm/ExpoAudioStreamModule.js +0 -713
  150. package/build/esm/ExpoAudioStreamModule.js.map +0 -1
  151. package/build/esm/WebRecorder.web.js +0 -773
  152. package/build/esm/WebRecorder.web.js.map +0 -1
  153. package/build/esm/constants/platformLimitations.js +0 -90
  154. package/build/esm/constants/platformLimitations.js.map +0 -1
  155. package/build/esm/constants.js +0 -14
  156. package/build/esm/constants.js.map +0 -1
  157. package/build/esm/events.js +0 -21
  158. package/build/esm/events.js.map +0 -1
  159. package/build/esm/hooks/useAudioDevices.js +0 -176
  160. package/build/esm/hooks/useAudioDevices.js.map +0 -1
  161. package/build/esm/index.js +0 -20
  162. package/build/esm/index.js.map +0 -1
  163. package/build/esm/trimAudio.js +0 -69
  164. package/build/esm/trimAudio.js.map +0 -1
  165. package/build/esm/useAudioRecorder.js +0 -512
  166. package/build/esm/useAudioRecorder.js.map +0 -1
  167. package/build/esm/utils/BlobFix.js +0 -498
  168. package/build/esm/utils/BlobFix.js.map +0 -1
  169. package/build/esm/utils/audioProcessing.js +0 -133
  170. package/build/esm/utils/audioProcessing.js.map +0 -1
  171. package/build/esm/utils/cleanNativeOptions.js +0 -19
  172. package/build/esm/utils/cleanNativeOptions.js.map +0 -1
  173. package/build/esm/utils/concatenateBuffers.js +0 -21
  174. package/build/esm/utils/concatenateBuffers.js.map +0 -1
  175. package/build/esm/utils/convertPCMToFloat32.js +0 -120
  176. package/build/esm/utils/convertPCMToFloat32.js.map +0 -1
  177. package/build/esm/utils/crc32.js +0 -50
  178. package/build/esm/utils/crc32.js.map +0 -1
  179. package/build/esm/utils/encodingToBitDepth.js +0 -13
  180. package/build/esm/utils/encodingToBitDepth.js.map +0 -1
  181. package/build/esm/utils/getWavFileInfo.js +0 -92
  182. package/build/esm/utils/getWavFileInfo.js.map +0 -1
  183. package/build/esm/utils/writeWavHeader.js +0 -84
  184. package/build/esm/utils/writeWavHeader.js.map +0 -1
  185. package/build/esm/workers/InlineFeaturesExtractor.web.js +0 -856
  186. package/build/esm/workers/InlineFeaturesExtractor.web.js.map +0 -1
  187. package/build/esm/workers/inlineAudioWebWorker.web.js +0 -181
  188. package/build/esm/workers/inlineAudioWebWorker.web.js.map +0 -1
  189. package/build/types/AudioAnalysis/AudioAnalysis.types.d.ts +0 -196
  190. package/build/types/AudioAnalysis/AudioAnalysis.types.d.ts.map +0 -1
  191. package/build/types/AudioAnalysis/extractAudioAnalysis.d.ts +0 -74
  192. package/build/types/AudioAnalysis/extractAudioAnalysis.d.ts.map +0 -1
  193. package/build/types/AudioAnalysis/extractAudioData.d.ts +0 -3
  194. package/build/types/AudioAnalysis/extractAudioData.d.ts.map +0 -1
  195. package/build/types/AudioAnalysis/extractMelSpectrogram.d.ts +0 -14
  196. package/build/types/AudioAnalysis/extractMelSpectrogram.d.ts.map +0 -1
  197. package/build/types/AudioAnalysis/extractPreview.d.ts +0 -11
  198. package/build/types/AudioAnalysis/extractPreview.d.ts.map +0 -1
  199. package/build/types/AudioAnalysis/extractWaveform.d.ts +0 -8
  200. package/build/types/AudioAnalysis/extractWaveform.d.ts.map +0 -1
  201. package/build/types/AudioDeviceManager.d.ts +0 -187
  202. package/build/types/AudioDeviceManager.d.ts.map +0 -1
  203. package/build/types/AudioRecorder.provider.d.ts +0 -11
  204. package/build/types/AudioRecorder.provider.d.ts.map +0 -1
  205. package/build/types/ExpoAudioStream.native.d.ts +0 -3
  206. package/build/types/ExpoAudioStream.native.d.ts.map +0 -1
  207. package/build/types/ExpoAudioStream.types.d.ts +0 -738
  208. package/build/types/ExpoAudioStream.types.d.ts.map +0 -1
  209. package/build/types/ExpoAudioStream.web.d.ts +0 -96
  210. package/build/types/ExpoAudioStream.web.d.ts.map +0 -1
  211. package/build/types/ExpoAudioStreamModule.d.ts +0 -3
  212. package/build/types/ExpoAudioStreamModule.d.ts.map +0 -1
  213. package/build/types/WebRecorder.web.d.ts +0 -198
  214. package/build/types/WebRecorder.web.d.ts.map +0 -1
  215. package/build/types/constants/platformLimitations.d.ts +0 -40
  216. package/build/types/constants/platformLimitations.d.ts.map +0 -1
  217. package/build/types/constants.d.ts +0 -11
  218. package/build/types/constants.d.ts.map +0 -1
  219. package/build/types/events.d.ts +0 -26
  220. package/build/types/events.d.ts.map +0 -1
  221. package/build/types/hooks/useAudioDevices.d.ts +0 -15
  222. package/build/types/hooks/useAudioDevices.d.ts.map +0 -1
  223. package/build/types/index.d.ts +0 -18
  224. package/build/types/index.d.ts.map +0 -1
  225. package/build/types/trimAudio.d.ts +0 -25
  226. package/build/types/trimAudio.d.ts.map +0 -1
  227. package/build/types/useAudioRecorder.d.ts +0 -22
  228. package/build/types/useAudioRecorder.d.ts.map +0 -1
  229. package/build/types/utils/BlobFix.d.ts +0 -9
  230. package/build/types/utils/BlobFix.d.ts.map +0 -1
  231. package/build/types/utils/audioProcessing.d.ts +0 -24
  232. package/build/types/utils/audioProcessing.d.ts.map +0 -1
  233. package/build/types/utils/cleanNativeOptions.d.ts +0 -15
  234. package/build/types/utils/cleanNativeOptions.d.ts.map +0 -1
  235. package/build/types/utils/concatenateBuffers.d.ts +0 -8
  236. package/build/types/utils/concatenateBuffers.d.ts.map +0 -1
  237. package/build/types/utils/convertPCMToFloat32.d.ts +0 -13
  238. package/build/types/utils/convertPCMToFloat32.d.ts.map +0 -1
  239. package/build/types/utils/crc32.d.ts +0 -7
  240. package/build/types/utils/crc32.d.ts.map +0 -1
  241. package/build/types/utils/encodingToBitDepth.d.ts +0 -5
  242. package/build/types/utils/encodingToBitDepth.d.ts.map +0 -1
  243. package/build/types/utils/getWavFileInfo.d.ts +0 -26
  244. package/build/types/utils/getWavFileInfo.d.ts.map +0 -1
  245. package/build/types/utils/writeWavHeader.d.ts +0 -34
  246. package/build/types/utils/writeWavHeader.d.ts.map +0 -1
  247. package/build/types/workers/InlineFeaturesExtractor.web.d.ts +0 -2
  248. package/build/types/workers/InlineFeaturesExtractor.web.d.ts.map +0 -1
  249. package/build/types/workers/inlineAudioWebWorker.web.d.ts +0 -2
  250. package/build/types/workers/inlineAudioWebWorker.web.d.ts.map +0 -1
  251. package/expo-module.config.json +0 -10
  252. package/ios/AudioAnalysisData.swift +0 -74
  253. package/ios/AudioDeviceManager.swift +0 -670
  254. package/ios/AudioNotificationManager.swift +0 -154
  255. package/ios/AudioProcessingHelpers.swift +0 -743
  256. package/ios/AudioProcessor.swift +0 -1151
  257. package/ios/AudioStreamError.swift +0 -7
  258. package/ios/AudioStreamManager.swift +0 -2369
  259. package/ios/AudioStreamManagerDelegate.swift +0 -16
  260. package/ios/DataPoint.swift +0 -54
  261. package/ios/DecodingConfig.swift +0 -59
  262. package/ios/ExpoAudioStream.podspec +0 -33
  263. package/ios/ExpoAudioStreamModule.swift +0 -1019
  264. package/ios/ExpoAudioStudioTests/AudioFileHandlerTests.swift +0 -338
  265. package/ios/ExpoAudioStudioTests/AudioFormatUtilsTests.swift +0 -331
  266. package/ios/ExpoAudioStudioTests/AudioTestHelpers.swift +0 -130
  267. package/ios/ExpoAudioStudioTests/CompressedOnlyOutputTests.swift +0 -294
  268. package/ios/ExpoAudioStudioTests/EventEmissionIntervalTests.swift +0 -105
  269. package/ios/ExpoAudioStudioTests/Info.plist +0 -22
  270. package/ios/ExpoAudioStudioTests/README.md +0 -39
  271. package/ios/ExpoAudioStudioTests/SimpleAudioTest.swift +0 -98
  272. package/ios/ExpoAudioStudioTests/TestAudioGenerator.swift +0 -75
  273. package/ios/FFT.swift +0 -62
  274. package/ios/Features.swift +0 -95
  275. package/ios/ISSUE_IOS.md +0 -68
  276. package/ios/Logger.swift +0 -39
  277. package/ios/NotificationExtension.swift +0 -15
  278. package/ios/RecordingResult.swift +0 -22
  279. package/ios/RecordingSettings.swift +0 -308
  280. package/ios/WaveformExtractor.swift +0 -105
  281. package/ios/tests/README.md +0 -41
  282. package/ios/tests/integration/buffer_and_fallback_test.swift +0 -178
  283. package/ios/tests/integration/buffer_duration_test.swift +0 -185
  284. package/ios/tests/integration/compressed_only_output_test.swift +0 -271
  285. package/ios/tests/integration/output_control_test.swift +0 -322
  286. package/ios/tests/integration/run_integration_tests.sh +0 -37
  287. package/ios/tests/opus_support_test_macos.swift +0 -154
  288. package/ios/tests/standalone/audio_processing_test.swift +0 -144
  289. package/ios/tests/standalone/audio_recording_test.swift +0 -277
  290. package/ios/tests/standalone/audio_streaming_test.swift +0 -249
  291. package/ios/tests/standalone/standalone_test.swift +0 -144
  292. package/plugin/build/index.cjs +0 -194
  293. package/plugin/build/index.d.cts +0 -22
  294. package/plugin/build/index.js +0 -194
  295. package/plugin/src/index.ts +0 -285
  296. package/plugin/tsconfig.json +0 -10
  297. package/plugin/tsconfig.tsbuildinfo +0 -1
  298. package/src/AudioAnalysis/AudioAnalysis.types.ts +0 -224
  299. package/src/AudioAnalysis/extractAudioAnalysis.ts +0 -344
  300. package/src/AudioAnalysis/extractAudioData.ts +0 -17
  301. package/src/AudioAnalysis/extractMelSpectrogram.ts +0 -154
  302. package/src/AudioAnalysis/extractPreview.ts +0 -34
  303. package/src/AudioAnalysis/extractWaveform.ts +0 -22
  304. package/src/AudioDeviceManager.ts +0 -803
  305. package/src/AudioRecorder.provider.tsx +0 -57
  306. package/src/ExpoAudioStream.native.ts +0 -6
  307. package/src/ExpoAudioStream.types.ts +0 -874
  308. package/src/ExpoAudioStream.web.ts +0 -905
  309. package/src/ExpoAudioStreamModule.ts +0 -990
  310. package/src/WebRecorder.web.ts +0 -1005
  311. package/src/constants/platformLimitations.ts +0 -118
  312. package/src/constants.ts +0 -18
  313. package/src/events.ts +0 -60
  314. package/src/hooks/useAudioDevices.ts +0 -213
  315. package/src/index.ts +0 -54
  316. package/src/trimAudio.ts +0 -94
  317. package/src/types/crc-32.d.ts +0 -9
  318. package/src/useAudioRecorder.tsx +0 -766
  319. package/src/utils/BlobFix.ts +0 -561
  320. package/src/utils/audioProcessing.ts +0 -205
  321. package/src/utils/cleanNativeOptions.ts +0 -18
  322. package/src/utils/concatenateBuffers.ts +0 -24
  323. package/src/utils/convertPCMToFloat32.ts +0 -170
  324. package/src/utils/crc32.ts +0 -59
  325. package/src/utils/encodingToBitDepth.ts +0 -18
  326. package/src/utils/getWavFileInfo.ts +0 -132
  327. package/src/utils/writeWavHeader.ts +0 -115
  328. package/src/workers/InlineFeaturesExtractor.web.tsx +0 -855
  329. package/src/workers/inlineAudioWebWorker.web.tsx +0 -180
@@ -1,118 +0,0 @@
1
- /**
2
- * Platform-specific audio recording limitations and capabilities
3
- */
4
-
5
- import { Platform } from 'react-native'
6
-
7
- import { EncodingType, BitDepth } from '../ExpoAudioStream.types'
8
-
9
- export interface PlatformCapabilities {
10
- supportedEncodings: EncodingType[]
11
- supportedBitDepths: BitDepth[]
12
- notes: string[]
13
- }
14
-
15
- export const PLATFORM_CAPABILITIES: Record<string, PlatformCapabilities> = {
16
- ios: {
17
- supportedEncodings: ['pcm_16bit', 'pcm_32bit'],
18
- supportedBitDepths: [16, 32],
19
- notes: [
20
- '8-bit PCM is not natively supported by iOS AVAudioFormat',
21
- 'Recording with 8-bit will fallback to 16-bit',
22
- ],
23
- },
24
- android: {
25
- supportedEncodings: ['pcm_8bit', 'pcm_16bit', 'pcm_32bit'],
26
- supportedBitDepths: [8, 16, 32],
27
- notes: ['All PCM formats are fully supported'],
28
- },
29
- web: {
30
- supportedEncodings: ['pcm_16bit', 'pcm_32bit'],
31
- supportedBitDepths: [16, 32],
32
- notes: [
33
- 'Web Audio API typically works with 32-bit float',
34
- '8-bit is not commonly supported in browsers',
35
- ],
36
- },
37
- }
38
-
39
- /**
40
- * Get the current platform's audio capabilities
41
- */
42
- export function getPlatformCapabilities(): PlatformCapabilities {
43
- return PLATFORM_CAPABILITIES[Platform.OS] || PLATFORM_CAPABILITIES.web
44
- }
45
-
46
- /**
47
- * Check if a specific encoding is supported on the current platform
48
- */
49
- export function isEncodingSupported(encoding: EncodingType): boolean {
50
- const capabilities = getPlatformCapabilities()
51
- return capabilities.supportedEncodings.includes(encoding)
52
- }
53
-
54
- /**
55
- * Check if a specific bit depth is supported on the current platform
56
- */
57
- export function isBitDepthSupported(bitDepth: BitDepth): boolean {
58
- const capabilities = getPlatformCapabilities()
59
- return capabilities.supportedBitDepths.includes(bitDepth)
60
- }
61
-
62
- /**
63
- * Get a fallback encoding if the requested one is not supported
64
- */
65
- export function getFallbackEncoding(
66
- requestedEncoding: EncodingType
67
- ): EncodingType {
68
- if (isEncodingSupported(requestedEncoding)) {
69
- return requestedEncoding
70
- }
71
-
72
- // Default fallback is 16-bit PCM (supported on all platforms)
73
- return 'pcm_16bit'
74
- }
75
-
76
- /**
77
- * Get a fallback bit depth if the requested one is not supported
78
- */
79
- export function getFallbackBitDepth(requestedBitDepth: BitDepth): BitDepth {
80
- if (isBitDepthSupported(requestedBitDepth)) {
81
- return requestedBitDepth
82
- }
83
-
84
- // Default fallback is 16-bit (supported on all platforms)
85
- return 16
86
- }
87
-
88
- /**
89
- * Validate and adjust recording configuration based on platform limitations
90
- */
91
- export function validateRecordingConfig(config: { encoding?: EncodingType }): {
92
- encoding: EncodingType
93
- warnings: string[]
94
- } {
95
- const warnings: string[] = []
96
- const capabilities = getPlatformCapabilities()
97
-
98
- let encoding = config.encoding || 'pcm_16bit'
99
-
100
- // Check if encoding is supported
101
- if (!isEncodingSupported(encoding)) {
102
- const fallback = getFallbackEncoding(encoding)
103
- warnings.push(
104
- `${encoding} is not supported on ${Platform.OS}. Using ${fallback} instead.`
105
- )
106
- encoding = fallback
107
- }
108
-
109
- // Add platform-specific notes if there were changes
110
- if (warnings.length > 0) {
111
- warnings.push(...capabilities.notes)
112
- }
113
-
114
- return {
115
- encoding,
116
- warnings,
117
- }
118
- }
package/src/constants.ts DELETED
@@ -1,18 +0,0 @@
1
- // packages/expo-audio-stream/src/constants.ts
2
- import { Platform } from 'react-native'
3
-
4
- import { BitDepth, SampleRate } from './ExpoAudioStream.types'
5
-
6
- export const isWeb = Platform.OS === 'web'
7
- export const DEBUG_NAMESPACE = 'expo-audio-stream'
8
-
9
- // Constants for identifying chunks in a WAV file
10
- export const RIFF_HEADER = 0x52494646 // "RIFF"
11
- export const WAVE_HEADER = 0x57415645 // "WAVE"
12
- export const FMT_CHUNK_ID = 0x666d7420 // "fmt "
13
- export const DATA_CHUNK_ID = 0x64617461 // "data"
14
- export const INFO_CHUNK_ID = 0x494e464f // "INFO"
15
-
16
- // Default values
17
- export const DEFAULT_SAMPLE_RATE: SampleRate = 16000
18
- export const DEFAULT_BIT_DEPTH: BitDepth = 32
package/src/events.ts DELETED
@@ -1,60 +0,0 @@
1
- // packages/expo-audio-stream/src/events.ts
2
-
3
- import { LegacyEventEmitter, type EventSubscription } from 'expo-modules-core'
4
-
5
- import { AudioAnalysis } from './AudioAnalysis/AudioAnalysis.types'
6
- import { RecordingInterruptionEvent } from './ExpoAudioStream.types'
7
- import ExpoAudioStreamModule from './ExpoAudioStreamModule'
8
-
9
- const emitter = new LegacyEventEmitter(ExpoAudioStreamModule)
10
-
11
- // Internal event payload from native module
12
- export interface AudioEventPayload {
13
- encoded?: string
14
- buffer?: Float32Array
15
- fileUri: string
16
- lastEmittedSize: number
17
- position: number
18
- deltaSize: number
19
- totalSize: number
20
- mimeType: string
21
- streamUuid: string
22
- compression?: {
23
- data?: string | Blob // Base64 (native) or Float32Array (web) encoded compressed data chunk
24
- position: number
25
- eventDataSize: number
26
- totalSize: number
27
- }
28
- }
29
-
30
- export function addAudioEventListener(
31
- listener: (event: AudioEventPayload) => Promise<void>
32
- ): EventSubscription {
33
- return emitter.addListener<AudioEventPayload>('AudioData', listener)
34
- }
35
-
36
- // Only aliasing the AudioAnalysis type for the event payload
37
- export interface AudioAnalysisEvent extends AudioAnalysis {}
38
-
39
- export function addAudioAnalysisListener(
40
- listener: (event: AudioAnalysisEvent) => Promise<void>
41
- ): EventSubscription {
42
- return emitter.addListener<AudioAnalysisEvent>('AudioAnalysis', listener)
43
- }
44
-
45
- export function addRecordingInterruptionListener(
46
- listener: (event: RecordingInterruptionEvent) => void
47
- ): EventSubscription {
48
- // Add debug logging
49
- console.debug('Adding recording interruption listener')
50
-
51
- const subscription = emitter.addListener<RecordingInterruptionEvent>(
52
- 'onRecordingInterrupted', // Make sure this matches the native event name
53
- (event) => {
54
- console.debug('Recording interruption event received:', event)
55
- listener(event)
56
- }
57
- )
58
-
59
- return subscription
60
- }
@@ -1,213 +0,0 @@
1
- import { useCallback, useEffect, useState, useId } from 'react'
2
-
3
- import { audioDeviceManager } from '../AudioDeviceManager'
4
- import { AudioDevice } from '../ExpoAudioStream.types'
5
-
6
- /**
7
- * React hook for managing audio input devices
8
- */
9
- export function useAudioDevices() {
10
- const [devices, setDevices] = useState<AudioDevice[]>([])
11
- const [currentDevice, setCurrentDevice] = useState<AudioDevice | null>(null)
12
- const [loading, setLoading] = useState(true)
13
- const [error, setError] = useState<Error | null>(null)
14
-
15
- // Generate unique instance ID for debugging
16
- const instanceId = useId().replace(/:/g, '').slice(0, 5)
17
-
18
- // Load devices on mount
19
- useEffect(() => {
20
- let isMounted = true
21
-
22
- const loadDevices = async () => {
23
- try {
24
- setLoading(true)
25
- setError(null)
26
-
27
- // Load available devices
28
- const availableDevices =
29
- await audioDeviceManager.getAvailableDevices()
30
- if (isMounted) setDevices(availableDevices)
31
-
32
- // Get current device
33
- const device = await audioDeviceManager.getCurrentDevice()
34
- if (isMounted) setCurrentDevice(device)
35
- } catch (err) {
36
- audioDeviceManager
37
- .getLogger()
38
- ?.error('Failed to load audio devices:', err)
39
- if (isMounted)
40
- setError(
41
- err instanceof Error
42
- ? err
43
- : new Error('Failed to load audio devices')
44
- )
45
- } finally {
46
- if (isMounted) setLoading(false)
47
- }
48
- }
49
-
50
- loadDevices()
51
-
52
- // Set up device change listener
53
- const removeListener = audioDeviceManager.addDeviceChangeListener(
54
- (updatedDevices: AudioDevice[]) => {
55
- audioDeviceManager
56
- .getLogger()
57
- ?.debug(
58
- `🎛️ useAudioDevices [${instanceId}] received device change. Count: ${updatedDevices.length}`
59
- )
60
-
61
- if (isMounted) {
62
- setDevices(updatedDevices)
63
-
64
- // If our current device is no longer available, update it
65
- if (
66
- currentDevice &&
67
- !updatedDevices.some(
68
- (d: AudioDevice) => d.id === currentDevice.id
69
- )
70
- ) {
71
- audioDeviceManager
72
- .getLogger()
73
- ?.debug(
74
- `🎛️ useAudioDevices [${instanceId}] Current device ${currentDevice.id} no longer available, updating`
75
- )
76
- audioDeviceManager
77
- .getCurrentDevice()
78
- .then((newDevice: AudioDevice | null) => {
79
- if (isMounted) {
80
- setCurrentDevice(newDevice)
81
- }
82
- })
83
- }
84
- }
85
- }
86
- )
87
-
88
- return () => {
89
- isMounted = false
90
- removeListener()
91
- }
92
- }, [])
93
-
94
- /**
95
- * Select a specific audio input device
96
- * @param deviceId The ID of the device to select
97
- * @returns Promise resolving to a boolean indicating success
98
- */
99
- const selectDevice = useCallback(
100
- async (deviceId: string): Promise<boolean> => {
101
- try {
102
- setLoading(true)
103
- setError(null)
104
-
105
- const success = await audioDeviceManager.selectDevice(deviceId)
106
-
107
- if (success) {
108
- // Get the updated current device after selection
109
- const device = await audioDeviceManager.getCurrentDevice()
110
- setCurrentDevice(device)
111
- }
112
-
113
- return success
114
- } catch (err) {
115
- audioDeviceManager
116
- .getLogger()
117
- ?.error('Failed to select audio device:', err)
118
- setError(
119
- err instanceof Error
120
- ? err
121
- : new Error('Failed to select audio device')
122
- )
123
- return false
124
- } finally {
125
- setLoading(false)
126
- }
127
- },
128
- []
129
- )
130
-
131
- /**
132
- * Reset to the default audio input device
133
- * @returns Promise resolving to a boolean indicating success
134
- */
135
- const resetToDefaultDevice = useCallback(async (): Promise<boolean> => {
136
- try {
137
- setLoading(true)
138
- setError(null)
139
-
140
- const success = await audioDeviceManager.resetToDefaultDevice()
141
-
142
- if (success) {
143
- // Get the updated current device after reset
144
- const device = await audioDeviceManager.getCurrentDevice()
145
- setCurrentDevice(device)
146
- }
147
-
148
- return success
149
- } catch (err) {
150
- audioDeviceManager
151
- .getLogger()
152
- ?.error('Failed to reset to default audio device:', err)
153
- setError(
154
- err instanceof Error
155
- ? err
156
- : new Error('Failed to reset to default audio device')
157
- )
158
- return false
159
- } finally {
160
- setLoading(false)
161
- }
162
- }, [])
163
-
164
- /**
165
- * Refresh the list of available devices
166
- */
167
- const refreshDevices = useCallback(async (): Promise<AudioDevice[]> => {
168
- try {
169
- setLoading(true)
170
- setError(null)
171
-
172
- const updatedDevices = await audioDeviceManager.refreshDevices()
173
- setDevices(updatedDevices)
174
-
175
- // Also refresh the current device
176
- const device = await audioDeviceManager.getCurrentDevice()
177
- setCurrentDevice(device)
178
-
179
- return updatedDevices
180
- } catch (err) {
181
- audioDeviceManager
182
- .getLogger()
183
- ?.error('Failed to refresh audio devices:', err)
184
- setError(
185
- err instanceof Error
186
- ? err
187
- : new Error('Failed to refresh audio devices')
188
- )
189
- return []
190
- } finally {
191
- setLoading(false)
192
- }
193
- }, [])
194
-
195
- /**
196
- * Initialize device detection
197
- * Useful for restarting device detection if it failed initially
198
- */
199
- const initializeDeviceDetection = useCallback(() => {
200
- audioDeviceManager.initializeDeviceDetection()
201
- }, [])
202
-
203
- return {
204
- devices,
205
- currentDevice,
206
- loading,
207
- error,
208
- selectDevice,
209
- resetToDefaultDevice,
210
- refreshDevices,
211
- initializeDeviceDetection,
212
- }
213
- }
package/src/index.ts DELETED
@@ -1,54 +0,0 @@
1
- // src/index.ts
2
-
3
- import {
4
- extractRawWavAnalysis,
5
- extractAudioAnalysis,
6
- } from './AudioAnalysis/extractAudioAnalysis'
7
- import { extractAudioData } from './AudioAnalysis/extractAudioData'
8
- import { extractMelSpectrogram } from './AudioAnalysis/extractMelSpectrogram'
9
- import { extractPreview } from './AudioAnalysis/extractPreview'
10
- import {
11
- AudioRecorderProvider,
12
- useSharedAudioRecorder,
13
- } from './AudioRecorder.provider'
14
- import ExpoAudioStreamModule from './ExpoAudioStreamModule'
15
- import { trimAudio } from './trimAudio'
16
- import { useAudioRecorder } from './useAudioRecorder'
17
-
18
- export * from './utils/convertPCMToFloat32'
19
- export * from './utils/getWavFileInfo'
20
- export * from './utils/writeWavHeader'
21
-
22
- // Export platform capabilities
23
- export {
24
- getPlatformCapabilities,
25
- isEncodingSupported,
26
- isBitDepthSupported,
27
- getFallbackEncoding,
28
- getFallbackBitDepth,
29
- validateRecordingConfig,
30
- type PlatformCapabilities,
31
- } from './constants/platformLimitations'
32
-
33
- // Export AudioDeviceManager
34
- export { AudioDeviceManager, audioDeviceManager } from './AudioDeviceManager'
35
-
36
- // Export useAudioDevices hook
37
- export { useAudioDevices } from './hooks/useAudioDevices'
38
-
39
- export {
40
- AudioRecorderProvider,
41
- ExpoAudioStreamModule,
42
- extractRawWavAnalysis,
43
- extractAudioAnalysis,
44
- extractPreview,
45
- trimAudio,
46
- extractAudioData,
47
- extractMelSpectrogram,
48
- useAudioRecorder,
49
- useSharedAudioRecorder,
50
- }
51
-
52
- // Export all types
53
- export type * from './AudioAnalysis/AudioAnalysis.types'
54
- export type * from './ExpoAudioStream.types'
package/src/trimAudio.ts DELETED
@@ -1,94 +0,0 @@
1
- import { LegacyEventEmitter, type EventSubscription } from 'expo-modules-core'
2
-
3
- import {
4
- TrimAudioOptions,
5
- TrimAudioResult,
6
- TrimProgressEvent,
7
- } from './ExpoAudioStream.types'
8
- import ExpoAudioStreamModule from './ExpoAudioStreamModule'
9
- import { cleanNativeOptions } from './utils/cleanNativeOptions'
10
-
11
- // Create a single emitter instance
12
- const emitter = new LegacyEventEmitter(ExpoAudioStreamModule)
13
-
14
- /**
15
- * Trims an audio file based on the provided options.
16
- *
17
- * @experimental This API is experimental and not fully optimized for production use.
18
- * Performance may vary based on file size and device capabilities.
19
- * Future versions may include breaking changes.
20
- *
21
- * @param options Configuration options for the trimming operation
22
- * @param progressCallback Optional callback to receive progress updates
23
- * @returns Promise resolving to the trimmed audio file information, including processing time
24
- */
25
- export async function trimAudio(
26
- options: TrimAudioOptions,
27
- progressCallback?: (event: TrimProgressEvent) => void
28
- ): Promise<TrimAudioResult> {
29
- // Validation
30
- if (!options.fileUri) {
31
- throw new Error('fileUri is required')
32
- }
33
- const mode = options.mode ?? 'single'
34
- if (mode === 'single') {
35
- if (
36
- options.startTimeMs === undefined &&
37
- options.endTimeMs === undefined
38
- ) {
39
- throw new Error(
40
- 'At least one of startTimeMs or endTimeMs must be provided in single mode'
41
- )
42
- }
43
- } else if (mode === 'keep' || mode === 'remove') {
44
- if (!options.ranges || options.ranges.length === 0) {
45
- throw new Error(
46
- 'ranges must be provided and non-empty for keep or remove modes'
47
- )
48
- }
49
- } else {
50
- throw new Error(
51
- `Invalid mode: ${mode}. Must be 'single', 'keep', or 'remove'`
52
- )
53
- }
54
-
55
- // Set up progress event listener if callback is provided
56
- let subscription: EventSubscription | undefined
57
- if (progressCallback) {
58
- subscription = emitter.addListener(
59
- 'TrimProgress',
60
- (event: TrimProgressEvent) => {
61
- progressCallback(event)
62
- }
63
- )
64
- }
65
-
66
- try {
67
- // Clean non-serializable/undefined values to avoid Android Kotlin bridge crash
68
- const result = await ExpoAudioStreamModule.trimAudio(
69
- cleanNativeOptions(options)
70
- )
71
- return result
72
- } finally {
73
- if (subscription) {
74
- subscription.remove()
75
- }
76
- }
77
- }
78
-
79
- /**
80
- * Simplified version of trimAudio that returns only the URI of the trimmed file.
81
- *
82
- * @experimental This API is experimental and not fully optimized for production use.
83
- * Performance may vary based on file size and device capabilities.
84
- * Future versions may include breaking changes.
85
- *
86
- * @param options Configuration options for the trimming operation
87
- * @returns Promise resolving to the URI of the trimmed audio file
88
- */
89
- export async function trimAudioSimple(
90
- options: TrimAudioOptions
91
- ): Promise<string> {
92
- const result = await trimAudio(options)
93
- return result.uri
94
- }
@@ -1,9 +0,0 @@
1
- declare module 'crc-32' {
2
- interface CRC32 {
3
- (data: string | Uint8Array): number
4
- buf(data: Uint8Array): number
5
- }
6
-
7
- const crc32: CRC32
8
- export default crc32
9
- }