@siteed/expo-audio-studio 2.8.0 → 2.8.2

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 (241) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/app.plugin.cjs +15 -2
  3. package/build/cjs/AudioAnalysis/AudioAnalysis.types.js +4 -0
  4. package/build/cjs/AudioAnalysis/AudioAnalysis.types.js.map +1 -0
  5. package/build/cjs/AudioAnalysis/extractAudioAnalysis.js +205 -0
  6. package/build/cjs/AudioAnalysis/extractAudioAnalysis.js.map +1 -0
  7. package/build/cjs/AudioAnalysis/extractAudioData.js +12 -0
  8. package/build/cjs/AudioAnalysis/extractAudioData.js.map +1 -0
  9. package/build/cjs/AudioAnalysis/extractMelSpectrogram.js +89 -0
  10. package/build/cjs/AudioAnalysis/extractMelSpectrogram.js.map +1 -0
  11. package/build/cjs/AudioAnalysis/extractPreview.js +29 -0
  12. package/build/cjs/AudioAnalysis/extractPreview.js.map +1 -0
  13. package/build/cjs/AudioAnalysis/extractWaveform.js +18 -0
  14. package/build/cjs/AudioAnalysis/extractWaveform.js.map +1 -0
  15. package/build/cjs/AudioDeviceManager.js +500 -0
  16. package/build/cjs/AudioDeviceManager.js.map +1 -0
  17. package/build/cjs/AudioRecorder.provider.js +68 -0
  18. package/build/cjs/AudioRecorder.provider.js.map +1 -0
  19. package/build/cjs/ExpoAudioStream.native.js +8 -0
  20. package/build/cjs/ExpoAudioStream.native.js.map +1 -0
  21. package/build/cjs/ExpoAudioStream.types.js +11 -0
  22. package/build/cjs/ExpoAudioStream.types.js.map +1 -0
  23. package/build/cjs/ExpoAudioStream.web.js +705 -0
  24. package/build/cjs/ExpoAudioStream.web.js.map +1 -0
  25. package/build/cjs/ExpoAudioStreamModule.js +718 -0
  26. package/build/cjs/ExpoAudioStreamModule.js.map +1 -0
  27. package/build/cjs/WebRecorder.web.js +756 -0
  28. package/build/cjs/WebRecorder.web.js.map +1 -0
  29. package/build/cjs/constants.js +17 -0
  30. package/build/cjs/constants.js.map +1 -0
  31. package/build/cjs/events.js +30 -0
  32. package/build/cjs/events.js.map +1 -0
  33. package/build/cjs/hooks/useAudioDevices.js +155 -0
  34. package/build/cjs/hooks/useAudioDevices.js.map +1 -0
  35. package/build/cjs/index.js +50 -0
  36. package/build/cjs/index.js.map +1 -0
  37. package/build/cjs/trimAudio.js +75 -0
  38. package/build/cjs/trimAudio.js.map +1 -0
  39. package/build/cjs/useAudioRecorder.js +453 -0
  40. package/build/cjs/useAudioRecorder.js.map +1 -0
  41. package/build/cjs/utils/BlobFix.js +502 -0
  42. package/build/cjs/utils/BlobFix.js.map +1 -0
  43. package/build/cjs/utils/audioProcessing.js +137 -0
  44. package/build/cjs/utils/audioProcessing.js.map +1 -0
  45. package/build/cjs/utils/concatenateBuffers.js +25 -0
  46. package/build/cjs/utils/concatenateBuffers.js.map +1 -0
  47. package/build/cjs/utils/convertPCMToFloat32.js +124 -0
  48. package/build/cjs/utils/convertPCMToFloat32.js.map +1 -0
  49. package/build/cjs/utils/crc32.js +52 -0
  50. package/build/cjs/utils/crc32.js.map +1 -0
  51. package/build/cjs/utils/encodingToBitDepth.js +17 -0
  52. package/build/cjs/utils/encodingToBitDepth.js.map +1 -0
  53. package/build/cjs/utils/getWavFileInfo.js +96 -0
  54. package/build/cjs/utils/getWavFileInfo.js.map +1 -0
  55. package/build/cjs/utils/writeWavHeader.js +88 -0
  56. package/build/cjs/utils/writeWavHeader.js.map +1 -0
  57. package/build/cjs/workers/InlineFeaturesExtractor.web.js +853 -0
  58. package/build/cjs/workers/InlineFeaturesExtractor.web.js.map +1 -0
  59. package/build/cjs/workers/inlineAudioWebWorker.web.js +184 -0
  60. package/build/cjs/workers/inlineAudioWebWorker.web.js.map +1 -0
  61. package/build/esm/AudioAnalysis/AudioAnalysis.types.js.map +1 -0
  62. package/build/esm/AudioAnalysis/extractAudioAnalysis.js.map +1 -0
  63. package/build/esm/AudioAnalysis/extractAudioData.js.map +1 -0
  64. package/build/esm/AudioAnalysis/extractMelSpectrogram.js.map +1 -0
  65. package/build/esm/AudioAnalysis/extractPreview.js.map +1 -0
  66. package/build/esm/AudioAnalysis/extractWaveform.js.map +1 -0
  67. package/build/esm/AudioDeviceManager.js.map +1 -0
  68. package/build/esm/AudioRecorder.provider.js.map +1 -0
  69. package/build/esm/ExpoAudioStream.native.js.map +1 -0
  70. package/build/esm/ExpoAudioStream.types.js.map +1 -0
  71. package/build/esm/ExpoAudioStream.web.js.map +1 -0
  72. package/build/esm/ExpoAudioStreamModule.js.map +1 -0
  73. package/build/esm/WebRecorder.web.js.map +1 -0
  74. package/build/esm/constants.js.map +1 -0
  75. package/build/esm/events.js.map +1 -0
  76. package/build/esm/hooks/useAudioDevices.js.map +1 -0
  77. package/build/esm/index.js.map +1 -0
  78. package/build/esm/trimAudio.js.map +1 -0
  79. package/build/esm/useAudioRecorder.js.map +1 -0
  80. package/build/esm/utils/BlobFix.js.map +1 -0
  81. package/build/esm/utils/audioProcessing.js.map +1 -0
  82. package/build/esm/utils/concatenateBuffers.js.map +1 -0
  83. package/build/esm/utils/convertPCMToFloat32.js.map +1 -0
  84. package/build/esm/utils/crc32.js.map +1 -0
  85. package/build/esm/utils/encodingToBitDepth.js.map +1 -0
  86. package/build/esm/utils/getWavFileInfo.js.map +1 -0
  87. package/build/esm/utils/writeWavHeader.js.map +1 -0
  88. package/build/esm/workers/InlineFeaturesExtractor.web.js.map +1 -0
  89. package/build/esm/workers/inlineAudioWebWorker.web.js.map +1 -0
  90. package/build/types/AudioAnalysis/AudioAnalysis.types.d.ts.map +1 -0
  91. package/build/types/AudioAnalysis/extractAudioAnalysis.d.ts.map +1 -0
  92. package/build/types/AudioAnalysis/extractAudioData.d.ts.map +1 -0
  93. package/build/types/AudioAnalysis/extractMelSpectrogram.d.ts.map +1 -0
  94. package/build/types/AudioAnalysis/extractPreview.d.ts.map +1 -0
  95. package/build/types/AudioAnalysis/extractWaveform.d.ts.map +1 -0
  96. package/build/types/AudioDeviceManager.d.ts.map +1 -0
  97. package/build/types/AudioRecorder.provider.d.ts.map +1 -0
  98. package/build/types/ExpoAudioStream.native.d.ts.map +1 -0
  99. package/build/types/ExpoAudioStream.types.d.ts.map +1 -0
  100. package/build/types/ExpoAudioStream.web.d.ts.map +1 -0
  101. package/build/types/ExpoAudioStreamModule.d.ts.map +1 -0
  102. package/build/types/WebRecorder.web.d.ts.map +1 -0
  103. package/build/types/constants.d.ts.map +1 -0
  104. package/build/types/events.d.ts.map +1 -0
  105. package/build/types/hooks/useAudioDevices.d.ts.map +1 -0
  106. package/build/types/index.d.ts.map +1 -0
  107. package/build/types/trimAudio.d.ts.map +1 -0
  108. package/build/types/useAudioRecorder.d.ts.map +1 -0
  109. package/build/types/utils/BlobFix.d.ts.map +1 -0
  110. package/build/types/utils/audioProcessing.d.ts.map +1 -0
  111. package/build/types/utils/concatenateBuffers.d.ts.map +1 -0
  112. package/build/types/utils/convertPCMToFloat32.d.ts.map +1 -0
  113. package/build/types/utils/crc32.d.ts.map +1 -0
  114. package/build/types/utils/encodingToBitDepth.d.ts.map +1 -0
  115. package/build/types/utils/getWavFileInfo.d.ts.map +1 -0
  116. package/build/types/utils/writeWavHeader.d.ts.map +1 -0
  117. package/build/types/workers/InlineFeaturesExtractor.web.d.ts.map +1 -0
  118. package/build/types/workers/inlineAudioWebWorker.web.d.ts.map +1 -0
  119. package/package.json +26 -7
  120. package/plugin/build/{index.js → cjs/index.js} +2 -1
  121. package/plugin/build/{index.cjs → esm/index.js} +6 -7
  122. package/plugin/src/index.ts +1 -0
  123. package/plugin/tsconfig.cjs.json +11 -0
  124. package/plugin/tsconfig.esm.json +11 -0
  125. package/build/AudioAnalysis/AudioAnalysis.types.d.ts.map +0 -1
  126. package/build/AudioAnalysis/AudioAnalysis.types.js.map +0 -1
  127. package/build/AudioAnalysis/extractAudioAnalysis.d.ts.map +0 -1
  128. package/build/AudioAnalysis/extractAudioAnalysis.js.map +0 -1
  129. package/build/AudioAnalysis/extractAudioData.d.ts.map +0 -1
  130. package/build/AudioAnalysis/extractAudioData.js.map +0 -1
  131. package/build/AudioAnalysis/extractMelSpectrogram.d.ts.map +0 -1
  132. package/build/AudioAnalysis/extractMelSpectrogram.js.map +0 -1
  133. package/build/AudioAnalysis/extractPreview.d.ts.map +0 -1
  134. package/build/AudioAnalysis/extractPreview.js.map +0 -1
  135. package/build/AudioAnalysis/extractWaveform.d.ts.map +0 -1
  136. package/build/AudioAnalysis/extractWaveform.js.map +0 -1
  137. package/build/AudioDeviceManager.d.ts.map +0 -1
  138. package/build/AudioDeviceManager.js.map +0 -1
  139. package/build/AudioRecorder.provider.d.ts.map +0 -1
  140. package/build/AudioRecorder.provider.js.map +0 -1
  141. package/build/ExpoAudioStream.native.d.ts.map +0 -1
  142. package/build/ExpoAudioStream.native.js.map +0 -1
  143. package/build/ExpoAudioStream.types.d.ts.map +0 -1
  144. package/build/ExpoAudioStream.types.js.map +0 -1
  145. package/build/ExpoAudioStream.web.d.ts.map +0 -1
  146. package/build/ExpoAudioStream.web.js.map +0 -1
  147. package/build/ExpoAudioStreamModule.d.ts.map +0 -1
  148. package/build/ExpoAudioStreamModule.js.map +0 -1
  149. package/build/WebRecorder.web.d.ts.map +0 -1
  150. package/build/WebRecorder.web.js.map +0 -1
  151. package/build/constants.d.ts.map +0 -1
  152. package/build/constants.js.map +0 -1
  153. package/build/events.d.ts.map +0 -1
  154. package/build/events.js.map +0 -1
  155. package/build/hooks/useAudioDevices.d.ts.map +0 -1
  156. package/build/hooks/useAudioDevices.js.map +0 -1
  157. package/build/index.d.ts.map +0 -1
  158. package/build/index.js.map +0 -1
  159. package/build/trimAudio.d.ts.map +0 -1
  160. package/build/trimAudio.js.map +0 -1
  161. package/build/useAudioRecorder.d.ts.map +0 -1
  162. package/build/useAudioRecorder.js.map +0 -1
  163. package/build/utils/BlobFix.d.ts.map +0 -1
  164. package/build/utils/BlobFix.js.map +0 -1
  165. package/build/utils/audioProcessing.d.ts.map +0 -1
  166. package/build/utils/audioProcessing.js.map +0 -1
  167. package/build/utils/concatenateBuffers.d.ts.map +0 -1
  168. package/build/utils/concatenateBuffers.js.map +0 -1
  169. package/build/utils/convertPCMToFloat32.d.ts.map +0 -1
  170. package/build/utils/convertPCMToFloat32.js.map +0 -1
  171. package/build/utils/crc32.d.ts.map +0 -1
  172. package/build/utils/crc32.js.map +0 -1
  173. package/build/utils/encodingToBitDepth.d.ts.map +0 -1
  174. package/build/utils/encodingToBitDepth.js.map +0 -1
  175. package/build/utils/getWavFileInfo.d.ts.map +0 -1
  176. package/build/utils/getWavFileInfo.js.map +0 -1
  177. package/build/utils/writeWavHeader.d.ts.map +0 -1
  178. package/build/utils/writeWavHeader.js.map +0 -1
  179. package/build/workers/InlineFeaturesExtractor.web.d.ts.map +0 -1
  180. package/build/workers/InlineFeaturesExtractor.web.js.map +0 -1
  181. package/build/workers/inlineAudioWebWorker.web.d.ts.map +0 -1
  182. package/build/workers/inlineAudioWebWorker.web.js.map +0 -1
  183. /package/build/{AudioAnalysis → esm/AudioAnalysis}/AudioAnalysis.types.js +0 -0
  184. /package/build/{AudioAnalysis → esm/AudioAnalysis}/extractAudioAnalysis.js +0 -0
  185. /package/build/{AudioAnalysis → esm/AudioAnalysis}/extractAudioData.js +0 -0
  186. /package/build/{AudioAnalysis → esm/AudioAnalysis}/extractMelSpectrogram.js +0 -0
  187. /package/build/{AudioAnalysis → esm/AudioAnalysis}/extractPreview.js +0 -0
  188. /package/build/{AudioAnalysis → esm/AudioAnalysis}/extractWaveform.js +0 -0
  189. /package/build/{AudioDeviceManager.js → esm/AudioDeviceManager.js} +0 -0
  190. /package/build/{AudioRecorder.provider.js → esm/AudioRecorder.provider.js} +0 -0
  191. /package/build/{ExpoAudioStream.native.js → esm/ExpoAudioStream.native.js} +0 -0
  192. /package/build/{ExpoAudioStream.types.js → esm/ExpoAudioStream.types.js} +0 -0
  193. /package/build/{ExpoAudioStream.web.js → esm/ExpoAudioStream.web.js} +0 -0
  194. /package/build/{ExpoAudioStreamModule.js → esm/ExpoAudioStreamModule.js} +0 -0
  195. /package/build/{WebRecorder.web.js → esm/WebRecorder.web.js} +0 -0
  196. /package/build/{constants.js → esm/constants.js} +0 -0
  197. /package/build/{events.js → esm/events.js} +0 -0
  198. /package/build/{hooks → esm/hooks}/useAudioDevices.js +0 -0
  199. /package/build/{index.js → esm/index.js} +0 -0
  200. /package/build/{trimAudio.js → esm/trimAudio.js} +0 -0
  201. /package/build/{useAudioRecorder.js → esm/useAudioRecorder.js} +0 -0
  202. /package/build/{utils → esm/utils}/BlobFix.js +0 -0
  203. /package/build/{utils → esm/utils}/audioProcessing.js +0 -0
  204. /package/build/{utils → esm/utils}/concatenateBuffers.js +0 -0
  205. /package/build/{utils → esm/utils}/convertPCMToFloat32.js +0 -0
  206. /package/build/{utils → esm/utils}/crc32.js +0 -0
  207. /package/build/{utils → esm/utils}/encodingToBitDepth.js +0 -0
  208. /package/build/{utils → esm/utils}/getWavFileInfo.js +0 -0
  209. /package/build/{utils → esm/utils}/writeWavHeader.js +0 -0
  210. /package/build/{workers → esm/workers}/InlineFeaturesExtractor.web.js +0 -0
  211. /package/build/{workers → esm/workers}/inlineAudioWebWorker.web.js +0 -0
  212. /package/build/{AudioAnalysis → types/AudioAnalysis}/AudioAnalysis.types.d.ts +0 -0
  213. /package/build/{AudioAnalysis → types/AudioAnalysis}/extractAudioAnalysis.d.ts +0 -0
  214. /package/build/{AudioAnalysis → types/AudioAnalysis}/extractAudioData.d.ts +0 -0
  215. /package/build/{AudioAnalysis → types/AudioAnalysis}/extractMelSpectrogram.d.ts +0 -0
  216. /package/build/{AudioAnalysis → types/AudioAnalysis}/extractPreview.d.ts +0 -0
  217. /package/build/{AudioAnalysis → types/AudioAnalysis}/extractWaveform.d.ts +0 -0
  218. /package/build/{AudioDeviceManager.d.ts → types/AudioDeviceManager.d.ts} +0 -0
  219. /package/build/{AudioRecorder.provider.d.ts → types/AudioRecorder.provider.d.ts} +0 -0
  220. /package/build/{ExpoAudioStream.native.d.ts → types/ExpoAudioStream.native.d.ts} +0 -0
  221. /package/build/{ExpoAudioStream.types.d.ts → types/ExpoAudioStream.types.d.ts} +0 -0
  222. /package/build/{ExpoAudioStream.web.d.ts → types/ExpoAudioStream.web.d.ts} +0 -0
  223. /package/build/{ExpoAudioStreamModule.d.ts → types/ExpoAudioStreamModule.d.ts} +0 -0
  224. /package/build/{WebRecorder.web.d.ts → types/WebRecorder.web.d.ts} +0 -0
  225. /package/build/{constants.d.ts → types/constants.d.ts} +0 -0
  226. /package/build/{events.d.ts → types/events.d.ts} +0 -0
  227. /package/build/{hooks → types/hooks}/useAudioDevices.d.ts +0 -0
  228. /package/build/{index.d.ts → types/index.d.ts} +0 -0
  229. /package/build/{trimAudio.d.ts → types/trimAudio.d.ts} +0 -0
  230. /package/build/{useAudioRecorder.d.ts → types/useAudioRecorder.d.ts} +0 -0
  231. /package/build/{utils → types/utils}/BlobFix.d.ts +0 -0
  232. /package/build/{utils → types/utils}/audioProcessing.d.ts +0 -0
  233. /package/build/{utils → types/utils}/concatenateBuffers.d.ts +0 -0
  234. /package/build/{utils → types/utils}/convertPCMToFloat32.d.ts +0 -0
  235. /package/build/{utils → types/utils}/crc32.d.ts +0 -0
  236. /package/build/{utils → types/utils}/encodingToBitDepth.d.ts +0 -0
  237. /package/build/{utils → types/utils}/getWavFileInfo.d.ts +0 -0
  238. /package/build/{utils → types/utils}/writeWavHeader.d.ts +0 -0
  239. /package/build/{workers → types/workers}/InlineFeaturesExtractor.web.d.ts +0 -0
  240. /package/build/{workers → types/workers}/inlineAudioWebWorker.web.d.ts +0 -0
  241. /package/plugin/build/{index.d.ts → types/index.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlobFix.js","sourceRoot":"","sources":["../../src/utils/BlobFix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,MAAM,QAAQ,GAA4B;IACtC,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI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,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;wBAC7B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;oBAC9B,CAAC;yBAAM,CAAC;wBACJ,OAAO,CAAC,IAAI,CAAC,CAAA;oBACjB,CAAC;gBACL,CAAC;gBAAC,OAAO,EAAE,EAAE,CAAC;oBACV,MAAM,CAAC,EAAE,CAAC,CAAA;gBACd,CAAC;YACL,CAAC,CAAC,CAAA;YAEF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,CAClC,MAAM,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CACxC,CAAA;YAED,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAClC,CAAC;QAAC,OAAO,EAAE,EAAE,CAAC;YACV,MAAM,CAAC,EAAE,CAAC,CAAA;QACd,CAAC;IACL,CAAC,CAAC,CAAA;AACN,CAAC,CAAA","sourcesContent":["/*\n * There is a bug where `navigator.mediaDevices.getUserMedia` + `MediaRecorder`\n * creates WEBM files without duration metadata. See:\n * - https://bugs.chromium.org/p/chromium/issues/detail?id=642012\n * - https://stackoverflow.com/a/39971175/13989043\n *\n * This file contains a function that fixes the duration metadata of a WEBM file.\n * - Answer found: https://stackoverflow.com/a/75218309/13989043\n * - Code adapted from: https://github.com/mat-sz/webm-fix-duration\n * (forked from https://github.com/yusitnikov/fix-webm-duration)\n */\n\n/*\n * This is the list of possible WEBM file sections by their IDs.\n * Possible types: Container, Binary, Uint, Int, String, Float, Date\n */\ninterface Section {\n name: string\n type: string\n}\n\nconst sections: Record<number, Section> = {\n 0xa45dfa3: { name: 'EBML', type: 'Container' },\n 0x286: { name: 'EBMLVersion', type: 'Uint' },\n 0x2f7: { name: 'EBMLReadVersion', type: 'Uint' },\n 0x2f2: { name: 'EBMLMaxIDLength', type: 'Uint' },\n 0x2f3: { name: 'EBMLMaxSizeLength', type: 'Uint' },\n 0x282: { name: 'DocType', type: 'String' },\n 0x287: { name: 'DocTypeVersion', type: 'Uint' },\n 0x285: { name: 'DocTypeReadVersion', type: 'Uint' },\n 0x6c: { name: 'Void', type: 'Binary' },\n 0x3f: { name: 'CRC-32', type: 'Binary' },\n 0xb538667: { name: 'SignatureSlot', type: 'Container' },\n 0x3e8a: { name: 'SignatureAlgo', type: 'Uint' },\n 0x3e9a: { name: 'SignatureHash', type: 'Uint' },\n 0x3ea5: { name: 'SignaturePublicKey', type: 'Binary' },\n 0x3eb5: { name: 'Signature', type: 'Binary' },\n 0x3e5b: { name: 'SignatureElements', type: 'Container' },\n 0x3e7b: { name: 'SignatureElementList', type: 'Container' },\n 0x2532: { name: 'SignedElement', type: 'Binary' },\n 0x8538067: { name: 'Segment', type: 'Container' },\n 0x14d9b74: { name: 'SeekHead', type: 'Container' },\n 0xdbb: { name: 'Seek', type: 'Container' },\n 0x13ab: { name: 'SeekID', type: 'Binary' },\n 0x13ac: { name: 'SeekPosition', type: 'Uint' },\n 0x549a966: { name: 'Info', type: 'Container' },\n 0x33a4: { name: 'SegmentUID', type: 'Binary' },\n 0x3384: { name: 'SegmentFilename', type: 'String' },\n 0x1cb923: { name: 'PrevUID', type: 'Binary' },\n 0x1c83ab: { name: 'PrevFilename', type: 'String' },\n 0x1eb923: { name: 'NextUID', type: 'Binary' },\n 0x1e83bb: { name: 'NextFilename', type: 'String' },\n 0x444: { name: 'SegmentFamily', type: 'Binary' },\n 0x2924: { name: 'ChapterTranslate', type: 'Container' },\n 0x29fc: { name: 'ChapterTranslateEditionUID', type: 'Uint' },\n 0x29bf: { name: 'ChapterTranslateCodec', type: 'Uint' },\n 0x29a5: { name: 'ChapterTranslateID', type: 'Binary' },\n 0xad7b1: { name: 'TimecodeScale', type: 'Uint' },\n 0x489: { name: 'Duration', type: 'Float' },\n 0x461: { name: 'DateUTC', type: 'Date' },\n 0x3ba9: { name: 'Title', type: 'String' },\n 0xd80: { name: 'MuxingApp', type: 'String' },\n 0x1741: { name: 'WritingApp', type: 'String' },\n // 0xf43b675: { name: 'Cluster', type: 'Container' },\n 0x67: { name: 'Timecode', type: 'Uint' },\n 0x1854: { name: 'SilentTracks', type: 'Container' },\n 0x18d7: { name: 'SilentTrackNumber', type: 'Uint' },\n 0x27: { name: 'Position', type: 'Uint' },\n 0x2b: { name: 'PrevSize', type: 'Uint' },\n 0x23: { name: 'SimpleBlock', type: 'Binary' },\n 0x20: { name: 'BlockGroup', type: 'Container' },\n 0x21: { name: 'Block', type: 'Binary' },\n 0x22: { name: 'BlockVirtual', type: 'Binary' },\n 0x35a1: { name: 'BlockAdditions', type: 'Container' },\n 0x26: { name: 'BlockMore', type: 'Container' },\n 0x6e: { name: 'BlockAddID', type: 'Uint' },\n 0x25: { name: 'BlockAdditional', type: 'Binary' },\n 0x1b: { name: 'BlockDuration', type: 'Uint' },\n 0x7a: { name: 'ReferencePriority', type: 'Uint' },\n 0x7b: { name: 'ReferenceBlock', type: 'Int' },\n 0x7d: { name: 'ReferenceVirtual', type: 'Int' },\n 0x24: { name: 'CodecState', type: 'Binary' },\n 0x35a2: { name: 'DiscardPadding', type: 'Int' },\n 0xe: { name: 'Slices', type: 'Container' },\n 0x68: { name: 'TimeSlice', type: 'Container' },\n 0x4c: { name: 'LaceNumber', type: 'Uint' },\n 0x4d: { name: 'FrameNumber', type: 'Uint' },\n 0x4b: { name: 'BlockAdditionID', type: 'Uint' },\n 0x4e: { name: 'Delay', type: 'Uint' },\n 0x4f: { name: 'SliceDuration', type: 'Uint' },\n 0x48: { name: 'ReferenceFrame', type: 'Container' },\n 0x49: { name: 'ReferenceOffset', type: 'Uint' },\n 0x4a: { name: 'ReferenceTimeCode', type: 'Uint' },\n 0x2f: { name: 'EncryptedBlock', type: 'Binary' },\n 0x654ae6b: { name: 'Tracks', type: 'Container' },\n 0x2e: { name: 'TrackEntry', type: 'Container' },\n 0x57: { name: 'TrackNumber', type: 'Uint' },\n 0x33c5: { name: 'TrackUID', type: 'Uint' },\n 0x3: { name: 'TrackType', type: 'Uint' },\n 0x39: { name: 'FlagEnabled', type: 'Uint' },\n 0x8: { name: 'FlagDefault', type: 'Uint' },\n 0x15aa: { name: 'FlagForced', type: 'Uint' },\n 0x1c: { name: 'FlagLacing', type: 'Uint' },\n 0x2de7: { name: 'MinCache', type: 'Uint' },\n 0x2df8: { name: 'MaxCache', type: 'Uint' },\n 0x3e383: { name: 'DefaultDuration', type: 'Uint' },\n 0x34e7a: { name: 'DefaultDecodedFieldDuration', type: 'Uint' },\n 0x3314f: { name: 'TrackTimecodeScale', type: 'Float' },\n 0x137f: { name: 'TrackOffset', type: 'Int' },\n 0x15ee: { name: 'MaxBlockAdditionID', type: 'Uint' },\n 0x136e: { name: 'Name', type: 'String' },\n 0x2b59c: { name: 'Language', type: 'String' },\n 0x6: { name: 'CodecID', type: 'String' },\n 0x23a2: { name: 'CodecPrivate', type: 'Binary' },\n 0x58688: { name: 'CodecName', type: 'String' },\n 0x3446: { name: 'AttachmentLink', type: 'Uint' },\n 0x1a9697: { name: 'CodecSettings', type: 'String' },\n 0x1b4040: { name: 'CodecInfoURL', type: 'String' },\n 0x6b240: { name: 'CodecDownloadURL', type: 'String' },\n 0x2a: { name: 'CodecDecodeAll', type: 'Uint' },\n 0x2fab: { name: 'TrackOverlay', type: 'Uint' },\n 0x16aa: { name: 'CodecDelay', type: 'Uint' },\n 0x16bb: { name: 'SeekPreRoll', type: 'Uint' },\n 0x2624: { name: 'TrackTranslate', type: 'Container' },\n 0x26fc: { name: 'TrackTranslateEditionUID', type: 'Uint' },\n 0x26bf: { name: 'TrackTranslateCodec', type: 'Uint' },\n 0x26a5: { name: 'TrackTranslateTrackID', type: 'Binary' },\n 0x60: { name: 'Video', type: 'Container' },\n 0x1a: { name: 'FlagInterlaced', type: 'Uint' },\n 0x13b8: { name: 'StereoMode', type: 'Uint' },\n 0x13c0: { name: 'AlphaMode', type: 'Uint' },\n 0x13b9: { name: 'OldStereoMode', type: 'Uint' },\n 0x30: { name: 'PixelWidth', type: 'Uint' },\n 0x3a: { name: 'PixelHeight', type: 'Uint' },\n 0x14aa: { name: 'PixelCropBottom', type: 'Uint' },\n 0x14bb: { name: 'PixelCropTop', type: 'Uint' },\n 0x14cc: { name: 'PixelCropLeft', type: 'Uint' },\n 0x14dd: { name: 'PixelCropRight', type: 'Uint' },\n 0x14b0: { name: 'DisplayWidth', type: 'Uint' },\n 0x14ba: { name: 'DisplayHeight', type: 'Uint' },\n 0x14b2: { name: 'DisplayUnit', type: 'Uint' },\n 0x14b3: { name: 'AspectRatioType', type: 'Uint' },\n 0xeb524: { name: 'ColourSpace', type: 'Binary' },\n 0xfb523: { name: 'GammaValue', type: 'Float' },\n 0x383e3: { name: 'FrameRate', type: 'Float' },\n 0x61: { name: 'Audio', type: 'Container' },\n 0x35: { name: 'SamplingFrequency', type: 'Float' },\n 0x38b5: { name: 'OutputSamplingFrequency', type: 'Float' },\n 0x1f: { name: 'Channels', type: 'Uint' },\n 0x3d7b: { name: 'ChannelPositions', type: 'Binary' },\n 0x2264: { name: 'BitDepth', type: 'Uint' },\n 0x62: { name: 'TrackOperation', type: 'Container' },\n 0x63: { name: 'TrackCombinePlanes', type: 'Container' },\n 0x64: { name: 'TrackPlane', type: 'Container' },\n 0x65: { name: 'TrackPlaneUID', type: 'Uint' },\n 0x66: { name: 'TrackPlaneType', type: 'Uint' },\n 0x69: { name: 'TrackJoinBlocks', type: 'Container' },\n 0x6d: { name: 'TrackJoinUID', type: 'Uint' },\n 0x40: { name: 'TrickTrackUID', type: 'Uint' },\n 0x41: { name: 'TrickTrackSegmentUID', type: 'Binary' },\n 0x46: { name: 'TrickTrackFlag', type: 'Uint' },\n 0x47: { name: 'TrickMasterTrackUID', type: 'Uint' },\n 0x44: { name: 'TrickMasterTrackSegmentUID', type: 'Binary' },\n 0x2d80: { name: 'ContentEncodings', type: 'Container' },\n 0x2240: { name: 'ContentEncoding', type: 'Container' },\n 0x1031: { name: 'ContentEncodingOrder', type: 'Uint' },\n 0x1032: { name: 'ContentEncodingScope', type: 'Uint' },\n 0x1033: { name: 'ContentEncodingType', type: 'Uint' },\n 0x1034: { name: 'ContentCompression', type: 'Container' },\n 0x254: { name: 'ContentCompAlgo', type: 'Uint' },\n 0x255: { name: 'ContentCompSettings', type: 'Binary' },\n 0x1035: { name: 'ContentEncryption', type: 'Container' },\n 0x7e1: { name: 'ContentEncAlgo', type: 'Uint' },\n 0x7e2: { name: 'ContentEncKeyID', type: 'Binary' },\n 0x7e3: { name: 'ContentSignature', type: 'Binary' },\n 0x7e4: { name: 'ContentSigKeyID', type: 'Binary' },\n 0x7e5: { name: 'ContentSigAlgo', type: 'Uint' },\n 0x7e6: { name: 'ContentSigHashAlgo', type: 'Uint' },\n 0xc53bb6b: { name: 'Cues', type: 'Container' },\n 0x3b: { name: 'CuePoint', type: 'Container' },\n 0x33: { name: 'CueTime', type: 'Uint' },\n 0x37: { name: 'CueTrackPositions', type: 'Container' },\n 0x77: { name: 'CueTrack', type: 'Uint' },\n 0x71: { name: 'CueClusterPosition', type: 'Uint' },\n 0x70: { name: 'CueRelativePosition', type: 'Uint' },\n 0x32: { name: 'CueDuration', type: 'Uint' },\n 0x1378: { name: 'CueBlockNumber', type: 'Uint' },\n 0x6a: { name: 'CueCodecState', type: 'Uint' },\n 0x5b: { name: 'CueReference', type: 'Container' },\n 0x16: { name: 'CueRefTime', type: 'Uint' },\n 0x17: { name: 'CueRefCluster', type: 'Uint' },\n 0x135f: { name: 'CueRefNumber', type: 'Uint' },\n 0x6b: { name: 'CueRefCodecState', type: 'Uint' },\n 0x941a469: { name: 'Attachments', type: 'Container' },\n 0x21a7: { name: 'AttachedFile', type: 'Container' },\n 0x67e: { name: 'FileDescription', type: 'String' },\n 0x66e: { name: 'FileName', type: 'String' },\n 0x660: { name: 'FileMimeType', type: 'String' },\n 0x65c: { name: 'FileData', type: 'Binary' },\n 0x6ae: { name: 'FileUID', type: 'Uint' },\n 0x675: { name: 'FileReferral', type: 'Binary' },\n 0x661: { name: 'FileUsedStartTime', type: 'Uint' },\n 0x662: { name: 'FileUsedEndTime', type: 'Uint' },\n 0x43a770: { name: 'Chapters', type: 'Container' },\n 0x5b9: { name: 'EditionEntry', type: 'Container' },\n 0x5bc: { name: 'EditionUID', type: 'Uint' },\n 0x5bd: { name: 'EditionFlagHidden', type: 'Uint' },\n 0x5db: { name: 'EditionFlagDefault', type: 'Uint' },\n 0x5dd: { name: 'EditionFlagOrdered', type: 'Uint' },\n 0x36: { name: 'ChapterAtom', type: 'Container' },\n 0x33c4: { name: 'ChapterUID', type: 'Uint' },\n 0x1654: { name: 'ChapterStringUID', type: 'String' },\n 0x11: { name: 'ChapterTimeStart', type: 'Uint' },\n 0x12: { name: 'ChapterTimeEnd', type: 'Uint' },\n 0x18: { name: 'ChapterFlagHidden', type: 'Uint' },\n 0x598: { name: 'ChapterFlagEnabled', type: 'Uint' },\n 0x2e67: { name: 'ChapterSegmentUID', type: 'Binary' },\n 0x2ebc: { name: 'ChapterSegmentEditionUID', type: 'Uint' },\n 0x23c3: { name: 'ChapterPhysicalEquiv', type: 'Uint' },\n 0xf: { name: 'ChapterTrack', type: 'Container' },\n 0x9: { name: 'ChapterTrackNumber', type: 'Uint' },\n 0x0: { name: 'ChapterDisplay', type: 'Container' },\n 0x5: { name: 'ChapString', type: 'String' },\n 0x37c: { name: 'ChapLanguage', type: 'String' },\n 0x37e: { name: 'ChapCountry', type: 'String' },\n 0x2944: { name: 'ChapProcess', type: 'Container' },\n 0x2955: { name: 'ChapProcessCodecID', type: 'Uint' },\n 0x50d: { name: 'ChapProcessPrivate', type: 'Binary' },\n 0x2911: { name: 'ChapProcessCommand', type: 'Container' },\n 0x2922: { name: 'ChapProcessTime', type: 'Uint' },\n 0x2933: { name: 'ChapProcessData', type: 'Binary' },\n 0x254c367: { name: 'Tags', type: 'Container' },\n 0x3373: { name: 'Tag', type: 'Container' },\n 0x23c0: { name: 'Targets', type: 'Container' },\n 0x28ca: { name: 'TargetTypeValue', type: 'Uint' },\n 0x23ca: { name: 'TargetType', type: 'String' },\n 0x23c5: { name: 'TagTrackUID', type: 'Uint' },\n 0x23c9: { name: 'TagEditionUID', type: 'Uint' },\n 0x23c4: { name: 'TagChapterUID', type: 'Uint' },\n 0x23c6: { name: 'TagAttachmentUID', type: 'Uint' },\n 0x27c8: { name: 'SimpleTag', type: 'Container' },\n 0x5a3: { name: 'TagName', type: 'String' },\n 0x47a: { name: 'TagLanguage', type: 'String' },\n 0x484: { name: 'TagDefault', type: 'Uint' },\n 0x487: { name: 'TagString', type: 'String' },\n 0x485: { name: 'TagBinary', type: 'Binary' },\n}\n\nclass WebmBase<T> {\n source?: Uint8Array\n data?: T\n name: string\n type: string\n\n constructor(name = 'Unknown', type = 'Unknown') {\n this.name = name\n this.type = type\n }\n\n updateBySource() {}\n\n setSource(source: Uint8Array) {\n this.source = source\n this.updateBySource()\n }\n\n updateByData() {}\n\n setData(data: T) {\n this.data = data\n this.updateByData()\n }\n}\n\nclass WebmUint extends WebmBase<string> {\n constructor(name: string, type: string) {\n super(name, type || 'Uint')\n }\n\n updateBySource() {\n // use hex representation of a number instead of number value\n this.data = ''\n for (let i = 0; i < this.source!.length; i++) {\n const hex = this.source![i].toString(16)\n this.data += padHex(hex)\n }\n }\n\n updateByData() {\n const length = this.data!.length / 2\n this.source = new Uint8Array(length)\n for (let i = 0; i < length; i++) {\n const hex = this.data!.substr(i * 2, 2)\n this.source[i] = parseInt(hex, 16)\n }\n }\n\n getValue() {\n return parseInt(this.data!, 16)\n }\n\n setValue(value: number) {\n this.setData(padHex(value.toString(16)))\n }\n}\n\nfunction padHex(hex: string) {\n return hex.length % 2 === 1 ? '0' + hex : hex\n}\n\nclass WebmFloat extends WebmBase<number> {\n constructor(name: string, type: string) {\n super(name, type || 'Float')\n }\n\n getFloatArrayType() {\n return this.source && this.source.length === 4\n ? Float32Array\n : Float64Array\n }\n updateBySource() {\n const byteArray = this.source!.reverse()\n const floatArrayType = this.getFloatArrayType()\n const buffer = new ArrayBuffer(byteArray.buffer.byteLength)\n new Uint8Array(buffer).set(new Uint8Array(byteArray.buffer))\n const floatArray = new floatArrayType(buffer)\n this.data! = floatArray[0]\n }\n updateByData() {\n const floatArrayType = this.getFloatArrayType()\n const floatArray = new floatArrayType([this.data!])\n const byteArray = new Uint8Array(floatArray.buffer)\n this.source = byteArray.reverse()\n }\n getValue() {\n return this.data\n }\n setValue(value: number) {\n this.setData(value)\n }\n}\n\ninterface ContainerData {\n id: number\n idHex?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: WebmBase<any>\n}\n\nclass WebmContainer extends WebmBase<ContainerData[]> {\n offset: number = 0\n data: ContainerData[] = []\n\n constructor(name: string, type: string) {\n super(name, type || 'Container')\n }\n\n readByte() {\n return this.source![this.offset++]\n }\n readUint() {\n const firstByte = this.readByte()\n const bytes = 8 - firstByte.toString(2).length\n let value = firstByte - (1 << (7 - bytes))\n for (let i = 0; i < bytes; i++) {\n // don't use bit operators to support x86\n value *= 256\n value += this.readByte()\n }\n return value\n }\n updateBySource() {\n let end: number | undefined = undefined\n this.data = []\n for (\n this.offset = 0;\n this.offset < this.source!.length;\n this.offset = end\n ) {\n const id = this.readUint()\n const len = this.readUint()\n end = Math.min(this.offset + len, this.source!.length)\n const data = this.source!.slice(this.offset, end)\n\n const info = sections[id] || { name: 'Unknown', type: 'Unknown' }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let ctr: any = WebmBase\n switch (info.type) {\n case 'Container':\n ctr = WebmContainer\n break\n case 'Uint':\n ctr = WebmUint\n break\n case 'Float':\n ctr = WebmFloat\n break\n }\n const section = new ctr(info.name, info.type)\n section.setSource(data)\n this.data.push({\n id,\n idHex: id.toString(16),\n data: section,\n })\n }\n }\n writeUint(x: number, draft = false) {\n let flag = 0x80\n let bytes = 1\n // eslint-disable-next-line no-empty\n for (; x >= flag && bytes < 8; bytes++, flag *= 0x80) {}\n\n if (!draft) {\n let value = flag + x\n for (let i = bytes - 1; i >= 0; i--) {\n // don't use bit operators to support x86\n const c = value % 256\n this.source![this.offset! + i] = c\n value = (value - c) / 256\n }\n }\n\n this.offset += bytes\n }\n\n writeSections(draft = false) {\n this.offset = 0\n for (let i = 0; i < this.data.length; i++) {\n const section = this.data[i],\n content = section.data.source,\n contentLength = content!.length\n this.writeUint(section.id, draft)\n this.writeUint(contentLength, draft)\n if (!draft) {\n this.source!.set(content!, this.offset)\n }\n this.offset += contentLength\n }\n return this.offset\n }\n\n updateByData() {\n // run without accessing this.source to determine total length - need to know it to create Uint8Array\n const length = this.writeSections(true)\n this.source = new Uint8Array(length)\n // now really write data\n this.writeSections()\n }\n\n getSectionById(id: number) {\n for (let i = 0; i < this.data.length; i++) {\n const section = this.data[i]\n if (section.id === id) {\n return section.data\n }\n }\n\n return undefined\n }\n}\n\nclass WebmFile extends WebmContainer {\n constructor(source: Uint8Array) {\n super('File', 'File')\n this.setSource(source)\n }\n\n fixDuration(duration: number) {\n const segmentSection = this.getSectionById(0x8538067) as WebmContainer\n if (!segmentSection) {\n return false\n }\n\n const infoSection = segmentSection.getSectionById(\n 0x549a966\n ) as WebmContainer\n if (!infoSection) {\n return false\n }\n\n const timeScaleSection = infoSection.getSectionById(\n 0xad7b1\n ) as WebmFloat\n if (!timeScaleSection) {\n return false\n }\n\n let durationSection = infoSection.getSectionById(0x489) as WebmFloat\n if (durationSection) {\n if (durationSection.getValue()! <= 0) {\n durationSection.setValue(duration)\n } else {\n return false\n }\n } else {\n // append Duration section\n durationSection = new WebmFloat('Duration', 'Float')\n durationSection.setValue(duration)\n infoSection.data.push({\n id: 0x489,\n data: durationSection,\n })\n }\n\n // set default time scale to 1 millisecond (1000000 nanoseconds)\n timeScaleSection.setValue(1000000)\n infoSection.updateByData()\n segmentSection.updateByData()\n this.updateByData()\n\n return true\n }\n\n toBlob(type = 'video/webm') {\n const buffer = new ArrayBuffer(this.source!.buffer.byteLength)\n new Uint8Array(buffer).set(new Uint8Array(this.source!.buffer))\n return new Blob([buffer], { type })\n }\n}\n\n/**\n * Fixes duration on MediaRecorder output.\n * @param blob Input Blob with incorrect duration.\n * @param duration Correct duration (in milliseconds).\n * @param type Output blob mimetype (default: video/webm).\n * @returns\n */\nexport const webmFixDuration = (\n blob: Blob,\n duration: number,\n type = 'video/webm'\n): Promise<Blob> => {\n return new Promise((resolve, reject) => {\n try {\n const reader = new FileReader()\n\n reader.addEventListener('loadend', () => {\n try {\n const result = reader.result as ArrayBuffer\n const file = new WebmFile(new Uint8Array(result))\n if (file.fixDuration(duration)) {\n resolve(file.toBlob(type))\n } else {\n resolve(blob)\n }\n } catch (ex) {\n reject(ex)\n }\n })\n\n reader.addEventListener('error', () =>\n reject(new Error('FileReader error'))\n )\n\n reader.readAsArrayBuffer(blob)\n } catch (ex) {\n reject(ex)\n }\n })\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioProcessing.d.ts","sourceRoot":"","sources":["../../src/utils/audioProcessing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,MAAM,WAAW,yBAAyB;IACtC,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAA;CACvB;AAED,MAAM,WAAW,kBAAkB;IAC/B,WAAW,EAAE,YAAY,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,WAAW,CAAA;CACtB;AAED,wBAAsB,kBAAkB,CAAC,EACrC,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,MAAM,GACT,EAAE,yBAAyB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAoKzD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioProcessing.js","sourceRoot":"","sources":["../../src/utils/audioProcessing.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AA2BvC,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,EACrC,WAAW,EACX,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,MAAM,GACkB;IACxB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAClE,CAAC;IAED,IAAI,GAA6B,CAAA;IACjC,IAAI,MAA+B,CAAA;IAEnC,IAAI,CAAC;QACD,yBAAyB;QACzB,MAAM,EAAE,KAAK,CAAC,wCAAwC,EAAE;YACpD,cAAc,EAAE,CAAC,CAAC,WAAW;YAC7B,OAAO;YACP,gBAAgB;YAChB,cAAc;YACd,cAAc;YACd,WAAW;YACX,SAAS;YACT,QAAQ;YACR,MAAM;SACT,CAAC,CAAA;QAEF,qBAAqB;QACrB,IAAI,SAAsB,CAAA;QAC1B,IAAI,WAAW,EAAE,CAAC;YACd,SAAS,GAAG,WAAW,CAAA;QAC3B,CAAC;aAAM,IAAI,OAAO,EAAE,CAAC;YACjB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAA;YACrC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC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;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,EAAE,KAAK,CAAC,iCAAiC,EAAE;YAC7C,KAAK;YACL,QAAQ;YACR,MAAM;YACN,WAAW;YACX,SAAS;YACT,YAAY,EAAE,MAAM,EAAE,MAAM;SAC/B,CAAC,CAAA;QACF,MAAM,KAAK,CAAA;IACf,CAAC;YAAS,CAAC;QACP,IAAI,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC;YACvB,MAAM,GAAG,CAAC,KAAK,EAAE,CAAA;QACrB,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["// packages/expo-audio-stream/src/utils/audioProcessing.ts\nimport { Platform } from 'react-native'\n\nimport { ConsoleLike } from '../ExpoAudioStream.types'\n\nexport interface ProcessAudioBufferOptions {\n arrayBuffer?: ArrayBuffer\n fileUri?: string\n targetSampleRate: number\n targetChannels: number\n normalizeAudio: boolean\n startTimeMs?: number\n endTimeMs?: number\n position?: number\n length?: number\n audioContext?: AudioContext\n logger?: ConsoleLike\n}\n\nexport interface ProcessedAudioData {\n channelData: Float32Array\n samples: number\n durationMs: number\n sampleRate: number\n channels: number\n buffer: AudioBuffer\n}\n\nexport async function processAudioBuffer({\n arrayBuffer,\n fileUri,\n targetSampleRate,\n targetChannels,\n normalizeAudio,\n startTimeMs,\n endTimeMs,\n position,\n length,\n audioContext,\n logger,\n}: ProcessAudioBufferOptions): Promise<ProcessedAudioData> {\n if (Platform.OS !== 'web') {\n throw new Error('processAudioBuffer is only supported on web')\n }\n\n let ctx: AudioContext | undefined\n let buffer: AudioBuffer | undefined\n\n try {\n // Log initial parameters\n logger?.debug('Process audio buffer - Initial params:', {\n hasArrayBuffer: !!arrayBuffer,\n fileUri,\n targetSampleRate,\n targetChannels,\n normalizeAudio,\n startTimeMs,\n endTimeMs,\n position,\n length,\n })\n\n // Get the audio data\n let audioData: ArrayBuffer\n if (arrayBuffer) {\n audioData = arrayBuffer\n } else if (fileUri) {\n const response = await fetch(fileUri)\n if (!response.ok) {\n throw new Error(\n `Failed to fetch fileUri: ${response.statusText}`\n )\n }\n audioData = await response.arrayBuffer()\n } else {\n throw new Error('Either arrayBuffer or fileUri must be provided')\n }\n\n logger?.debug('Audio data loaded:', {\n byteLength: audioData.byteLength,\n firstBytes: Array.from(new Uint8Array(audioData.slice(0, 16))),\n })\n\n // Create context at original sample rate first\n ctx =\n audioContext ||\n new (window.AudioContext || (window as any).webkitAudioContext)()\n buffer = await ctx.decodeAudioData(audioData)\n\n logger?.debug('Decoded audio buffer:', {\n originalChannels: buffer.numberOfChannels,\n originalSampleRate: buffer.sampleRate,\n originalDuration: buffer.duration,\n originalLength: buffer.length,\n })\n\n // Calculate time range\n const startSample =\n startTimeMs !== undefined\n ? Math.floor((startTimeMs / 1000) * buffer.sampleRate)\n : position !== undefined\n ? Math.floor(position / 2)\n : 0\n\n // Fix: Adjust position calculation based on original sample rate\n // When position is provided in bytes, we need to account for the original sample rate\n const bytesPerSample = 2 // 16-bit audio = 2 bytes per sample\n const adjustedStartSample =\n position !== undefined\n ? Math.floor(\n (position / bytesPerSample) *\n (buffer.sampleRate / targetSampleRate)\n )\n : startSample\n\n const samplesNeeded =\n length !== undefined\n ? Math.floor(\n (length / bytesPerSample) *\n (buffer.sampleRate / targetSampleRate)\n )\n : endTimeMs !== undefined && startTimeMs !== undefined\n ? Math.floor(\n ((endTimeMs - startTimeMs) / 1000) * buffer.sampleRate\n )\n : buffer.length - adjustedStartSample\n\n logger?.debug('Sample calculations (adjusted):', {\n originalStartSample: startSample,\n adjustedStartSample,\n samplesNeeded,\n originalSampleRate: buffer.sampleRate,\n targetSampleRate,\n conversionRatio: buffer.sampleRate / targetSampleRate,\n expectedDurationMs: (samplesNeeded / buffer.sampleRate) * 1000,\n })\n\n // Create temporary buffer for the segment\n const segmentBuffer = ctx.createBuffer(\n buffer.numberOfChannels,\n samplesNeeded,\n buffer.sampleRate\n )\n\n // Copy the segment\n for (let channel = 0; channel < buffer.numberOfChannels; channel++) {\n const channelData = buffer.getChannelData(channel)\n const segmentData = segmentBuffer.getChannelData(channel)\n for (let i = 0; i < samplesNeeded; i++) {\n segmentData[i] = channelData[adjustedStartSample + i]\n }\n }\n\n // Create offline context for resampling\n const offlineCtx = new OfflineAudioContext(\n targetChannels,\n Math.ceil((samplesNeeded * targetSampleRate) / buffer.sampleRate),\n targetSampleRate\n )\n\n // Create source and connect\n const source = offlineCtx.createBufferSource()\n source.buffer = segmentBuffer\n source.connect(offlineCtx.destination)\n\n // Render at new sample rate\n source.start()\n const processedBuffer = await offlineCtx.startRendering()\n\n // Get the final audio data\n const channelData = processedBuffer.getChannelData(0)\n const durationMs = Math.round(\n (samplesNeeded / buffer.sampleRate) * 1000\n )\n\n logger?.debug('Final processed audio:', {\n outputSamples: channelData.length,\n outputSampleRate: targetSampleRate,\n durationMs,\n })\n\n return {\n buffer: processedBuffer,\n channelData,\n samples: channelData.length,\n durationMs,\n sampleRate: targetSampleRate,\n channels: processedBuffer.numberOfChannels,\n }\n } catch (error) {\n logger?.error('Failed to process audio buffer:', {\n error,\n position,\n length,\n startTimeMs,\n endTimeMs,\n bufferLength: buffer?.length,\n })\n throw error\n } finally {\n if (!audioContext && ctx) {\n await ctx.close()\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"concatenateBuffers.d.ts","sourceRoot":"","sources":["../../src/utils/concatenateBuffers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,YAAa,WAAW,EAAE,KAAG,WAiB3D,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"concatenateBuffers.js","sourceRoot":"","sources":["../../src/utils/concatenateBuffers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAsB,EAAe,EAAE;IACtE,2CAA2C;IAC3C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IACvD,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,MAAM,CAAC,UAAU,EACxC,CAAC,CACJ,CAAA;IACD,0DAA0D;IAC1D,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CAAC,CAAA;IAC1C,mEAAmE;IACnE,IAAI,MAAM,GAAG,CAAC,CAAA;IAEd,KAAK,MAAM,MAAM,IAAI,YAAY,EAAE,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAA;QAC1C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAA;IAC/B,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAA;AACxB,CAAC,CAAA","sourcesContent":["/**\n * Concatenates an array of ArrayBuffers into a single ArrayBuffer.\n *\n * @param buffers - An array of ArrayBuffers to be concatenated.\n * @returns A single ArrayBuffer containing the concatenated data.\n */\nexport const concatenateBuffers = (buffers: ArrayBuffer[]): ArrayBuffer => {\n // Filter out any undefined or null buffers\n const validBuffers = buffers.filter((buffer) => buffer)\n const totalLength = validBuffers.reduce(\n (sum, buffer) => sum + buffer.byteLength,\n 0\n )\n // Create a new Uint8Array to hold the concatenated result\n const result = new Uint8Array(totalLength)\n // Offset to keep track of the current position in the result array\n let offset = 0\n\n for (const buffer of validBuffers) {\n result.set(new Uint8Array(buffer), offset)\n offset += buffer.byteLength\n }\n return result.buffer\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"convertPCMToFloat32.d.ts","sourceRoot":"","sources":["../../src/utils/convertPCMToFloat32.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,eAAO,MAAM,eAAe,KAAK,CAAA;AA+DjC,eAAO,MAAM,mBAAmB;YAMpB,WAAW;cACT,MAAM;;;MAGhB,QAAQ;I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B,CAAC;gBACL,CAAC;YACL,CAAC;YAED,oDAAoD;YACpD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,KAAK,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC;gBACjD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;YAC1D,CAAC;QACL,CAAC;QAED,MAAM,EAAE,KAAK,CACT,gCAAgC,YAAY,CAAC,MAAM,aAAa,GAAG,KAAK,GAAG,GAAG,CACjF,CAAA;QAED,2DAA2D;QAC3D,IAAI,MAAM,EAAE,KAAK,EAAE,CAAC;YAChB,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;YACzD,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;QAED,OAAO;YACH,SAAS,EAAE,YAAY;YACvB,GAAG;YACH,GAAG;SACN,CAAA;IACL,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,MAAM,EAAE,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;QACvD,MAAM,KAAK,CAAA;IACf,CAAC;AACL,CAAC,CAAA","sourcesContent":["import { Platform } from 'react-native'\n\nimport { ConsoleLike } from '../ExpoAudioStream.types'\nimport { getWavFileInfo, WavFileInfo } from './getWavFileInfo'\n\nexport const WAV_HEADER_SIZE = 44\n\nconst convertSample = (\n dataView: DataView,\n offset: number,\n bitDepth: number\n): number => {\n switch (bitDepth) {\n case 8:\n return (dataView.getUint8(offset) - 128) / 128\n case 16:\n return dataView.getInt16(offset, true) / 32768\n case 24:\n return (\n ((dataView.getUint8(offset) |\n (dataView.getUint8(offset + 1) << 8) |\n (dataView.getUint8(offset + 2) << 16)) /\n 8388608) *\n 2 -\n 1\n )\n case 32:\n return dataView.getFloat32(offset, true)\n default:\n throw new Error(`Unsupported bit depth: ${bitDepth}`)\n }\n}\n\nconst convertSampleNative = (\n array: Uint8Array,\n startIndex: number,\n bitDepth: number\n): number => {\n switch (bitDepth) {\n case 8:\n return (array[startIndex] - 128) / 128\n case 16: {\n // Handle 16-bit PCM using Uint8Array directly\n const low = array[startIndex]\n const high = array[startIndex + 1]\n const value = (high << 8) | low\n // Convert to signed 16-bit\n return (value > 32767 ? value - 65536 : value) / 32768\n }\n case 24: {\n const byte1 = array[startIndex]\n const byte2 = array[startIndex + 1]\n const byte3 = array[startIndex + 2]\n const value = (byte3 << 16) | (byte2 << 8) | byte1\n return (\n ((value > 8388607 ? value - 16777216 : value) / 8388608) * 2 - 1\n )\n }\n case 32: {\n // Assuming 32-bit float\n const view = new DataView(array.buffer, startIndex, 4)\n return view.getFloat32(0, true)\n }\n default:\n throw new Error(`Unsupported bit depth: ${bitDepth}`)\n }\n}\n\nexport const convertPCMToFloat32 = async ({\n bitDepth,\n buffer,\n skipWavHeader = false,\n logger,\n}: {\n buffer: ArrayBuffer\n bitDepth: number\n skipWavHeader?: boolean\n logger?: ConsoleLike\n}): Promise<{ pcmValues: Float32Array; min: number; max: number }> => {\n try {\n logger?.debug(\n `Converting PCM to Float32: bitDepth: ${bitDepth}, buffer.byteLength: ${buffer.byteLength}`\n )\n\n let headerOffset = 0\n if (!skipWavHeader) {\n const wavFileInfo: WavFileInfo = await getWavFileInfo(buffer)\n headerOffset = wavFileInfo.dataChunkOffset\n logger?.debug(`Using WAV header offset: ${headerOffset}`)\n }\n\n // Convert ArrayBuffer to Uint8Array for more efficient native handling\n const uint8Array = new Uint8Array(buffer)\n const dataLength = buffer.byteLength - headerOffset\n const bytesPerSample = bitDepth / 8\n const sampleLength = Math.floor(dataLength / bytesPerSample)\n\n // Create result array using SharedArrayBuffer for better memory handling\n let float32Array: Float32Array\n try {\n // Try using SharedArrayBuffer first\n const sharedBuffer = new SharedArrayBuffer(sampleLength * 4)\n float32Array = new Float32Array(sharedBuffer)\n } catch (e) {\n // Fallback to regular ArrayBuffer if SharedArrayBuffer is not available\n float32Array = new Float32Array(sampleLength)\n }\n\n let min = Infinity\n let max = -Infinity\n\n // Process in smaller chunks\n const CHUNK_SIZE = Platform.OS === 'web' ? sampleLength : 4000 // Smaller chunks for native\n const numChunks = Math.ceil(sampleLength / CHUNK_SIZE)\n\n for (let chunk = 0; chunk < numChunks; chunk++) {\n const startSample = chunk * CHUNK_SIZE\n const endSample = Math.min((chunk + 1) * CHUNK_SIZE, sampleLength)\n\n // Process chunk\n for (let i = startSample; i < endSample; i++) {\n const startIndex = headerOffset + i * bytesPerSample\n if (startIndex + bytesPerSample <= uint8Array.length) {\n const value =\n Platform.OS === 'web'\n ? convertSample(\n new DataView(buffer),\n startIndex,\n bitDepth\n )\n : convertSampleNative(\n uint8Array,\n startIndex,\n bitDepth\n )\n\n if (isFinite(value)) {\n float32Array[i] = value\n min = Math.min(min, value)\n max = Math.max(max, value)\n }\n }\n }\n\n // Allow garbage collection between chunks on native\n if (Platform.OS !== 'web' && chunk < numChunks - 1) {\n await new Promise((resolve) => setTimeout(resolve, 0))\n }\n }\n\n logger?.debug(\n `Conversion complete. Length: ${float32Array.length}, Range: [${min}, ${max}]`\n )\n\n // Only log a small sample of values to avoid memory issues\n if (logger?.debug) {\n const sampleValues = Array.from(float32Array.slice(0, 5))\n logger.debug('Sample values:', sampleValues)\n }\n\n return {\n pcmValues: float32Array,\n min,\n max,\n }\n } catch (error: unknown) {\n logger?.error(`Error converting PCM to Float32`, error)\n throw error\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"crc32.d.ts","sourceRoot":"","sources":["../../src/utils/crc32.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,KAAK;IAClB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;IACnC,GAAG,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAAA;CAChC;AAsCD,QAAA,IAAI,mBAAmB,EA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,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;QAC/D,CAAC;IACL,CAAC;SAAM,IAAI,IAAI,YAAY,UAAU,EAAE,CAAC;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;YACnC,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;QAC3D,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;IACnE,CAAC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;AACnE,CAAC;AACD,0CAA0C;AAE1C,IAAI,mBAA0B,CAAA;AAE9B,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;IACxB,gCAAgC;IAChC,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;QACjD,GAAG,EAAE,CAAC,IAAgB,EAAU,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;KAC3D,CAAC,CAAA;AACN,CAAC;KAAM,CAAC;IACJ,4CAA4C;IAC5C,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,eAAe,mBAAmB,CAAA","sourcesContent":["// Bundler (Metro/Webpack) will automatically resolve to crc32.web.ts or crc32.native.ts.\n\nimport { Platform } from 'react-native'\n\n// Define the interface first\nexport interface CRC32 {\n (data: string | Uint8Array): number\n buf(data: Uint8Array): number\n}\n\n// --- Web CRC32 Calculation Logic ---\nlet webCrcTable: Uint32Array | undefined\nfunction computeWebCrc32(data: string | Uint8Array): number {\n // Lazily compute the table only on web when first needed\n if (!webCrcTable) {\n webCrcTable = (() => {\n const table = new Uint32Array(256)\n for (let i = 0; i < 256; ++i) {\n let crc = i\n for (let j = 0; j < 8; ++j) {\n crc = crc & 1 ? (crc >>> 1) ^ 0xedb88320 : crc >>> 1\n }\n table[i] = crc\n }\n return table\n })()\n }\n\n let crc = -1 // Initialize with 0xFFFFFFFF\n if (typeof data === 'string') {\n const strBytes = new TextEncoder().encode(data)\n for (let i = 0; i < strBytes.length; ++i) {\n crc = (crc >>> 8) ^ webCrcTable[(crc ^ strBytes[i]) & 0xff]\n }\n } else if (data instanceof Uint8Array) {\n for (let i = 0; i < data.length; ++i) {\n crc = (crc >>> 8) ^ webCrcTable[(crc ^ data[i]) & 0xff]\n }\n } else {\n throw new Error('Unsupported data type for CRC32 calculation.')\n }\n\n return (crc ^ -1) >>> 0 // Final XOR and ensure unsigned 32-bit\n}\n// --- End Web CRC32 Calculation Logic ---\n\nlet crc32Implementation: CRC32\n\nif (Platform.OS === 'web') {\n // Assign the web implementation\n crc32Implementation = Object.assign(computeWebCrc32, {\n buf: (data: Uint8Array): number => computeWebCrc32(data),\n })\n} else {\n // No-op implementation for native platforms\n crc32Implementation = Object.assign(() => 0, { buf: () => 0 })\n}\n\nexport default crc32Implementation\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"encodingToBitDepth.d.ts","sourceRoot":"","sources":["../../src/utils/encodingToBitDepth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,kBAAkB;cAGjB,YAAY;MACtB,QAWH,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"encodingToBitDepth.js","sourceRoot":"","sources":["../../src/utils/encodingToBitDepth.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,QAAQ,GAGX,EAAY,EAAE;IACX,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,WAAW;YACZ,OAAO,EAAE,CAAA;QACb,KAAK,WAAW;YACZ,OAAO,EAAE,CAAA;QACb,KAAK,UAAU;YACX,OAAO,CAAC,CAAA;QACZ;YACI,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAA;IACjE,CAAC;AACL,CAAC,CAAA","sourcesContent":["import { BitDepth, EncodingType } from '../ExpoAudioStream.types'\n\nexport const encodingToBitDepth = ({\n encoding,\n}: {\n encoding: EncodingType\n}): BitDepth => {\n switch (encoding) {\n case 'pcm_32bit':\n return 32\n case 'pcm_16bit':\n return 16\n case 'pcm_8bit':\n return 8\n default:\n throw new Error(`Unsupported encoding type: ${encoding}`)\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getWavFileInfo.d.ts","sourceRoot":"","sources":["../../src/utils/getWavFileInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAoB/D;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;CAC1B;AAED;;;;;GAKG;AACH,eAAO,MAAM,cAAc,gBACV,WAAW,KACzB,QAAQ,WAAW,CAmFrB,CAAA"}
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SampleRate } from '../ExpoAudioStream.types'\nimport {\n DATA_CHUNK_ID,\n DEFAULT_BIT_DEPTH,\n DEFAULT_SAMPLE_RATE,\n FMT_CHUNK_ID,\n INFO_CHUNK_ID,\n RIFF_HEADER,\n WAVE_HEADER,\n} from '../constants'\n\n// Audio format descriptions\nconst AUDIO_FORMATS: { [key: number]: string } = {\n 1: 'PCM',\n 3: 'IEEE float',\n 6: '8-bit ITU-T G.711 A-law',\n 7: '8-bit ITU-T G.711 µ-law',\n 65534: 'WAVE_FORMAT_EXTENSIBLE',\n}\n\n/**\n * Interface representing the metadata of a WAV file.\n */\nexport interface WavFileInfo {\n sampleRate: SampleRate\n numChannels: number\n bitDepth: BitDepth\n size: number // in bytes\n durationMs: number // in ms\n audioFormatDescription: string // Description of the audio format\n byteRate: number // Average bytes per second\n blockAlign: number // Number of bytes for one sample including all channels\n creationDateTime?: string // Optional creation date and time\n comments?: string // Optional comments or tags\n compressionType?: string // Optional compression type\n dataChunkOffset: number // Position of the first data chunk\n}\n\n/**\n * Extracts metadata from a WAV buffer.\n *\n * @param arrayBuffer - The array buffer containing the WAV data.\n * @returns A promise that resolves to the extracted metadata.\n */\nexport const getWavFileInfo = async (\n arrayBuffer: ArrayBuffer\n): Promise<WavFileInfo> => {\n const view = new DataView(arrayBuffer)\n\n // Check if the file is a valid RIFF/WAVE file\n const riffHeader = view.getUint32(0, false)\n const waveHeader = view.getUint32(8, false)\n if (riffHeader !== RIFF_HEADER || waveHeader !== WAVE_HEADER) {\n throw new Error('Invalid WAV file')\n }\n\n // Initialize variables for the metadata\n let fmtChunkOffset = 12\n let sampleRate: SampleRate = DEFAULT_SAMPLE_RATE\n let numChannels = 0\n let bitDepth: BitDepth = DEFAULT_BIT_DEPTH\n let dataChunkSize = 0\n let audioFormat = 0\n let byteRate = 0\n let blockAlign = 0\n let creationDateTime = ''\n let comments = ''\n let dataChunkOffset = 0\n\n // Parse chunks to find the \"fmt \" and \"data\" chunks\n while (fmtChunkOffset < view.byteLength) {\n const chunkId = view.getUint32(fmtChunkOffset, false)\n const chunkSize = view.getUint32(fmtChunkOffset + 4, true)\n if (chunkId === FMT_CHUNK_ID) {\n // \"fmt \"\n audioFormat = view.getUint16(fmtChunkOffset + 8, true)\n if (!AUDIO_FORMATS[audioFormat]) {\n throw new Error('Unsupported WAV file format')\n }\n numChannels = view.getUint16(fmtChunkOffset + 10, true)\n sampleRate = view.getUint32(fmtChunkOffset + 12, true) as SampleRate\n byteRate = view.getUint32(fmtChunkOffset + 16, true)\n blockAlign = view.getUint16(fmtChunkOffset + 20, true)\n bitDepth = view.getUint16(fmtChunkOffset + 22, true) as BitDepth\n } else if (chunkId === DATA_CHUNK_ID) {\n // \"data\"\n dataChunkSize = chunkSize\n dataChunkOffset = fmtChunkOffset + 8 // Position after chunk header\n break\n } else if (chunkId === INFO_CHUNK_ID) {\n // \"INFO\"\n // Read INFO chunk (assuming it contains a text-based creation date/time and comments)\n const infoStart = fmtChunkOffset + 8\n const infoText = new TextDecoder().decode(\n new Uint8Array(\n arrayBuffer.slice(infoStart, infoStart + chunkSize)\n )\n )\n const infoParts = infoText.split('\\0')\n creationDateTime = infoParts[0]\n comments = infoParts[1]\n }\n fmtChunkOffset += 8 + chunkSize\n }\n\n if (!sampleRate || !numChannels || !bitDepth || !dataChunkSize) {\n throw new Error('Incomplete WAV file information')\n }\n\n // Calculate duration\n const bytesPerSample = bitDepth / 8\n const numSamples = dataChunkSize / (numChannels * bytesPerSample)\n const durationMs = (numSamples / sampleRate) * 1000\n\n return {\n sampleRate,\n numChannels,\n bitDepth,\n size: arrayBuffer.byteLength,\n durationMs,\n audioFormatDescription: AUDIO_FORMATS[audioFormat],\n byteRate,\n blockAlign,\n creationDateTime: creationDateTime || undefined,\n comments: comments || undefined,\n compressionType:\n audioFormat === 1 ? 'None' : AUDIO_FORMATS[audioFormat],\n dataChunkOffset,\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeWavHeader.d.ts","sourceRoot":"","sources":["../../src/utils/writeWavHeader.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,+FAA+F;IAC/F,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAA;IAClB,qEAAqE;IACrE,WAAW,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,CAAA;IAChB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,4DAMxB,gBAAgB,KAAG,WAyErB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"writeWavHeader.js","sourceRoot":"","sources":["../../src/utils/writeWavHeader.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAkBzD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC3B,MAAM,EACN,UAAU,EACV,WAAW,EACX,QAAQ,EACR,OAAO,GAAG,QAAQ,KAAK,EAAE,EAAE,8BAA8B;EAC1C,EAAe,EAAE;IAChC,gEAAgE;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,0BAA0B;IAE9D,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,CAA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A","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 /** Whether the audio data is in float format (only applies to 32-bit) */\n isFloat?: boolean\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 */\nexport const writeWavHeader = ({\n buffer,\n sampleRate,\n numChannels,\n bitDepth,\n isFloat = bitDepth === 32, // Default to float for 32-bit\n}: WavHeaderOptions): ArrayBuffer => {\n // For 32-bit float, we use format 3, otherwise format 1 for PCM\n const audioFormat = isFloat ? 3 : 1 // 3 = IEEE float, 1 = PCM\n\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 // RIFF chunk descriptor\n writeString(view, 0, 'RIFF') // ChunkID\n view.setUint32(4, 36 + dataSize, true) // ChunkSize: 4 + (8 + 16) + (8 + dataSize)\n writeString(view, 8, 'WAVE') // Format\n\n // \"fmt \" sub-chunk\n writeString(view, 12, 'fmt ') // Subchunk1ID\n view.setUint32(16, 16, true) // Subchunk1Size (16 for PCM/Float)\n view.setUint16(20, audioFormat, 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 = SampleRate * NumChannels * BitsPerSample/8\n view.setUint16(32, blockAlign, true) // BlockAlign = NumChannels * BitsPerSample/8\n view.setUint16(34, bitDepth, true) // BitsPerSample\n\n // \"data\" sub-chunk\n writeString(view, 36, 'data') // Subchunk2ID\n view.setUint32(40, dataSize, true) // Subchunk2Size = NumSamples * NumChannels * BitsPerSample/8\n }\n\n if (buffer) {\n // Handle existing buffer\n\n // Check for minimum size\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 // Create a new buffer with header + data\n const newBuffer = new ArrayBuffer(44 + buffer.byteLength)\n const newView = new DataView(newBuffer)\n\n // Write header to new buffer\n writeHeader(newView, buffer.byteLength)\n\n // Copy audio data after header\n new Uint8Array(newBuffer).set(new Uint8Array(buffer), 44)\n return newBuffer\n }\n } else {\n // Create standalone header\n const headerBuffer = new ArrayBuffer(44)\n const view = new DataView(headerBuffer)\n writeHeader(view)\n return headerBuffer\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlineFeaturesExtractor.web.d.ts","sourceRoot":"","sources":["../../src/workers/InlineFeaturesExtractor.web.tsx"],"names":[],"mappings":"AACA,eAAO,MAAM,uBAAuB,4u5BA+0BnC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"InlineFeaturesExtractor.web.js","sourceRoot":"","sources":["../../src/workers/InlineFeaturesExtractor.web.tsx"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+0BtC,CAAA","sourcesContent":["// packages/expo-audio-studio/src/workers/InlineFeaturesExtractor.web.tsx\nexport const InlineFeaturesExtractor = `\n// Constants\nconst N_FFT = 1024; // Default FFT size\nconst MAX_FFT_SIZE = 8192; // Maximum FFT size to prevent memory issues\nconst N_CHROMA = 12;\n\n// FFT Implementation with normalized Hann window\nfunction FFT(n) {\n this.n = n;\n this.cosTable = new Float32Array(n / 2);\n this.sinTable = new Float32Array(n / 2);\n this.hannWindow = new Float32Array(n);\n \n // Match Android implementation with precomputed tables\n const normalizationFactor = Math.sqrt(2.0 / n);\n for (var i = 0; i < n / 2; i++) {\n this.cosTable[i] = Math.cos(2.0 * Math.PI * i / n);\n this.sinTable[i] = Math.sin(2.0 * Math.PI * i / n);\n }\n \n // Precompute normalized Hann window to match Android\n for (var i = 0; i < n; i++) {\n this.hannWindow[i] = normalizationFactor * 0.5 * (1 - Math.cos(2.0 * Math.PI * i / (n - 1)));\n }\n}\n\nFFT.prototype.transform = function(data) {\n const n = data.length;\n \n // Validate input length is power of 2\n if ((n & (n - 1)) !== 0) {\n throw new Error('FFT length must be power of 2');\n }\n\n // Use iterative bit reversal instead of recursive\n const bitReversedIndices = new Uint32Array(n);\n for (let i = 0; i < n; i++) {\n let reversed = 0;\n let j = i;\n let bits = Math.log2(n);\n while (bits--) {\n reversed = (reversed << 1) | (j & 1);\n j >>= 1;\n }\n bitReversedIndices[i] = reversed;\n }\n\n // Apply bit reversal\n for (let i = 0; i < n; i++) {\n const j = bitReversedIndices[i];\n if (i < j) {\n const temp = data[i];\n data[i] = data[j];\n data[j] = temp;\n }\n }\n\n // Iterative FFT computation with optimized memory usage\n for (let step = 1; step < n; step <<= 1) {\n const jump = step << 1;\n const angleStep = Math.PI / step;\n\n for (let group = 0; group < n; group += jump) {\n for (let pair = group; pair < group + step; pair++) {\n const match = pair + step;\n const angle = angleStep * (pair - group);\n \n const currentCos = Math.cos(angle);\n const currentSin = Math.sin(angle);\n\n const real = currentCos * data[match] - currentSin * data[match + 1];\n const imag = currentCos * data[match + 1] + currentSin * data[match];\n\n data[match] = data[pair] - real;\n data[match + 1] = data[pair + 1] - imag;\n data[pair] += real;\n data[pair + 1] += imag;\n }\n }\n }\n};\n\n// Add realInverse method\nFFT.prototype.realInverse = function(powerSpectrum, output) {\n const n = powerSpectrum.length;\n const complexData = new Float32Array(n * 2);\n \n // Copy power spectrum to complex format\n for (let i = 0; i < n/2 + 1; i++) {\n complexData[2 * i] = powerSpectrum[i];\n if (2 * i + 1 < complexData.length) {\n complexData[2 * i + 1] = 0;\n }\n }\n \n // Conjugate for inverse FFT\n for (let i = 0; i < n; i++) {\n if (2 * i + 1 < complexData.length) {\n complexData[2 * i + 1] = -complexData[2 * i + 1];\n }\n }\n \n this.transform(complexData);\n \n // Copy real part to output and scale\n for (let i = 0; i < n; i++) {\n output[i] = complexData[2 * i] / n;\n }\n};\n\n// Add helper functions to match Android\nfunction nextPowerOfTwo(n) {\n let value = 1;\n while (value < n) {\n value *= 2;\n }\n return value;\n}\n\nfunction applyHannWindow(samples) {\n const output = new Float32Array(samples.length);\n for (let i = 0; i < samples.length; i++) {\n const multiplier = 0.5 * (1 - Math.cos(2 * Math.PI * i / (samples.length - 1)));\n output[i] = samples[i] * multiplier;\n }\n return output;\n}\n\n// Update spectral feature computation to match Android\nfunction computeSpectralFeatures(segment, sampleRate, featureOptions = {}) {\n try {\n // Early return if no spectral features are requested\n if (!featureOptions.spectralCentroid && \n !featureOptions.spectralFlatness && \n !featureOptions.spectralRollOff && \n !featureOptions.spectralBandwidth &&\n !featureOptions.magnitudeSpectrum) {\n return {\n centroid: 0,\n flatness: 0,\n rollOff: 0,\n bandwidth: 0,\n magnitudeSpectrum: []\n };\n }\n\n // Ensure we have valid data\n if (!segment || segment.length === 0) {\n throw new Error('Invalid segment data');\n }\n\n // Process in fixed-size chunks\n const chunkSize = N_FFT;\n const numChunks = Math.ceil(segment.length / chunkSize);\n \n let results = {\n centroid: 0,\n flatness: 0,\n rollOff: 0,\n bandwidth: 0,\n magnitudeSpectrum: new Float32Array(N_FFT / 2 + 1).fill(0)\n };\n \n let validChunks = 0;\n \n // Iterate through chunks\n for (let i = 0; i < numChunks; i++) {\n const start = i * chunkSize;\n const end = Math.min(start + chunkSize, segment.length);\n const chunk = segment.slice(start, end);\n \n if (chunk.length < N_FFT / 4) continue; // Skip very small chunks\n\n // Process the chunk\n const paddedChunk = new Float32Array(N_FFT);\n paddedChunk.set(applyHannWindow(chunk));\n\n const fft = new FFT(N_FFT);\n fft.transform(paddedChunk);\n\n // Calculate magnitude spectrum\n const chunkMagnitudeSpectrum = new Float32Array(N_FFT / 2 + 1);\n let hasSignal = false;\n \n for (let j = 0; j < N_FFT / 2; j++) {\n const re = paddedChunk[2 * j];\n const im = paddedChunk[2 * j + 1];\n const magnitude = Math.sqrt(re * re + im * im);\n chunkMagnitudeSpectrum[j] = magnitude;\n if (magnitude > Number.EPSILON) hasSignal = true;\n }\n \n if (!hasSignal) continue;\n validChunks++;\n\n // Accumulate results\n if (featureOptions.spectralCentroid) {\n const centroid = computeSpectralCentroid(chunkMagnitudeSpectrum, sampleRate);\n if (!isNaN(centroid)) results.centroid += centroid;\n }\n \n if (featureOptions.spectralFlatness) {\n const flatness = computeSpectralFlatness(chunkMagnitudeSpectrum);\n if (!isNaN(flatness)) results.flatness += flatness;\n }\n \n if (featureOptions.spectralRollOff) {\n const rolloff = computeSpectralRollOff(chunkMagnitudeSpectrum, sampleRate);\n if (!isNaN(rolloff)) results.rollOff += rolloff;\n }\n \n if (featureOptions.spectralBandwidth && !isNaN(results.centroid)) {\n const bandwidth = computeSpectralBandwidth(chunkMagnitudeSpectrum, sampleRate, results.centroid);\n if (!isNaN(bandwidth)) results.bandwidth += bandwidth;\n }\n \n if (featureOptions.magnitudeSpectrum) {\n for (let j = 0; j < results.magnitudeSpectrum.length; j++) {\n results.magnitudeSpectrum[j] += chunkMagnitudeSpectrum[j];\n }\n }\n }\n\n // Average the accumulated results\n if (validChunks > 0) {\n results.centroid /= validChunks;\n results.flatness /= validChunks;\n results.rollOff /= validChunks;\n results.bandwidth /= validChunks;\n \n if (featureOptions.magnitudeSpectrum) {\n for (let i = 0; i < results.magnitudeSpectrum.length; i++) {\n results.magnitudeSpectrum[i] /= validChunks;\n }\n }\n }\n\n return results;\n } catch (error) {\n console.error('[Worker] Spectral feature computation error:', error);\n return {\n centroid: 0,\n flatness: 0,\n rollOff: 0,\n bandwidth: 0,\n magnitudeSpectrum: []\n };\n }\n}\n\nfunction computeSpectralCentroid(magnitudeSpectrum, sampleRate) {\n const sum = magnitudeSpectrum.reduce((a, b) => a + (b || 0), 0);\n if (sum <= Number.EPSILON) return 0;\n \n const weightedSum = magnitudeSpectrum.reduce((acc, value, index) => \n acc + (index * (sampleRate / N_FFT) * (value || 0)), 0);\n \n return weightedSum / sum;\n}\n\nfunction computeSpectralFlatness(powerSpectrum) {\n // Add small epsilon to avoid log(0)\n const epsilon = Number.EPSILON;\n const validSpectrum = powerSpectrum.map(v => Math.max(v, epsilon));\n \n const geometricMean = Math.exp(\n validSpectrum\n .map(v => Math.log(v))\n .reduce((a, b) => a + b) / validSpectrum.length\n );\n \n const arithmeticMean =\n validSpectrum.reduce((a, b) => a + b) / validSpectrum.length;\n \n return geometricMean / arithmeticMean;\n}\n\nfunction computeSpectralRollOff(magnitudeSpectrum, sampleRate) {\n const totalEnergy = magnitudeSpectrum.reduce((a, b) => a + b, 0);\n const rollOffThreshold = totalEnergy * 0.85;\n let cumulativeEnergy = 0;\n\n for (let i = 0; i < magnitudeSpectrum.length; i++) {\n cumulativeEnergy += magnitudeSpectrum[i];\n if (cumulativeEnergy >= rollOffThreshold) {\n return (i / magnitudeSpectrum.length) * (sampleRate / 2);\n }\n }\n\n return 0;\n}\n\nfunction computeSpectralBandwidth(magnitudeSpectrum, sampleRate, centroid) {\n const sum = magnitudeSpectrum.reduce((a, b) => a + (b || 0), 0);\n if (sum <= Number.EPSILON) return 0;\n\n const weightedSum = magnitudeSpectrum.reduce(\n (acc, value, index) => {\n const freq = index * sampleRate / (2 * magnitudeSpectrum.length);\n return acc + (value || 0) * Math.pow(freq - centroid, 2);\n }, 0\n );\n\n return Math.sqrt(weightedSum / sum);\n}\n\nfunction computeChroma(segmentData, sampleRate) {\n // Ensure we have valid input data\n if (!segmentData || segmentData.length === 0) {\n return new Array(N_CHROMA).fill(0);\n }\n\n const fftLength = nextPowerOfTwo(Math.max(segmentData.length, N_FFT));\n const windowed = applyHannWindow(segmentData);\n const padded = new Float32Array(fftLength);\n padded.set(windowed.slice(0, Math.min(windowed.length, fftLength)));\n\n const fft = new FFT(fftLength);\n try {\n fft.transform(padded);\n } catch (e) {\n console.error('[Worker] FFT transform failed in chromagram:', e);\n return new Array(N_CHROMA).fill(0);\n }\n\n const chroma = new Float32Array(N_CHROMA).fill(0);\n const freqsPerBin = sampleRate / fftLength;\n let totalEnergy = 0;\n\n // First pass: compute magnitudes and total energy\n for (let i = 0; i < fftLength / 2; i++) {\n const freq = i * freqsPerBin;\n if (freq > 20) { // Only consider frequencies above 20 Hz\n const re = padded[2 * i];\n const im = padded[2 * i + 1] || 0;\n const magnitude = Math.sqrt(re * re + im * im);\n \n if (magnitude > Number.EPSILON) {\n // Use a more stable pitch class calculation\n const midiNote = 69 + 12 * Math.log2(freq / 440.0);\n const pitchClass = Math.round(midiNote) % 12;\n \n if (pitchClass >= 0 && pitchClass < 12) {\n chroma[pitchClass] += magnitude;\n totalEnergy += magnitude;\n }\n }\n }\n }\n\n // Normalize chroma values only if we have energy\n if (totalEnergy > Number.EPSILON) {\n for (let i = 0; i < N_CHROMA; i++) {\n chroma[i] = chroma[i] / totalEnergy;\n }\n }\n\n // Convert to regular array and ensure no NaN values\n return Array.from(chroma, v => isNaN(v) ? 0 : v);\n}\n\nfunction extractHNR(segmentData) {\n const frameSize = segmentData.length;\n const autocorrelation = new Float32Array(frameSize);\n\n // Compute the autocorrelation iteratively\n for (let i = 0; i < frameSize; i++) {\n let sum = 0;\n for (let j = 0; j < frameSize - i; j++) {\n sum += segmentData[j] * segmentData[j + i];\n }\n autocorrelation[i] = sum;\n }\n\n // Find the maximum autocorrelation value iteratively\n let maxAutocorrelation = -Infinity;\n for (let i = 1; i < autocorrelation.length; i++) {\n if (autocorrelation[i] > maxAutocorrelation) {\n maxAutocorrelation = autocorrelation[i];\n }\n }\n\n // Compute the HNR\n return autocorrelation[0] !== 0\n ? 10 * Math.log10(maxAutocorrelation / (autocorrelation[0] - maxAutocorrelation))\n : 0;\n}\n\nfunction estimatePitch(segment, sampleRate) {\n // Early validation\n if (!segment || segment.length < 2 || !sampleRate) return 0;\n\n try {\n // Apply Hann window\n const windowed = applyHannWindow(segment);\n\n // Pad for FFT\n const fftLength = nextPowerOfTwo(segment.length * 2);\n const padded = new Float32Array(fftLength);\n padded.set(windowed);\n\n // Perform FFT\n const fft = new FFT(fftLength);\n fft.transform(padded);\n\n // Compute power spectrum\n const powerSpectrum = new Float32Array(fftLength / 2 + 1);\n for (let i = 0; i <= fftLength / 2; i++) {\n const re = padded[2 * i];\n const im = padded[2 * i + 1] || 0;\n powerSpectrum[i] = re * re + im * im;\n }\n\n // Find peak frequency\n let maxPower = 0;\n let peakIndex = 0;\n const minFreq = 50; // Minimum frequency to consider (Hz)\n const maxFreq = 1000; // Maximum frequency to consider (Hz)\n const minBin = Math.floor(minFreq * fftLength / sampleRate);\n const maxBin = Math.ceil(maxFreq * fftLength / sampleRate);\n\n for (let i = minBin; i <= maxBin; i++) {\n if (powerSpectrum[i] > maxPower) {\n maxPower = powerSpectrum[i];\n peakIndex = i;\n }\n }\n\n // Convert peak index to frequency\n const fundamentalFreq = peakIndex * sampleRate / fftLength;\n\n // Return 0 if the detected frequency is outside reasonable bounds\n return (fundamentalFreq >= minFreq && fundamentalFreq <= maxFreq) ? \n fundamentalFreq : 0;\n\n } catch (error) {\n console.error('[Worker] Pitch estimation error:', error);\n return 0;\n }\n}\n\n// Unique ID counter - the only state we need to maintain\nlet uniqueIdCounter = 0\nlet lastEmitTime = Date.now()\n\nself.onmessage = function (event) {\n // Extract enableLogging early so we can use it consistently\n const enableLogging = event.data.enableLogging || false;\n \n // Create consistent logger that only logs when enabled\n const logger = enableLogging ? {\n debug: (...args) => console.debug('[Worker]', ...args),\n log: (...args) => console.log('[Worker]', ...args),\n warn: (...args) => console.warn('[Worker]', ...args),\n error: (...args) => console.error('[Worker]', ...args)\n } : {\n debug: () => {},\n log: () => {},\n warn: () => {},\n error: () => {}\n };\n \n // Check if this is a reset command\n if (event.data.command === 'resetCounter') {\n const newValue = event.data.value;\n logger.log('Reset counter request received with value:', newValue);\n \n // Always respect explicit resets through the resetCounter command\n uniqueIdCounter = typeof newValue === 'number' ? newValue : 0;\n logger.log('Counter explicitly set to:', uniqueIdCounter);\n \n return; // Exit early, don't process audio\n }\n\n // Regular audio processing\n const {\n channelData,\n sampleRate,\n segmentDurationMs,\n algorithm,\n bitDepth,\n fullAudioDurationMs,\n numberOfChannels,\n features: _features,\n intervalAnalysis = 500,\n } = event.data\n\n // Calculate subChunkStartTime safely, defaulting to 0 if fullAudioDurationMs is not a valid number\n const subChunkStartTime = (typeof fullAudioDurationMs === 'number' && !isNaN(fullAudioDurationMs) && fullAudioDurationMs >= 0)\n ? fullAudioDurationMs / 1000\n : 0;\n\n const features = _features || {}\n const bytesPerSample = bitDepth / 8; // Calculate bytes per sample\n\n const SILENCE_THRESHOLD = 0.01\n const MIN_SILENCE_DURATION = 1.5 * sampleRate // 1.5 seconds of silence\n const SPEECH_INERTIA_DURATION = 0.1 * sampleRate // Speech inertia duration in samples\n const RMS_THRESHOLD = 0.01\n const ZCR_THRESHOLD = 0.1\n\n // Placeholder functions for feature extraction\n const extractMFCC = (segmentData, sampleRate) => {\n // Implement MFCC extraction logic here\n return []\n }\n\n const extractSpectralCentroid = (segmentData, sampleRate) => {\n const magnitudeSpectrum = segmentData.map((v) => v * v)\n const sum = magnitudeSpectrum.reduce((a, b) => a + b, 0)\n if (sum === 0) return 0\n\n const weightedSum = magnitudeSpectrum.reduce(\n (acc, value, index) => acc + index * value,\n 0\n )\n return (\n ((weightedSum / sum) * (sampleRate / 2)) / magnitudeSpectrum.length\n )\n }\n\n const extractSpectralFlatness = (segmentData) => {\n const magnitudeSpectrum = segmentData.map((v) => Math.abs(v))\n const geometricMean = Math.exp(\n magnitudeSpectrum\n .map((v) => Math.log(v + Number.MIN_VALUE))\n .reduce((a, b) => a + b) / magnitudeSpectrum.length\n )\n const arithmeticMean =\n magnitudeSpectrum.reduce((a, b) => a + b) / magnitudeSpectrum.length\n return arithmeticMean === 0 ? 0 : geometricMean / arithmeticMean\n }\n\n const extractSpectralRollOff = (segmentData, sampleRate) => {\n const magnitudeSpectrum = segmentData.map((v) => Math.abs(v))\n const totalEnergy = magnitudeSpectrum.reduce((a, b) => a + b, 0)\n const rollOffThreshold = totalEnergy * 0.85\n let cumulativeEnergy = 0\n\n for (let i = 0; i < magnitudeSpectrum.length; i++) {\n cumulativeEnergy += magnitudeSpectrum[i]\n if (cumulativeEnergy >= rollOffThreshold) {\n return (i / magnitudeSpectrum.length) * (sampleRate / 2)\n }\n }\n\n return 0\n }\n\n const extractSpectralBandwidth = (segmentData, sampleRate) => {\n const centroid = extractSpectralCentroid(segmentData, sampleRate)\n const magnitudeSpectrum = segmentData.map((v) => Math.abs(v))\n const sum = magnitudeSpectrum.reduce((a, b) => a + b, 0)\n if (sum === 0) return 0\n\n const weightedSum = magnitudeSpectrum.reduce(\n (acc, value, index) => acc + value * Math.pow(index - centroid, 2),\n 0\n )\n return Math.sqrt(weightedSum / sum)\n }\n\n const extractChromagram = (segmentData, sampleRate) => {\n return [] // TODO implement\n }\n\n /**\n * Creates a features object based on requested features\n */\n function createFeaturesObject(\n features,\n maxAmp,\n rms,\n sumSquares,\n zeroCrossings,\n remainingSamples,\n spectralFeatures,\n channelData,\n startIdx,\n endIdx,\n sampleRate,\n numberOfChannels,\n bytesPerSample\n ) {\n // If no features are requested, return undefined\n if (!Object.values(features).some(function(v) { return v; })) {\n return undefined;\n }\n\n const result = {};\n \n if (features.energy) {\n result.energy = sumSquares;\n }\n if (features.rms) {\n result.rms = rms;\n }\n // Always include min/max amplitude if any features are requested\n result.minAmplitude = -maxAmp;\n result.maxAmplitude = maxAmp;\n \n if (features.zcr) {\n result.zcr = zeroCrossings / remainingSamples;\n }\n if (features.spectralCentroid) {\n result.spectralCentroid = spectralFeatures.centroid;\n }\n if (features.spectralFlatness) {\n result.spectralFlatness = spectralFeatures.flatness;\n }\n if (features.spectralRolloff) {\n result.spectralRolloff = spectralFeatures.rollOff;\n }\n if (features.spectralBandwidth) {\n result.spectralBandwidth = spectralFeatures.bandwidth;\n }\n if (features.chromagram) {\n result.chromagram = computeChroma(channelData.slice(startIdx, endIdx), sampleRate);\n }\n if (features.hnr) {\n result.hnr = extractHNR(channelData.slice(startIdx, endIdx));\n }\n if (features.pitch) {\n result.pitch = estimatePitch(channelData.slice(startIdx, endIdx), sampleRate);\n }\n \n return result;\n }\n\n function extractWaveform(\n channelData,\n sampleRate,\n segmentDurationMs,\n numberOfChannels,\n bytesPerSample\n ) {\n const logger = enableLogging ? {\n debug: (...args) => console.debug('[Worker]', ...args),\n log: (...args) => console.log('[Worker]', ...args),\n error: (...args) => console.error('[Worker]', ...args)\n } : {\n debug: () => {},\n log: () => {},\n error: () => {}\n }\n\n // Calculate amplitude range\n let min = Infinity\n let max = -Infinity\n for (let i = 0; i < channelData.length; i++) {\n min = Math.min(min, channelData[i])\n max = Math.max(max, channelData[i])\n }\n\n const totalSamples = channelData.length\n const durationMs = (totalSamples / sampleRate) * 1000\n \n // Calculate fixed segment sizes\n const samplesPerSegment = Math.floor(sampleRate * (segmentDurationMs / 1000));\n const numPoints = Math.floor(totalSamples / samplesPerSegment);\n const remainingSamples = totalSamples % samplesPerSegment;\n\n const dataPoints = []\n\n // Process full segments\n for (let i = 0; i < numPoints; i++) {\n const startIdx = i * samplesPerSegment\n const endIdx = startIdx + samplesPerSegment\n \n let sumSquares = 0\n let maxAmp = 0\n let zeroCrossings = 0\n\n // Calculate segment features\n for (let j = startIdx; j < endIdx; j++) {\n const value = channelData[j]\n sumSquares += value * value\n maxAmp = Math.max(maxAmp, Math.abs(value))\n if (j > 0 && value * channelData[j - 1] < 0) {\n zeroCrossings++\n }\n }\n\n const rms = Math.sqrt(sumSquares / samplesPerSegment)\n const startTime = subChunkStartTime + (startIdx / sampleRate)\n const endTime = subChunkStartTime + (endIdx / sampleRate)\n // Calculate byte positions correctly based on numberOfChannels and bytesPerSample\n const startPosition = startIdx * numberOfChannels * bytesPerSample\n const endPosition = endIdx * numberOfChannels * bytesPerSample\n\n var spectralFeatures = computeSpectralFeatures(channelData.slice(startIdx, endIdx), sampleRate, features);\n\n // Simply use the counter, increment after assigning\n const dataPoint = {\n id: uniqueIdCounter++,\n amplitude: maxAmp,\n rms,\n startTime,\n endTime,\n dB: 20 * Math.log10(rms + 1e-6),\n silent: rms < 0.01,\n startPosition,\n endPosition,\n samples: samplesPerSegment,\n }\n\n // Extract features if any are requested\n const extractedFeatures = createFeaturesObject(\n features,\n maxAmp,\n rms,\n sumSquares,\n zeroCrossings,\n samplesPerSegment,\n spectralFeatures,\n channelData,\n startIdx,\n endIdx,\n sampleRate,\n numberOfChannels,\n bytesPerSample\n );\n \n if (extractedFeatures) {\n dataPoint.features = extractedFeatures;\n }\n\n dataPoints.push(dataPoint)\n }\n\n // Handle remaining samples if they exist and are enough to process\n if (remainingSamples > samplesPerSegment / 4) { // Only process if we have at least 1/4 of a segment\n const startIdx = numPoints * samplesPerSegment\n const endIdx = totalSamples\n \n let sumSquares = 0\n let maxAmp = 0\n let zeroCrossings = 0\n\n for (let j = startIdx; j < endIdx; j++) {\n const value = channelData[j]\n sumSquares += value * value\n maxAmp = Math.max(maxAmp, Math.abs(value))\n if (j > 0 && value * channelData[j - 1] < 0) {\n zeroCrossings++\n }\n }\n\n const rms = Math.sqrt(sumSquares / remainingSamples)\n const startTime = subChunkStartTime + (startIdx / sampleRate);\n const endTime = subChunkStartTime + (endIdx / sampleRate);\n // Calculate byte positions correctly based on numberOfChannels and bytesPerSample\n const startPosition = startIdx * numberOfChannels * bytesPerSample\n const endPosition = endIdx * numberOfChannels * bytesPerSample\n\n var spectralFeatures = computeSpectralFeatures(channelData.slice(startIdx, endIdx), sampleRate, features);\n\n // Simply use the counter, increment after assigning\n const dataPoint = {\n id: uniqueIdCounter++,\n amplitude: maxAmp,\n rms,\n startTime,\n endTime,\n dB: 20 * Math.log10(rms + 1e-6),\n silent: rms < 0.01,\n startPosition,\n endPosition,\n samples: remainingSamples,\n }\n\n logger.debug('extractWaveform - dataPoint', dataPoint);\n // Extract features if any are requested\n const extractedFeatures = createFeaturesObject(\n features,\n maxAmp,\n rms,\n sumSquares,\n zeroCrossings,\n remainingSamples,\n spectralFeatures,\n channelData,\n startIdx,\n endIdx,\n sampleRate,\n numberOfChannels,\n bytesPerSample\n );\n \n if (extractedFeatures) {\n dataPoint.features = extractedFeatures;\n }\n\n dataPoints.push(dataPoint)\n }\n\n return {\n durationMs,\n dataPoints,\n amplitudeRange: { min, max },\n rmsRange: {\n min: 0,\n max: Math.max(Math.abs(min), Math.abs(max))\n },\n extractionTimeMs: Date.now() - lastEmitTime\n }\n }\n\n try {\n const result = extractWaveform(\n channelData,\n sampleRate,\n segmentDurationMs,\n numberOfChannels || 1, // Default to 1 channel if not provided\n bytesPerSample\n )\n\n // Send complete result immediately\n self.postMessage({\n command: 'features',\n result: {\n bitDepth,\n samples: channelData.length,\n numberOfChannels,\n sampleRate,\n segmentDurationMs,\n durationMs: result.durationMs,\n dataPoints: result.dataPoints,\n amplitudeRange: result.amplitudeRange,\n rmsRange: result.rmsRange,\n }\n })\n } catch (error) {\n console.error('[Worker] Error', {\n message: error.message,\n stack: error.stack\n });\n \n self.postMessage({ \n error: {\n message: error.message,\n stack: error.stack,\n name: error.name\n }\n });\n }\n}\n`\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"inlineAudioWebWorker.web.d.ts","sourceRoot":"","sources":["../../src/workers/inlineAudioWebWorker.web.tsx"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,m3MAkLhC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"inlineAudioWebWorker.web.js","sourceRoot":"","sources":["../../src/workers/inlineAudioWebWorker.web.tsx"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkLnC,CAAA","sourcesContent":["// packages/expo-audio-stream/src/workers/inlineAudioWebWorker.web.tsx\nexport const InlineAudioWebWorker = `\nconst DEFAULT_BIT_DEPTH = 32\nconst DEFAULT_SAMPLE_RATE = 44100\n\nclass RecorderProcessor extends AudioWorkletProcessor {\n constructor() {\n super()\n this.currentChunk = [] // Float32Array\n this.samplesSinceLastExport = 0\n this.recordSampleRate = DEFAULT_SAMPLE_RATE\n this.exportSampleRate = DEFAULT_SAMPLE_RATE\n this.recordBitDepth = DEFAULT_BIT_DEPTH\n this.exportBitDepth = DEFAULT_BIT_DEPTH\n this.numberOfChannels = 1\n this.isRecording = true\n this.port.onmessage = this.handleMessage.bind(this)\n this.enableLogging = false\n this.exportIntervalSamples = 0\n this.currentPosition = 0 // Track current position in seconds\n }\n\n handleMessage(event) {\n switch (event.data.command) {\n case 'init':\n this.enableLogging = event.data.enableLogging || false\n this.recordSampleRate = event.data.recordSampleRate\n this.exportSampleRate =\n event.data.exportSampleRate || event.data.recordSampleRate\n this.exportIntervalSamples =\n this.recordSampleRate * (event.data.interval / 1000)\n if (event.data.numberOfChannels) {\n this.numberOfChannels = event.data.numberOfChannels\n }\n if (event.data.recordBitDepth) {\n this.recordBitDepth = event.data.recordBitDepth\n }\n this.exportBitDepth =\n event.data.exportBitDepth || this.recordBitDepth\n \n // Handle position parameter for device switching\n if (typeof event.data.position === 'number' && event.data.position > 0) {\n this.currentPosition = event.data.position\n if (this.enableLogging) {\n console.log('AudioWorklet initialized with position:', this.currentPosition)\n }\n }\n break\n\n case 'stop':\n this.isRecording = false\n if (this.currentChunk.length > 0) {\n this.processChunk()\n }\n break\n \n case 'pause':\n // Just a placeholder for pause handling\n break\n \n case 'resume':\n // Just a placeholder for resume handling\n break\n }\n }\n\n process(inputs, _outputs, _parameters) {\n if (!this.isRecording) return true\n const input = inputs[0]\n if (input.length > 0) {\n const newBuffer = new Float32Array(input[0])\n this.currentChunk.push(newBuffer)\n this.samplesSinceLastExport += newBuffer.length\n\n if (this.samplesSinceLastExport >= this.exportIntervalSamples) {\n this.processChunk()\n this.samplesSinceLastExport = 0\n }\n }\n return true\n }\n\n mergeBuffers(bufferArray, recLength) {\n const result = new Float32Array(recLength)\n let offset = 0\n for (let i = 0; i < bufferArray.length; i++) {\n result.set(bufferArray[i], offset)\n offset += bufferArray[i].length\n }\n return result\n }\n\n // Keep basic resampling for sample rate conversion\n resample(samples, targetSampleRate) {\n if (this.recordSampleRate === targetSampleRate) {\n return samples\n }\n const resampledBuffer = new Float32Array(\n Math.ceil(\n (samples.length * targetSampleRate) / this.recordSampleRate\n )\n )\n const ratio = this.recordSampleRate / targetSampleRate\n let offset = 0\n for (let i = 0; i < resampledBuffer.length; i++) {\n const nextOffset = Math.floor((i + 1) * ratio)\n let accum = 0\n let count = 0\n for (let j = offset; j < nextOffset && j < samples.length; j++) {\n accum += samples[j]\n count++\n }\n resampledBuffer[i] = count > 0 ? accum / count : 0\n offset = nextOffset\n }\n return resampledBuffer\n }\n\n // Keep bit depth conversion if needed\n convertBitDepth(input, targetBitDepth) {\n if (targetBitDepth === 32) {\n const output = new Int32Array(input.length)\n for (let i = 0; i < input.length; i++) {\n const s = Math.max(-1, Math.min(1, input[i]))\n output[i] = s < 0 ? s * 0x80000000 : s * 0x7fffffff\n }\n return output\n } else if (targetBitDepth === 16) {\n const output = new Int16Array(input.length)\n for (let i = 0; i < input.length; i++) {\n const s = Math.max(-1, Math.min(1, input[i]))\n output[i] = s < 0 ? s * 0x8000 : s * 0x7fff\n }\n return output\n }\n return input\n }\n\n processChunk() {\n if (this.currentChunk.length === 0) return\n\n // Merge buffers\n const chunkLength = this.currentChunk.reduce(\n (acc, buf) => acc + buf.length,\n 0\n )\n const mergedChunk = this.mergeBuffers(this.currentChunk, chunkLength)\n\n // Resample if needed\n const resampledChunk = this.resample(mergedChunk, this.exportSampleRate)\n\n // Convert bit depth if needed\n const finalBuffer =\n this.recordBitDepth !== this.exportBitDepth\n ? this.convertBitDepth(resampledChunk, this.exportBitDepth)\n : resampledChunk\n\n // Calculate the duration in seconds\n const chunkDuration = finalBuffer.length / this.exportSampleRate\n \n // Send processed chunk with the current position\n this.port.postMessage({\n command: 'newData',\n recordedData: finalBuffer,\n sampleRate: this.exportSampleRate,\n bitDepth: this.exportBitDepth,\n numberOfChannels: this.numberOfChannels,\n position: this.currentPosition,\n })\n \n // Update the position\n this.currentPosition += chunkDuration\n\n // Clear the current chunk\n this.currentChunk = []\n }\n}\n\nregisterProcessor('recorder-processor', RecorderProcessor)\n`\n"]}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes