@siteed/expo-audio-stream 2.1.0 → 2.2.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 (187) hide show
  1. package/README.md +40 -222
  2. package/build/index.d.ts +11 -15
  3. package/build/index.js +44 -14
  4. package/package.json +49 -110
  5. package/src/index.ts +18 -32
  6. package/CHANGELOG.md +0 -206
  7. package/android/build.gradle +0 -105
  8. package/android/src/main/AndroidManifest.xml +0 -27
  9. package/android/src/main/java/net/siteed/audiostream/AudioAnalysisData.kt +0 -166
  10. package/android/src/main/java/net/siteed/audiostream/AudioDataEncoder.kt +0 -9
  11. package/android/src/main/java/net/siteed/audiostream/AudioFileHandler.kt +0 -131
  12. package/android/src/main/java/net/siteed/audiostream/AudioFormatUtils.kt +0 -103
  13. package/android/src/main/java/net/siteed/audiostream/AudioNotificationsManager.kt +0 -435
  14. package/android/src/main/java/net/siteed/audiostream/AudioProcessor.kt +0 -2235
  15. package/android/src/main/java/net/siteed/audiostream/AudioRecorderManager.kt +0 -1437
  16. package/android/src/main/java/net/siteed/audiostream/AudioRecordingService.kt +0 -152
  17. package/android/src/main/java/net/siteed/audiostream/AudioTrimmer.kt +0 -1099
  18. package/android/src/main/java/net/siteed/audiostream/Constants.kt +0 -21
  19. package/android/src/main/java/net/siteed/audiostream/EventSender.kt +0 -7
  20. package/android/src/main/java/net/siteed/audiostream/ExpoAudioStreamModule.kt +0 -739
  21. package/android/src/main/java/net/siteed/audiostream/FFT.kt +0 -99
  22. package/android/src/main/java/net/siteed/audiostream/Features.kt +0 -98
  23. package/android/src/main/java/net/siteed/audiostream/NotificationConfig.kt +0 -70
  24. package/android/src/main/java/net/siteed/audiostream/PermissionUtils.kt +0 -59
  25. package/android/src/main/java/net/siteed/audiostream/RecordingActionReceiver.kt +0 -59
  26. package/android/src/main/java/net/siteed/audiostream/RecordingConfig.kt +0 -205
  27. package/android/src/main/java/net/siteed/audiostream/WaveformConfig.kt +0 -19
  28. package/android/src/main/java/net/siteed/audiostream/WaveformRenderer.kt +0 -159
  29. package/android/src/main/res/drawable/ic_default_action_icon.xml +0 -16
  30. package/android/src/main/res/drawable/ic_microphone.xml +0 -13
  31. package/android/src/main/res/drawable/ic_pause.xml +0 -10
  32. package/android/src/main/res/drawable/ic_play.xml +0 -10
  33. package/android/src/main/res/drawable/ic_stop.xml +0 -10
  34. package/android/src/main/res/layout/notification_recording.xml +0 -37
  35. package/android/src/main/test/java/net/siteed/audiostream/AudioProcessorTest.kt +0 -56
  36. package/app.plugin.js +0 -1
  37. package/build/AudioAnalysis/AudioAnalysis.types.d.ts +0 -179
  38. package/build/AudioAnalysis/AudioAnalysis.types.d.ts.map +0 -1
  39. package/build/AudioAnalysis/AudioAnalysis.types.js +0 -3
  40. package/build/AudioAnalysis/AudioAnalysis.types.js.map +0 -1
  41. package/build/AudioAnalysis/extractAudioAnalysis.d.ts +0 -68
  42. package/build/AudioAnalysis/extractAudioAnalysis.d.ts.map +0 -1
  43. package/build/AudioAnalysis/extractAudioAnalysis.js +0 -203
  44. package/build/AudioAnalysis/extractAudioAnalysis.js.map +0 -1
  45. package/build/AudioAnalysis/extractAudioData.d.ts +0 -3
  46. package/build/AudioAnalysis/extractAudioData.d.ts.map +0 -1
  47. package/build/AudioAnalysis/extractAudioData.js +0 -5
  48. package/build/AudioAnalysis/extractAudioData.js.map +0 -1
  49. package/build/AudioAnalysis/extractMelSpectrogram.d.ts +0 -14
  50. package/build/AudioAnalysis/extractMelSpectrogram.d.ts.map +0 -1
  51. package/build/AudioAnalysis/extractMelSpectrogram.js +0 -85
  52. package/build/AudioAnalysis/extractMelSpectrogram.js.map +0 -1
  53. package/build/AudioAnalysis/extractPreview.d.ts +0 -11
  54. package/build/AudioAnalysis/extractPreview.d.ts.map +0 -1
  55. package/build/AudioAnalysis/extractPreview.js +0 -25
  56. package/build/AudioAnalysis/extractPreview.js.map +0 -1
  57. package/build/AudioAnalysis/extractWaveform.d.ts +0 -8
  58. package/build/AudioAnalysis/extractWaveform.d.ts.map +0 -1
  59. package/build/AudioAnalysis/extractWaveform.js +0 -11
  60. package/build/AudioAnalysis/extractWaveform.js.map +0 -1
  61. package/build/AudioRecorder.provider.d.ts +0 -11
  62. package/build/AudioRecorder.provider.d.ts.map +0 -1
  63. package/build/AudioRecorder.provider.js +0 -37
  64. package/build/AudioRecorder.provider.js.map +0 -1
  65. package/build/ExpoAudioStream.native.d.ts +0 -3
  66. package/build/ExpoAudioStream.native.d.ts.map +0 -1
  67. package/build/ExpoAudioStream.native.js +0 -6
  68. package/build/ExpoAudioStream.native.js.map +0 -1
  69. package/build/ExpoAudioStream.types.d.ts +0 -532
  70. package/build/ExpoAudioStream.types.d.ts.map +0 -1
  71. package/build/ExpoAudioStream.types.js +0 -2
  72. package/build/ExpoAudioStream.types.js.map +0 -1
  73. package/build/ExpoAudioStream.web.d.ts +0 -59
  74. package/build/ExpoAudioStream.web.d.ts.map +0 -1
  75. package/build/ExpoAudioStream.web.js +0 -285
  76. package/build/ExpoAudioStream.web.js.map +0 -1
  77. package/build/ExpoAudioStreamModule.d.ts +0 -3
  78. package/build/ExpoAudioStreamModule.d.ts.map +0 -1
  79. package/build/ExpoAudioStreamModule.js +0 -693
  80. package/build/ExpoAudioStreamModule.js.map +0 -1
  81. package/build/WebRecorder.web.d.ts +0 -119
  82. package/build/WebRecorder.web.d.ts.map +0 -1
  83. package/build/WebRecorder.web.js +0 -436
  84. package/build/WebRecorder.web.js.map +0 -1
  85. package/build/constants.d.ts +0 -11
  86. package/build/constants.d.ts.map +0 -1
  87. package/build/constants.js +0 -14
  88. package/build/constants.js.map +0 -1
  89. package/build/events.d.ts +0 -26
  90. package/build/events.d.ts.map +0 -1
  91. package/build/events.js +0 -21
  92. package/build/events.js.map +0 -1
  93. package/build/index.d.ts.map +0 -1
  94. package/build/index.js.map +0 -1
  95. package/build/trimAudio.d.ts +0 -25
  96. package/build/trimAudio.d.ts.map +0 -1
  97. package/build/trimAudio.js +0 -67
  98. package/build/trimAudio.js.map +0 -1
  99. package/build/useAudioRecorder.d.ts +0 -21
  100. package/build/useAudioRecorder.d.ts.map +0 -1
  101. package/build/useAudioRecorder.js +0 -427
  102. package/build/useAudioRecorder.js.map +0 -1
  103. package/build/utils/BlobFix.d.ts +0 -9
  104. package/build/utils/BlobFix.d.ts.map +0 -1
  105. package/build/utils/BlobFix.js +0 -498
  106. package/build/utils/BlobFix.js.map +0 -1
  107. package/build/utils/audioProcessing.d.ts +0 -24
  108. package/build/utils/audioProcessing.d.ts.map +0 -1
  109. package/build/utils/audioProcessing.js +0 -133
  110. package/build/utils/audioProcessing.js.map +0 -1
  111. package/build/utils/concatenateBuffers.d.ts +0 -8
  112. package/build/utils/concatenateBuffers.d.ts.map +0 -1
  113. package/build/utils/concatenateBuffers.js +0 -21
  114. package/build/utils/concatenateBuffers.js.map +0 -1
  115. package/build/utils/convertPCMToFloat32.d.ts +0 -13
  116. package/build/utils/convertPCMToFloat32.d.ts.map +0 -1
  117. package/build/utils/convertPCMToFloat32.js +0 -120
  118. package/build/utils/convertPCMToFloat32.js.map +0 -1
  119. package/build/utils/encodingToBitDepth.d.ts +0 -5
  120. package/build/utils/encodingToBitDepth.d.ts.map +0 -1
  121. package/build/utils/encodingToBitDepth.js +0 -13
  122. package/build/utils/encodingToBitDepth.js.map +0 -1
  123. package/build/utils/getWavFileInfo.d.ts +0 -26
  124. package/build/utils/getWavFileInfo.d.ts.map +0 -1
  125. package/build/utils/getWavFileInfo.js +0 -92
  126. package/build/utils/getWavFileInfo.js.map +0 -1
  127. package/build/utils/writeWavHeader.d.ts +0 -49
  128. package/build/utils/writeWavHeader.d.ts.map +0 -1
  129. package/build/utils/writeWavHeader.js +0 -91
  130. package/build/utils/writeWavHeader.js.map +0 -1
  131. package/build/workers/InlineFeaturesExtractor.web.d.ts +0 -2
  132. package/build/workers/InlineFeaturesExtractor.web.d.ts.map +0 -1
  133. package/build/workers/InlineFeaturesExtractor.web.js +0 -828
  134. package/build/workers/InlineFeaturesExtractor.web.js.map +0 -1
  135. package/build/workers/inlineAudioWebWorker.web.d.ts +0 -2
  136. package/build/workers/inlineAudioWebWorker.web.d.ts.map +0 -1
  137. package/build/workers/inlineAudioWebWorker.web.js +0 -157
  138. package/build/workers/inlineAudioWebWorker.web.js.map +0 -1
  139. package/expo-module.config.json +0 -9
  140. package/ios/AudioAnalysisData.swift +0 -74
  141. package/ios/AudioNotificationManager.swift +0 -135
  142. package/ios/AudioProcessingHelpers.swift +0 -743
  143. package/ios/AudioProcessor.swift +0 -1313
  144. package/ios/AudioStreamError.swift +0 -7
  145. package/ios/AudioStreamManager.swift +0 -1708
  146. package/ios/AudioStreamManagerDelegate.swift +0 -16
  147. package/ios/DataPoint.swift +0 -54
  148. package/ios/DecodingConfig.swift +0 -47
  149. package/ios/ExpoAudioStream.podspec +0 -27
  150. package/ios/ExpoAudioStreamModule.swift +0 -805
  151. package/ios/FFT.swift +0 -62
  152. package/ios/Features.swift +0 -95
  153. package/ios/Logger.swift +0 -7
  154. package/ios/NotificationExtension.swift +0 -15
  155. package/ios/RecordingResult.swift +0 -22
  156. package/ios/RecordingSettings.swift +0 -265
  157. package/ios/WaveformExtractor.swift +0 -105
  158. package/plugin/build/index.d.ts +0 -21
  159. package/plugin/build/index.js +0 -191
  160. package/plugin/src/index.ts +0 -278
  161. package/plugin/tsconfig.json +0 -10
  162. package/plugin/tsconfig.tsbuildinfo +0 -1
  163. package/src/AudioAnalysis/AudioAnalysis.types.ts +0 -202
  164. package/src/AudioAnalysis/extractAudioAnalysis.ts +0 -333
  165. package/src/AudioAnalysis/extractAudioData.ts +0 -6
  166. package/src/AudioAnalysis/extractMelSpectrogram.ts +0 -144
  167. package/src/AudioAnalysis/extractPreview.ts +0 -34
  168. package/src/AudioAnalysis/extractWaveform.ts +0 -22
  169. package/src/AudioRecorder.provider.tsx +0 -54
  170. package/src/ExpoAudioStream.native.ts +0 -6
  171. package/src/ExpoAudioStream.types.ts +0 -641
  172. package/src/ExpoAudioStream.web.ts +0 -359
  173. package/src/ExpoAudioStreamModule.ts +0 -967
  174. package/src/WebRecorder.web.ts +0 -580
  175. package/src/constants.ts +0 -18
  176. package/src/events.ts +0 -60
  177. package/src/trimAudio.ts +0 -90
  178. package/src/useAudioRecorder.tsx +0 -620
  179. package/src/utils/BlobFix.ts +0 -559
  180. package/src/utils/audioProcessing.ts +0 -205
  181. package/src/utils/concatenateBuffers.ts +0 -24
  182. package/src/utils/convertPCMToFloat32.ts +0 -170
  183. package/src/utils/encodingToBitDepth.ts +0 -18
  184. package/src/utils/getWavFileInfo.ts +0 -132
  185. package/src/utils/writeWavHeader.ts +0 -114
  186. package/src/workers/InlineFeaturesExtractor.web.tsx +0 -827
  187. package/src/workers/inlineAudioWebWorker.web.tsx +0 -156
package/CHANGELOG.md DELETED
@@ -1,206 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
-
11
- ## [2.1.0] - 2025-03-04
12
- ### Changed
13
- - feat(docs): enhance audio processing documentation and examples (#158) ([26afd49](https://github.com/deeeed/expo-audio-stream/commit/26afd4938e1c626294f40b50a84fe15f5c2bb6a1))
14
- - feat: Add Mel Spectrogram Extraction and Language Detection to Audio Processing (#157) ([4129dee](https://github.com/deeeed/expo-audio-stream/commit/4129dee87c27dd5a9911c85e3dbf045507876cc1))
15
- - feat: enhance audio import functionality and decibel visualization (#156) ([2dbecc7](https://github.com/deeeed/expo-audio-stream/commit/2dbecc7bd0ea46edd80c2b0e28dd2a0525953362))
16
- - feat(trim): Implement iOS trim support with custom filename and format improvements (#152) ([dd49be4](https://github.com/deeeed/expo-audio-stream/commit/dd49be42bccbf3ae6cced8c3662237e1668ec2de))
17
- - feat: Add Sample Rate Control and Web Trimming Support to Expo Audio Stream (#151) ([9158eec](https://github.com/deeeed/expo-audio-stream/commit/9158eeccc10e25ac77ba3a99185b4dbc5abfb353))
18
- - feat: Enhance audio trimming with optimized processing and detailed feedback (#150) ([41a6945](https://github.com/deeeed/expo-audio-stream/commit/41a694528d1e803dc0012948eec4edfdc336b4fc))
19
- - feat(trim): add audio trimming functionality with visualization and preview (Android only) (#149) ([cba03dc](https://github.com/deeeed/expo-audio-stream/commit/cba03dc920eb8a1f111b45e8404a42e48076b7cd))
20
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@2.0.1 ([c77cfc8](https://github.com/deeeed/expo-audio-stream/commit/c77cfc8b70f87a12bb19fa03b245cda7ed2496e1))
21
- ## [2.0.1] - 2025-02-27
22
- ### Changed
23
- - refactor: update background mode handling for audio stream plugin ([e7e98cc](https://github.com/deeeed/expo-audio-stream/commit/e7e98cc60b7965770dcf25e9ae74cb356e1e7097))
24
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@2.0.0 ([356d3f4](https://github.com/deeeed/expo-audio-stream/commit/356d3f40ffb66806eeecb86d12bcbe5d60b7eea6))
25
- ## [2.0.0] - 2025-02-27
26
- ### Changed
27
- - feat(playground): Enhance Audio Playground with Improved UX and Sample Audio Loading (#148) ([09d2794](https://github.com/deeeed/expo-audio-stream/commit/09d27940dcffa60e662c828742f4577bca5327f9))
28
- - feat: Implement Enhanced Audio Transcription Workflow with Configurable Extraction and UI Updates (#147) ([c658c7e](https://github.com/deeeed/expo-audio-stream/commit/c658c7e8531dd731b01d9347bc7c744470a3b7b9))
29
- - fix: audio recording reliability improvements and web IndexedDB management (#146) ([d4fa245](https://github.com/deeeed/expo-audio-stream/commit/d4fa245c46d487fe50c6454165efc2e1032ec126))
30
- - feat(transcription): refactor and unify transcription services across platforms (#145) ([a94b905](https://github.com/deeeed/expo-audio-stream/commit/a94b90562fb2112f712f78c03ca6a5110d6b1401))
31
- - feat(audio): enhance checksum verification and audio segment analysis (#143) ([49b6587](https://github.com/deeeed/expo-audio-stream/commit/49b65877d1fd9922f25b4892261c4fedf02ba3c3))
32
- - feat(playground): implement cross-platform ONNX runtime with Silero VAD model (#142) ([4a94639](https://github.com/deeeed/expo-audio-stream/commit/4a9463995f1eadf6531a2b4d6d057e90da097920))
33
- - feat(audio-analysis): enhance audio analysis and visualization capabilities (#141) ([ecf8f5d](https://github.com/deeeed/expo-audio-stream/commit/ecf8f5daf967bf27afb827c8cf6bca7510ce7b4e))
34
- - android 15 (#140) ([5321a3c](https://github.com/deeeed/expo-audio-stream/commit/5321a3c805d22e6824fd11fee4290987d550bd06))
35
- - refactor(audio): consolidate audio analysis APIs and migrate to segment-based processing (#139) ([5d45da8](https://github.com/deeeed/expo-audio-stream/commit/5d45da871ee1849898405ee4bf8bf8d296aebc48))
36
- - feat: pcm player (#137) ([8db6f16](https://github.com/deeeed/expo-audio-stream/commit/8db6f16f13cbcf78fd4a8e412bb00689e47d5a72))
37
- - feat(audio-stream): add extractAudioData API ([faf8915](https://github.com/deeeed/expo-audio-stream/commit/faf8915df3b18ea54ca7e562f61749d7cadf8bb4))
38
- - feat(audio): improve audio trimming and waveform visualization (#136) ([ad5514b](https://github.com/deeeed/expo-audio-stream/commit/ad5514b412eedc7211cb200cc3747e8a83afbf88))
39
- - feat(audio): enhance audio player with preview, trimming and feature analysis (#135) ([3f7eb9c](https://github.com/deeeed/expo-audio-stream/commit/3f7eb9cde7b314505d8ed3e4704c7b1321da6b15))
40
- - feat: add web permission for microphone (#131) ([9a2ed7f](https://github.com/deeeed/expo-audio-stream/commit/9a2ed7f31ad41560d094a22d1248034cb2f5886d))
41
- - refactor(audio): simplify amplitude analysis and remove redundant configuration (#133) ([5d64aa2](https://github.com/deeeed/expo-audio-stream/commit/5d64aa22299836cc9cb925d3e91f3d9470f3e856))
42
- - feat: add full audio analysis with spectral features and time range controls (#132) ([5677dc3](https://github.com/deeeed/expo-audio-stream/commit/5677dc321f5a9ff4bea37fbbce3cb6ae3aad67f6))
43
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@1.17.0 ([689aead](https://github.com/deeeed/expo-audio-stream/commit/689aeadedaa58050cd18e8ec1fa5ff1fcd93f0db))
44
- ## [1.17.0] - 2025-02-18
45
- ### Changed
46
- - feat(web): add audio interval analysis ([281b7e6](https://github.com/deeeed/expo-audio-stream/commit/281b7e6b1136afe0569450a9d1e3d5f01da7af28))
47
- - feat(android): implement interval visualization android ([7e9678e](https://github.com/deeeed/expo-audio-stream/commit/7e9678e23b82d8fd3d032fb1d802c925dcff254a))
48
- - feat(playground): implement intervalAnalysis and validate iOS settings (#126) ([3d35adf](https://github.com/deeeed/expo-audio-stream/commit/3d35adfcc68593c39a72a5e72b7ddf1e6ce6f1fd))
49
- - feat(ios): Make it possible to set a different interval for the audio analysis (#125) ([10a914e](https://github.com/deeeed/expo-audio-stream/commit/10a914e853deb66f9c3dec1845cab4cfcd34c6da))
50
- ## [1.16.0] - 2025-02-17
51
- ### Changed
52
- - fix(expo-audio-stream): prevent adding iOS background modes when disabled ([5c9d09c](https://github.com/deeeed/expo-audio-stream/commit/5c9d09c715ce008fe72177431224a10f5fd7a865))
53
- - fix(ios): replace CallKit with AVAudioSession for phone call detection ([e3b664b](https://github.com/deeeed/expo-audio-stream/commit/e3b664ba6925c379b323ded5fc408154e5f092c6))
54
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@1.15.1 ([cbc3d10](https://github.com/deeeed/expo-audio-stream/commit/cbc3d10661a415811f1fe46cb3acaf63451a9df9))
55
- ## [1.15.1] - 2025-02-17
56
- ### Changed
57
- - fix: restore Opus compression support on iOS (#122) ([06614e6](https://github.com/deeeed/expo-audio-stream/commit/06614e6d96fa2a6af56edf0fd2e2b3966e13c8f7))
58
- - feat: dont block while emitting audio analysis ([01d91d1](https://github.com/deeeed/expo-audio-stream/commit/01d91d1504ccda8ad3569980c79fcf4ae4526a76))
59
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@1.15.0 ([f94c601](https://github.com/deeeed/expo-audio-stream/commit/f94c6016ba4ce968cafbf68644199405f5991d7f))
60
- ## [1.15.0] - 2025-02-15
61
- ### Changed
62
- - fix(ios): improve audio recording interruption handling and auto-resume functionality (#119) ([7767dff](https://github.com/deeeed/expo-audio-stream/commit/7767dff09c7c8d2f2dc8558d24fd2419cb981f4d))
63
- - fix(android): improve background recording and call interruption handling (#118) ([bf19fe9](https://github.com/deeeed/expo-audio-stream/commit/bf19fe92cadbcc080c27a8aa06ba9a2f6ca841b0))
64
- ## [1.14.2] - 2025-02-13
65
- - fix: update STOP action to clear recording metadata ([3484f76](https://github.com/deeeed/expo-audio-stream/commit/3484f76331c0cc83e2384dd18a7f4555f5c5ce8d))
66
- ## [1.14.1] - 2025-02-12
67
- - fix: enable background recording by default and improve audio playground (#114) ([2f60d5e](https://github.com/deeeed/expo-audio-stream/commit/2f60d5edd96ea6d0db7cf35614bc12dcd8d9c6ed))
68
- ## [1.14.0] - 2025-02-12
69
- - fix: keepAwake issue on ios and auto resume after call (#113) ([ed8e184](https://github.com/deeeed/expo-audio-stream/commit/ed8e184c23ba26973cc9f716e1506d4d7ac4a73d))
70
- ## [1.13.2] - 2025-02-10
71
- - fix: ensure foreground service starts within required timeframe ([60dad52](https://github.com/deeeed/expo-audio-stream/commit/60dad5237c11b9a60e6239701317d52c56625d6e))
72
- ## [1.13.1] - 2025-02-10
73
- - readme update with latest demos
74
- ## [1.13.0] - 2025-02-09
75
- - Audiodecode (#104) ([173f589](https://github.com/deeeed/expo-audio-stream/commit/173f589ebe8763f7361088d150bba1d4bd2c4154))
76
- - fix: resolve background recording issues and improve status checking (#103) ([a174d50](https://github.com/deeeed/expo-audio-stream/commit/a174d50932b2ee4682f4bd6edb3eaa9a7d579bfc))
77
- ## [1.12.3] - 2025-02-08
78
- - fix: infinite rerender issue ([54a6a84](https://github.com/deeeed/expo-audio-stream/commit/54a6a8414688c9fbf897c56503c0091dcaf55e26))
79
- ## [1.12.1] - 2025-02-01
80
- - fix: improve audio recording interruption handling and consistency (#98) ([0fd5a146](https://github.com/deeeed/expo-audio-stream/pull/98))
81
- ## [1.12.0] - 2025-01-31
82
- - feat: add call state checks before starting or resuming recording (#94) ([63e70a0](https://github.com/deeeed/expo-audio-stream/commit/63e70a09f70dd8e5798094b360cf7ec8de1275e9))
83
- - feat: add custom filename and directory support for audio recordings (#92) ([2f30f9d](https://github.com/deeeed/expo-audio-stream/commit/2f30f9db2558c456f93f31b79b01cd54a57f392b))
84
- - feat: enhance compressed recording info with file size (#90) ([47254aa](https://github.com/deeeed/expo-audio-stream/commit/47254aa8cb3ae1c01138ebebce1c1d8c65afd794))
85
- ## [1.11.3] - 2025-01-25
86
- - disable duplicate notification alerts for audio stream (#82) ([12f9992](https://github.com/deeeed/expo-audio-stream/commit/12f999247cdd6b08753bcf1b481582a604826383))
87
- - feat(deps): update expo packages and dependencies to latest patch versions (#81) ([3ed0526](https://github.com/deeeed/expo-audio-stream/commit/3ed0526545623530a10757f1bbd7f877a2c31296))
88
- ## [1.11.2] - 2025-01-22
89
- - resources not cleanup properly on app kill (#80) ([7d522a5](https://github.com/deeeed/expo-audio-stream/commit/7d522a531e70065b99758aa3a4c669769fdbd110))
90
- ## [1.11.1] - 2025-01-22
91
- - chore: force deployment of 1.11.1
92
- ## [1.11.0] - 2025-01-22
93
- - feat(audio): add intelligent call interruption handling & compression improvements ([f8f6187](https://github.com/deeeed/expo-audio-stream/pull/78))
94
- ## [1.10.0] - 2025-01-14
95
- - add support for pausing and resuming compressed recordings ([bc3f629](https://github.com/deeeed/expo-audio-stream/commit/bc3f6295d060396325e0f008ff00b3be9c8722cd))
96
- - optimize notification channel settings ([daa075e](https://github.com/deeeed/expo-audio-stream/commit/daa075e668f8faf0b8d2849e18c37384bdd293b8))
97
- ## [1.9.2] - 2025-01-12
98
- - ios bitrate verification to prevent invalid values ([035a180](https://github.com/deeeed/expo-audio-stream/commit/035a1800833264edcc59724aaa8a2e12d5c78dc2))
99
- ## [1.9.1] - 2025-01-12
100
- - ios potentially missing compressed file info ([88a628c](https://github.com/deeeed/expo-audio-stream/commit/88a628c35f2bfd626a2a5de1eb6950efd814619d))
101
- ## [1.9.0] - 2025-01-11
102
- - feat(web-audio): optimize memory usage and streaming performance for web audio recording (#75) ([7b93e12](https://github.com/deeeed/expo-audio-stream/commit/7b93e12aae4bc0599b06b48ca34a60f65587fc75))
103
- ## [1.8.0] - 2025-01-10
104
- - feat(audio): implement audio compression support ([ff4e060](https://github.com/deeeed/expo-audio-stream/commit/ff4e060fef1061804c1cc0126d4344d2d50daa9a))
105
- ## [1.7.2] - 2025-01-07
106
- - fix(audio-stream): correct WAV header handling in web audio recording ([9ba7de5](https://github.com/deeeed/expo-audio-stream/commit/9ba7de5b96ca4cc937dea261c80d3fda9c99e8f4))
107
- ## [1.7.1] - 2025-01-07
108
- - update notification to avoid triggering new alerts (#71) ([32dcfc5](https://github.com/deeeed/expo-audio-stream/commit/32dcfc55daf3236babefc17016f329c177d466fd))
109
- ## [1.7.0] - 2025-01-05
110
- - feat(playground): enhance app configuration and build setup for production deployment (#58) ([929d443](https://github.com/deeeed/expo-audio-stream/commit/929d443145378b1430d215db5c00b13758420e2b))
111
- - chore(expo-audio-stream): release @siteed/expo-audio-stream@1.6.1 ([084e8ad](https://github.com/deeeed/expo-audio-stream/commit/084e8adb91da7874c9e608b55d9c7b2ffd7a8327))
112
- - fix(ios): improve audio resampling and duration tracking (#69) ([51bef49](https://github.com/deeeed/expo-audio-stream/commit/51bef493b8e167852c64b8c66a9f8a14cd34f99c))
113
- - handle paused state in stopRecording (#68) ([15eac9b](https://github.com/deeeed/expo-audio-stream/commit/15eac9bfcc3203e4a5eb5f236286ed72aafde722))
114
- - reset audio recording state properly on iOS and Android (#66) ([61e9c26](https://github.com/deeeed/expo-audio-stream/commit/61e9c261fb3a979be1894e537233d6e5a4fbdae4))
115
- - total size doesnt reset on new recording android (#64) ([f7da57b](https://github.com/deeeed/expo-audio-stream/commit/f7da57ba9d6f25870c130c54a049ba4cfad1c444))
116
- ## [1.6.1] - 2024-12-11
117
- - chore(expo-audio-stream): remove git commit step from publish script ([4a772ce](https://github.com/deeeed/expo-audio-stream/commit/4a772ce93bb7405d9b8e981f46bdf8941a71ecfe))
118
- - chore: more publishing automation ([3693021](https://github.com/deeeed/expo-audio-stream/commit/369302107f9dca9dddd8ae68e6214481a39976ac))
119
- - expo plugin files not published ([b88c446](https://github.com/deeeed/expo-audio-stream/commit/b88c44667013a901fccfe6f89dcb640ae2aae47f))
120
- - chore(expo-audio-stream): improved build publish script ([ad65a69](https://github.com/deeeed/expo-audio-stream/commit/ad65a69011273e0eab1ac0f464fc3b009fc3433d))
121
- - fix(expo-audio-stream): missing package files ([0901a1b](https://github.com/deeeed/expo-audio-stream/commit/0901a1bbbcce3111c9b5d61ade8caa48bcdd3613))
122
- - feat(expo-audio-stream): opt in debug log for plugin config ([03a0a71](https://github.com/deeeed/expo-audio-stream/commit/03a0a7168bb4f77638de51c55a1ad19c713b52dc))
123
- - fix(expo-audio-stream): include all build + sourcemaps files in the package
124
- - fix(expo-audio-stream): missing plugin files ([e56254a](https://github.com/deeeed/expo-audio-stream/commit/e56254a4ffa1c015df3d300831ba0b392958b6c8))
125
- - fix(expo-audio-stream): plugin deployment process and build system enhancements (#56) ([63fbeb8](https://github.com/deeeed/expo-audio-stream/commit/63fbeb82f56130dedeafa633e916f2ce0f8f1a67))
126
- ## [1.5.0] - 2024-12-10
127
- - UNPUBLISHED because of a bug in the build system
128
- ## [1.4.0] - 2024-12-05
129
- - chore: remove unusded dependencies ([ad81dd5](https://github.com/deeeed/expo-audio-stream/commit/ad81dd560c93dd1d04995a323a4ae72d4de20f3e))
130
- ## [1.3.1] - 2024-12-05
131
- - feat(web): implement throttling and optimize event processing (#49) ([da28765](https://github.com/deeeed/expo-audio-stream/commit/da2876524c2c9d6e0a980fde40a0197b929d8a7f))
132
- ## [1.3.0] - 2024-11-28
133
- ### Added
134
- - refactor(permissions): standardize permission status response structure across platforms (#44) ([7c9c800](https://github.com/deeeed/expo-audio-stream/commit/7c9c800d83b7cea3516643371484d5e1f3b99e4c))
135
- - fix(web): add temporary worklet initialization patch for reanimated ([2afcf02](https://github.com/deeeed/expo-audio-stream/commit/2afcf02ddc982e18a419f0132bc42200f3fdebb1))
136
- - feat: update expo-modules-core ([54ed5c5](https://github.com/deeeed/expo-audio-stream/commit/54ed5c59affa46fdf8cdc2e8048766247a4ed16c))
137
- - feat: latest expo fixes ([9cc5ac3](https://github.com/deeeed/expo-audio-stream/commit/9cc5ac39751999e5b33e11c16355557143d68d10))
138
- - feat: latest expo sdk ([258ef6c](https://github.com/deeeed/expo-audio-stream/commit/258ef6cf68e70c7855f696a01204f79b0793fdc0))
139
- ## [1.2.5] - 2024-11-12
140
- ### Added
141
- - docs(license): add MIT license to all packages (6 files changed)
142
- - fix(expo-audio-stream): return actual recording settings from startRecording on iOS #37
143
- ## [1.2.4] - 2024-11-05
144
- ### Changed
145
- - Android minimum audio interval set to 10ms.
146
- - plugin setup do not include 'notification' config by default to prevent ios version mismatch.
147
-
148
- ### Fixed
149
- - Remove frequently firing log statements on web.
150
- ## [1.2.0] - 2024-10-24
151
- ### Added
152
- - Feature: `keepAwake` Continue recording when app is in background (default is true)
153
- - Feature: Customizable recording notifications for Android and iOS
154
- - Android: Rich notification support with live waveform visualization
155
- - Android: Configurable notification actions, colors, and priorities
156
- - iOS: Integration with media player
157
- ## [1.1.17] - 2024-10-21
158
- ### Added
159
- - Support bluetooth headset on ios
160
- - Fixes: android not reading custom interval audio update
161
- ## [1.0.0] - 2024-04-01
162
- ### Added
163
- - Initial release of @siteed/expo-audio-stream.
164
- - Feature: Real-time audio streaming across iOS, Android, and web.
165
- - Feature: Configurable intervals for audio buffer receipt.
166
- - Feature: Automated microphone permissions setup in managed Expo projects.
167
- - Feature: Background audio recording on iOS.
168
- - Feature: Audio features extraction during recording.
169
- - Feature: Consistent WAV PCM recording format across all platforms.
170
-
171
- [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@2.1.0...HEAD
172
- [2.1.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@2.0.1...@siteed/expo-audio-stream@2.1.0
173
- [2.0.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@2.0.0...@siteed/expo-audio-stream@2.0.1
174
- [2.0.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.17.0...@siteed/expo-audio-stream@2.0.0
175
- [1.17.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.16.0...@siteed/expo-audio-stream@1.17.0
176
- [1.16.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.15.1...@siteed/expo-audio-stream@1.16.0
177
- [1.15.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.15.0...@siteed/expo-audio-stream@1.15.1
178
- [1.15.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.14.2...@siteed/expo-audio-stream@1.15.0
179
- [1.14.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.14.1...@siteed/expo-audio-stream@1.14.2
180
- [1.14.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.14.0...@siteed/expo-audio-stream@1.14.1
181
- [1.14.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.13.2...@siteed/expo-audio-stream@1.14.0
182
- [1.13.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.13.1...@siteed/expo-audio-stream@1.13.2
183
- [1.13.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.13.0...@siteed/expo-audio-stream@1.13.1
184
- [1.13.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.12.3...@siteed/expo-audio-stream@1.13.0
185
- [1.12.3]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.12.2...@siteed/expo-audio-stream@1.12.3
186
- [1.12.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.12.1...@siteed/expo-audio-stream@1.12.2
187
- [1.12.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.12.0...@siteed/expo-audio-stream@1.12.1
188
- [1.12.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.11.6...@siteed/expo-audio-stream@1.12.0
189
- [1.11.3]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.11.2...@siteed/expo-audio-stream@1.11.3
190
- [1.11.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.11.1...@siteed/expo-audio-stream@1.11.2
191
- [1.11.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.11.0...@siteed/expo-audio-stream@1.11.1
192
- [1.11.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.10.0...@siteed/expo-audio-stream@1.11.0
193
- [1.10.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.9.2...@siteed/expo-audio-stream@1.10.0
194
- [1.9.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.9.1...@siteed/expo-audio-stream@1.9.2
195
- [1.9.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.9.0...@siteed/expo-audio-stream@1.9.1
196
- [1.9.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.8.0...@siteed/expo-audio-stream@1.9.0
197
- [1.8.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.7.2...@siteed/expo-audio-stream@1.8.0
198
- [1.7.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.7.1...@siteed/expo-audio-stream@1.7.2
199
- [1.7.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.7.0...@siteed/expo-audio-stream@1.7.1
200
- [1.7.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.6.1...@siteed/expo-audio-stream@1.7.0
201
- [1.6.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.6.0...@siteed/expo-audio-stream@1.6.1
202
- [1.5.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.4.0...@siteed/expo-audio-stream@1.5.0
203
- [1.4.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.3.1...@siteed/expo-audio-stream@1.4.0
204
- [1.3.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-stream@1.3.0...@siteed/expo-audio-stream@1.3.1
205
- [Unreleased]: https://github.com/deeeed/expo-audio-stream/compare/v1.0.0...HEAD
206
- [1.0.0]: https://github.com/deeeed/expo-audio-stream/releases/tag/v1.0.0
@@ -1,105 +0,0 @@
1
- apply plugin: 'com.android.library'
2
- apply plugin: 'kotlin-android'
3
- apply plugin: 'maven-publish'
4
-
5
- group = 'net.siteed.audiostream'
6
- version = '0.1.0'
7
-
8
- buildscript {
9
- def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
- if (expoModulesCorePlugin.exists()) {
11
- apply from: expoModulesCorePlugin
12
- applyKotlinExpoModulesCorePlugin()
13
- }
14
-
15
- // Simple helper that allows the root project to override versions declared by this library.
16
- ext.safeExtGet = { prop, fallback ->
17
- rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
18
- }
19
-
20
- // Ensures backward compatibility
21
- ext.getKotlinVersion = {
22
- if (ext.has("kotlinVersion")) {
23
- ext.kotlinVersion()
24
- } else {
25
- ext.safeExtGet("kotlinVersion", "1.8.10")
26
- }
27
- }
28
-
29
- repositories {
30
- mavenCentral()
31
- }
32
-
33
- dependencies {
34
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
35
- }
36
- }
37
-
38
- afterEvaluate {
39
- publishing {
40
- publications {
41
- release(MavenPublication) {
42
- from components.release
43
- }
44
- }
45
- repositories {
46
- maven {
47
- url = mavenLocal().url
48
- }
49
- }
50
- }
51
- }
52
-
53
- android {
54
- compileSdkVersion safeExtGet("compileSdkVersion", 34)
55
-
56
- def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
57
- if (agpVersion.tokenize('.')[0].toInteger() < 8) {
58
- compileOptions {
59
- sourceCompatibility JavaVersion.VERSION_17
60
- targetCompatibility JavaVersion.VERSION_17
61
- }
62
-
63
- tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
64
- kotlinOptions {
65
- jvmTarget = '17'
66
- }
67
- }
68
- }
69
-
70
- namespace "net.siteed.audiostream"
71
- defaultConfig {
72
- minSdkVersion safeExtGet("minSdkVersion", 21)
73
- targetSdkVersion safeExtGet("targetSdkVersion", 34)
74
- versionCode 1
75
- versionName "0.1.0"
76
- }
77
- lintOptions {
78
- abortOnError false
79
- }
80
- publishing {
81
- singleVariant("release") {
82
- withSourcesJar()
83
- }
84
- }
85
- }
86
-
87
- repositories {
88
- mavenCentral()
89
- }
90
-
91
- dependencies {
92
- implementation project(':expo-modules-core')
93
- implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
94
-
95
- // Add testing dependencies
96
- testImplementation 'junit:junit:4.13.2'
97
- testImplementation 'org.jetbrains.kotlin:kotlin-test:1.8.10'
98
- testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.8.10'
99
- }
100
-
101
- kotlin {
102
- jvmToolchain {
103
- languageVersion.set(JavaLanguageVersion.of(17))
104
- }
105
- }
@@ -1,27 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- <!-- Permissions will be merged into the app's manifest -->
3
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
4
- <uses-permission android:name="android.permission.RECORD_AUDIO"/>
5
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
6
- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
7
- <uses-permission android:name="android.permission.WAKE_LOCK" />
8
- <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
9
-
10
- <application>
11
- <receiver
12
- android:name=".RecordingActionReceiver"
13
- android:exported="false">
14
- <intent-filter>
15
- <action android:name="PAUSE_RECORDING" />
16
- <action android:name="RESUME_RECORDING" />
17
- <action android:name="STOP_RECORDING" />
18
- </intent-filter>
19
- </receiver>
20
-
21
- <service
22
- android:name=".AudioRecordingService"
23
- android:enabled="true"
24
- android:exported="false"
25
- android:foregroundServiceType="microphone" />
26
- </application>
27
- </manifest>
@@ -1,166 +0,0 @@
1
- // net/siteed/audiostream/AudioAnalysisData.kt
2
- package net.siteed.audiostream
3
-
4
- import android.os.Bundle
5
- import androidx.core.os.bundleOf
6
-
7
- data class SpeechFeatures(
8
- val isActive: Boolean,
9
- val speakerId: Int? = null
10
- ) {
11
- fun toDictionary(): Map<String, Any?> {
12
- return mapOf(
13
- "isActive" to isActive,
14
- "speakerId" to speakerId
15
- )
16
- }
17
-
18
- fun toBundle(): Bundle {
19
- return bundleOf(
20
- "isActive" to isActive,
21
- "speakerId" to speakerId
22
- )
23
- }
24
- }
25
-
26
- data class DataPoint(
27
- val id: Long,
28
- val amplitude: Float,
29
- val rms: Float,
30
- val dB: Float,
31
- val silent: Boolean,
32
- val features: Features? = null,
33
- val speech: SpeechFeatures? = null,
34
- val startTime: Float? = null,
35
- val endTime: Float? = null,
36
- val startPosition: Int? = null,
37
- val endPosition: Int? = null,
38
- val samples: Int = 0
39
- ) {
40
- fun toDictionary(): Map<String, Any?> {
41
- return mapOf(
42
- "id" to id,
43
- "amplitude" to amplitude,
44
- "rms" to rms,
45
- "dB" to dB,
46
- "silent" to silent,
47
- "features" to features?.toDictionary(),
48
- "speech" to speech?.toDictionary(),
49
- "startTime" to startTime,
50
- "endTime" to endTime,
51
- "startPosition" to startPosition,
52
- "endPosition" to endPosition,
53
- "samples" to samples
54
- )
55
- }
56
-
57
- fun toBundle(): Bundle {
58
- return bundleOf(
59
- "id" to id,
60
- "amplitude" to amplitude,
61
- "rms" to rms,
62
- "dB" to dB,
63
- "silent" to silent,
64
- "features" to features?.toBundle(),
65
- "speech" to speech?.toBundle(),
66
- "startTime" to startTime,
67
- "endTime" to endTime,
68
- "startPosition" to startPosition,
69
- "endPosition" to endPosition,
70
- "samples" to samples
71
- )
72
- }
73
- }
74
-
75
- data class AudioAnalysisData(
76
- val segmentDurationMs: Int,
77
- val durationMs: Int,
78
- val bitDepth: Int,
79
- val numberOfChannels: Int,
80
- val sampleRate: Int,
81
- val samples: Int,
82
- val dataPoints: List<DataPoint>,
83
- val amplitudeRange: AmplitudeRange,
84
- val rmsRange: AmplitudeRange,
85
- val speechAnalysis: SpeechAnalysis? = null,
86
- val extractionTimeMs: Float
87
- ) {
88
- data class AmplitudeRange(val min: Float, val max: Float) {
89
- fun toDictionary(): Map<String, Float> {
90
- return mapOf("min" to min, "max" to max)
91
- }
92
-
93
- fun toBundle(): Bundle {
94
- return bundleOf("min" to min, "max" to max)
95
- }
96
- }
97
-
98
- data class SpeechAnalysis(
99
- val speakerChanges: List<SpeakerChange>
100
- ) {
101
- fun toDictionary(): Map<String, Any> {
102
- return mapOf(
103
- "speakerChanges" to speakerChanges.map { it.toDictionary() }
104
- )
105
- }
106
-
107
- fun toBundle(): Bundle {
108
- return bundleOf(
109
- "speakerChanges" to speakerChanges.map { it.toBundle() }.toTypedArray()
110
- )
111
- }
112
- }
113
-
114
- data class SpeakerChange(
115
- val timestamp: Long,
116
- val speakerId: Int
117
- ) {
118
- fun toDictionary(): Map<String, Any> {
119
- return mapOf(
120
- "timestamp" to timestamp,
121
- "speakerId" to speakerId
122
- )
123
- }
124
-
125
- fun toBundle(): Bundle {
126
- return bundleOf(
127
- "timestamp" to timestamp,
128
- "speakerId" to speakerId
129
- )
130
- }
131
- }
132
-
133
- fun toDictionary(): Map<String, Any?> {
134
- return mapOf(
135
- "segmentDurationMs" to segmentDurationMs,
136
- "durationMs" to durationMs,
137
- "bitDepth" to bitDepth,
138
- "numberOfChannels" to numberOfChannels,
139
- "sampleRate" to sampleRate,
140
- "samples" to samples,
141
- "dataPoints" to dataPoints.map { it.toDictionary() },
142
- "amplitudeRange" to amplitudeRange.toDictionary(),
143
- "rmsRange" to rmsRange.toDictionary(),
144
- "speechAnalysis" to speechAnalysis?.toDictionary(),
145
- "extractionTimeMs" to extractionTimeMs
146
- )
147
- }
148
-
149
- fun toBundle(): Bundle {
150
- val dataPointsBundleArray = dataPoints.map { it.toBundle() }.toTypedArray()
151
-
152
- return bundleOf(
153
- "segmentDurationMs" to segmentDurationMs,
154
- "durationMs" to durationMs,
155
- "bitDepth" to bitDepth,
156
- "numberOfChannels" to numberOfChannels,
157
- "sampleRate" to sampleRate,
158
- "samples" to samples,
159
- "dataPoints" to dataPointsBundleArray,
160
- "amplitudeRange" to amplitudeRange.toBundle(),
161
- "rmsRange" to rmsRange.toBundle(),
162
- "speechAnalysis" to speechAnalysis?.toBundle(),
163
- "extractionTimeMs" to extractionTimeMs
164
- )
165
- }
166
- }
@@ -1,9 +0,0 @@
1
- package net.siteed.audiostream
2
-
3
- import android.util.Base64
4
-
5
- class AudioDataEncoder {
6
- public fun encodeToBase64(rawData: ByteArray): String {
7
- return Base64.encodeToString(rawData, Base64.NO_WRAP)
8
- }
9
- }
@@ -1,131 +0,0 @@
1
- package net.siteed.audiostream
2
-
3
- import android.util.Log
4
- import java.io.File
5
- import java.io.IOException
6
- import java.io.OutputStream
7
- import java.io.RandomAccessFile
8
- import java.util.UUID
9
-
10
- class AudioFileHandler(private val filesDir: File) {
11
- // Method to write WAV file header
12
- fun writeWavHeader(out: OutputStream, sampleRateInHz: Int, channels: Int, bitDepth: Int) {
13
- val header = ByteArray(44)
14
- val byteRate = sampleRateInHz * channels * bitDepth / 8
15
- val blockAlign = channels * bitDepth / 8
16
-
17
- // RIFF/WAVE header
18
- "RIFF".toByteArray().copyInto(header, 0)
19
- // (file size - 8) to be updated later
20
- header[4] = 0 // Placeholder
21
- header[5] = 0 // Placeholder
22
- header[6] = 0 // Placeholder
23
- header[7] = 0 // Placeholder
24
- "WAVE".toByteArray().copyInto(header, 8)
25
- "fmt ".toByteArray().copyInto(header, 12)
26
-
27
- // 16 for PCM
28
- header[16] = 16
29
- header[17] = 0
30
- header[18] = 0
31
- header[19] = 0
32
-
33
- // PCM format ID
34
- header[20] = 1 // Audio format 1 for PCM (not compressed)
35
- header[21] = 0
36
-
37
- // Number of channels
38
- header[22] = (channels and 0xff).toByte()
39
- header[23] = (channels shr 8 and 0xff).toByte()
40
-
41
- // Sample rate
42
- header[24] = (sampleRateInHz and 0xff).toByte()
43
- header[25] = (sampleRateInHz shr 8 and 0xff).toByte()
44
- header[26] = (sampleRateInHz shr 16 and 0xff).toByte()
45
- header[27] = (sampleRateInHz shr 24 and 0xff).toByte()
46
-
47
- // Byte rate
48
- header[28] = (byteRate and 0xff).toByte()
49
- header[29] = (byteRate shr 8 and 0xff).toByte()
50
- header[30] = (byteRate shr 16 and 0xff).toByte()
51
- header[31] = (byteRate shr 24 and 0xff).toByte()
52
-
53
- // Block align
54
- header[32] = (blockAlign and 0xff).toByte()
55
- header[33] = (blockAlign shr 8 and 0xff).toByte()
56
-
57
- // Bits per sample
58
- header[34] = (bitDepth and 0xff).toByte()
59
- header[35] = (bitDepth shr 8 and 0xff).toByte()
60
-
61
- // Data chunk
62
- "data".toByteArray().copyInto(header, 36)
63
- // Data size to be updated later
64
- header[40] = 0 // Placeholder
65
- header[41] = 0 // Placeholder
66
- header[42] = 0 // Placeholder
67
- header[43] = 0 // Placeholder
68
-
69
- out.write(header, 0, 44)
70
- }
71
-
72
- fun updateWavHeader(file: File) {
73
- try {
74
- RandomAccessFile(file, "rw").use { raf ->
75
- val fileSize = raf.length()
76
- val dataSize = fileSize - 44 // Subtract the header size
77
-
78
- raf.seek(4) // Write correct file size, excluding the first 8 bytes of the RIFF header
79
- raf.writeInt(Integer.reverseBytes((dataSize + 36).toInt()))
80
-
81
- raf.seek(40) // Go to the data size position
82
- raf.writeInt(Integer.reverseBytes(dataSize.toInt())) // Write the size of the data segment
83
- }
84
- } catch (e: IOException) {
85
- println("Could not update WAV header: ${e.message}")
86
- }
87
- }
88
-
89
- fun clearAudioStorage() {
90
- filesDir.listFiles()?.forEach {
91
- it.delete()
92
- }
93
- }
94
-
95
- fun createAudioFile(extension: String): File {
96
- val timestamp = System.currentTimeMillis()
97
- val uuid = UUID.randomUUID().toString()
98
- val filename = "recording_${timestamp}_${uuid}.${extension}"
99
-
100
- return try {
101
- File(filesDir, filename).apply {
102
- parentFile?.mkdirs() // Create directories if they don't exist
103
- createNewFile() // Create the file
104
- }
105
- } catch (e: Exception) {
106
- Log.e(Constants.TAG, "Failed to create audio file", e)
107
- throw e
108
- }
109
- }
110
-
111
- fun deleteFile(file: File?): Boolean {
112
- return try {
113
- if (file == null) {
114
- Log.w(Constants.TAG, "Attempted to delete null file")
115
- false
116
- } else if (!file.exists()) {
117
- Log.w(Constants.TAG, "File does not exist: ${file.absolutePath}")
118
- false
119
- } else {
120
- val wasDeleted = file.delete()
121
- if (!wasDeleted) {
122
- Log.w(Constants.TAG, "Failed to delete file: ${file.absolutePath}")
123
- }
124
- wasDeleted
125
- }
126
- } catch (e: Exception) {
127
- Log.e(Constants.TAG, "Error deleting file: ${file?.absolutePath}", e)
128
- false
129
- }
130
- }
131
- }