neverlib 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl

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 (430) hide show
  1. neverlib/QA/ImpactNoiseRejection.py +119 -0
  2. neverlib/QA/gen_init.py +107 -6
  3. neverlib/QA/impact_noise_rejection.png +0 -0
  4. neverlib/QA/out.pcm +0 -0
  5. neverlib/QA/out.wav +0 -0
  6. neverlib/__init__.py +19 -0
  7. neverlib/audio_aug/README.md +3 -0
  8. neverlib/audio_aug/__init__.py +2 -4
  9. neverlib/filter/core.py +8 -5
  10. neverlib/metrics/README.md +35 -0
  11. neverlib/metrics/__init__.py +1 -1
  12. neverlib/metrics/pesq_c/PESQ +0 -0
  13. neverlib/signal_gen/babble_noise_generate.py +113 -0
  14. neverlib/tests/__init__.py +16 -1
  15. neverlib/tests/test_imports.py +2 -0
  16. neverlib/utils/README.md +29 -0
  17. neverlib/utils/__init__.py +7 -6
  18. neverlib/utils/audio_split.py +21 -20
  19. neverlib/utils/checkGPU.py +52 -79
  20. neverlib/utils/floder.py +115 -0
  21. neverlib/utils/pcm.py +42 -0
  22. neverlib/utils/utils.py +3 -77
  23. neverlib/vad/PreProcess.py +66 -66
  24. {neverlib-0.2.7.dist-info → neverlib-0.2.9.dist-info}/METADATA +15 -1
  25. neverlib-0.2.9.dist-info/RECORD +119 -0
  26. neverlib/.claude/settings.local.json +0 -9
  27. neverlib/.history/Docs/audio_aug/del_20250827162530.py +0 -0
  28. neverlib/.history/Docs/audio_aug/del_20250827162540.py +0 -2
  29. neverlib/.history/Docs/audio_aug/del_20250827162541.py +0 -7
  30. neverlib/.history/Docs/audio_aug/del_20250827162606.py +0 -7
  31. neverlib/.history/Docs/audio_aug/del_20250827162637.py +0 -8
  32. neverlib/.history/Docs/audio_aug/del_20250827162645.py +0 -8
  33. neverlib/.history/Docs/audio_aug/del_20250827162723.py +0 -9
  34. neverlib/.history/Docs/audio_aug/del_20250827162739.py +0 -9
  35. neverlib/.history/Docs/audio_aug/test_snr_20250806011311.py +0 -0
  36. neverlib/.history/Docs/audio_aug/test_snr_20250806011331.py +0 -75
  37. neverlib/.history/Docs/audio_aug/test_snr_20250806011342.py +0 -57
  38. neverlib/.history/Docs/audio_aug/test_snr_20250806011352.py +0 -57
  39. neverlib/.history/Docs/audio_aug/test_snr_20250806011403.py +0 -57
  40. neverlib/.history/Docs/audio_aug/test_snr_20250806011413.py +0 -57
  41. neverlib/.history/Docs/audio_aug/test_snr_20250806011435.py +0 -55
  42. neverlib/.history/Docs/audio_aug/test_snr_20250827161751.py +0 -55
  43. neverlib/.history/Docs/audio_aug/test_snr_20250827161754.py +0 -55
  44. neverlib/.history/Docs/audio_aug/test_snr_20250827161833.py +0 -54
  45. neverlib/.history/Docs/audio_aug/test_snr_20250827162017.py +0 -56
  46. neverlib/.history/Docs/audio_aug/test_snr_20250827162021.py +0 -57
  47. neverlib/.history/Docs/audio_aug/test_snr_20250827162028.py +0 -57
  48. neverlib/.history/Docs/audio_aug/test_snr_20250827162033.py +0 -55
  49. neverlib/.history/Docs/audio_aug_test/del_20250827162738.py +0 -9
  50. neverlib/.history/Docs/audio_aug_test/del_20250827162819.py +0 -9
  51. neverlib/.history/Docs/audio_aug_test/del_20250827162830.py +0 -9
  52. neverlib/.history/Docs/audio_aug_test/del_20250827162846.py +0 -9
  53. neverlib/.history/Docs/audio_aug_test/del_20250827162851.py +0 -9
  54. neverlib/.history/Docs/audio_aug_test/del_20250827162903.py +0 -10
  55. neverlib/.history/Docs/audio_aug_test/del_20250827162921.py +0 -10
  56. neverlib/.history/Docs/audio_aug_test/del_20250827162926.py +0 -10
  57. neverlib/.history/Docs/audio_aug_test/del_20250827163030.py +0 -10
  58. neverlib/.history/Docs/audio_aug_test/del_20250827163032.py +0 -10
  59. neverlib/.history/Docs/vad/1_20250810032405.py +0 -0
  60. neverlib/.history/Docs/vad/1_20250810032417.py +0 -39
  61. neverlib/.history/QA/html2markdown_20250822234112.md +0 -0
  62. neverlib/.history/QA/html2markdown_20250822234140.py +0 -9
  63. neverlib/.history/QA/html2markdown_20250822234141.md +0 -9
  64. neverlib/.history/QA/html2markdown_20250822234159.py +0 -12
  65. neverlib/.history/QA/html2markdown_20250822234200.py +0 -17
  66. neverlib/.history/QA/html2markdown_20250822234236.py +0 -17
  67. neverlib/.history/QA/html2markdown_20250822234340.py +0 -14
  68. neverlib/.history/QA/html2markdown_20250822234522.py +0 -18
  69. neverlib/.history/QA/html2markdown_20250822234601.py +0 -20
  70. neverlib/.history/QA/html2markdown_20250822234615.py +0 -22
  71. neverlib/.history/QA/html2markdown_20250822234715.py +0 -28
  72. neverlib/.history/QA/html2markdown_20250822234720.py +0 -27
  73. neverlib/.history/QA/html2markdown_20250822234903.py +0 -27
  74. neverlib/.history/__init___20250805234212.py +0 -41
  75. neverlib/.history/__init___20250904102635.py +0 -39
  76. neverlib/.history/__init___20250904102836.py +0 -34
  77. neverlib/.history/__init___20250904102838.py +0 -39
  78. neverlib/.history/__init___20250904102851.py +0 -33
  79. neverlib/.history/audio_aug/audio_aug_20250806010451.py +0 -125
  80. neverlib/.history/audio_aug/audio_aug_20250806010750.py +0 -138
  81. neverlib/.history/audio_aug/audio_aug_20250806010759.py +0 -140
  82. neverlib/.history/audio_aug/audio_aug_20250806010803.py +0 -140
  83. neverlib/.history/audio_aug/audio_aug_20250806010809.py +0 -140
  84. neverlib/.history/audio_aug/audio_aug_20250806011108.py +0 -140
  85. neverlib/.history/audio_aug/audio_aug_20250826155913.py +0 -158
  86. neverlib/.history/audio_aug/audio_aug_20250826164159.py +0 -159
  87. neverlib/.history/audio_aug/audio_aug_20250826164217.py +0 -160
  88. neverlib/.history/audio_aug/audio_aug_20250826164408.py +0 -161
  89. neverlib/.history/audio_aug/audio_aug_20250826164423.py +0 -161
  90. neverlib/.history/audio_aug/audio_aug_20250826164529.py +0 -161
  91. neverlib/.history/audio_aug/audio_aug_20250826164824.py +0 -161
  92. neverlib/.history/audio_aug/audio_aug_20250826164932.py +0 -162
  93. neverlib/.history/audio_aug/audio_aug_20250826164947.py +0 -162
  94. neverlib/.history/audio_aug/audio_aug_20250826165403.py +0 -162
  95. neverlib/.history/audio_aug/audio_aug_20250826165421.py +0 -162
  96. neverlib/.history/audio_aug/audio_aug_20250826165509.py +0 -163
  97. neverlib/.history/audio_aug/audio_aug_20250826165702.py +0 -163
  98. neverlib/.history/audio_aug/audio_aug_20250826165732.py +0 -165
  99. neverlib/.history/audio_aug/audio_aug_20250826170041.py +0 -163
  100. neverlib/.history/audio_aug/audio_aug_20250826170105.py +0 -164
  101. neverlib/.history/audio_aug/audio_aug_20250826170154.py +0 -164
  102. neverlib/.history/audio_aug/audio_aug_20250826170220.py +0 -165
  103. neverlib/.history/audio_aug/audio_aug_20250826170221.py +0 -165
  104. neverlib/.history/audio_aug/audio_aug_20250826170228.py +0 -165
  105. neverlib/.history/audio_aug/audio_aug_20250826170231.py +0 -165
  106. neverlib/.history/audio_aug/audio_aug_20250826212001.py +0 -165
  107. neverlib/.history/audio_aug/audio_aug_20250826220038.py +0 -165
  108. neverlib/.history/audio_aug/audio_aug_20250826220133.py +0 -165
  109. neverlib/.history/audio_aug/audio_aug_20250826220148.py +0 -165
  110. neverlib/.history/audio_aug/audio_aug_20250826220154.py +0 -165
  111. neverlib/.history/audio_aug/audio_aug_20250826220156.py +0 -165
  112. neverlib/.history/audio_aug/audio_aug_20250826220314.py +0 -165
  113. neverlib/.history/audio_aug/audio_aug_20250826220343.py +0 -184
  114. neverlib/.history/audio_aug/audio_aug_20250826220345.py +0 -184
  115. neverlib/.history/audio_aug/audio_aug_20250826220349.py +0 -184
  116. neverlib/.history/audio_aug/audio_aug_20250826220429.py +0 -184
  117. neverlib/.history/audio_aug/audio_aug_20250826220447.py +0 -184
  118. neverlib/.history/audio_aug/audio_aug_20250826220601.py +0 -186
  119. neverlib/.history/audio_aug/audio_aug_20250826220638.py +0 -186
  120. neverlib/.history/audio_aug/audio_aug_20250826220641.py +0 -186
  121. neverlib/.history/audio_aug/audio_aug_20250826220647.py +0 -186
  122. neverlib/.history/audio_aug/audio_aug_20250826220653.py +0 -186
  123. neverlib/.history/audio_aug/audio_aug_20250826220655.py +0 -186
  124. neverlib/.history/audio_aug/audio_aug_20250826220731.py +0 -185
  125. neverlib/.history/audio_aug/audio_aug_20250826220739.py +0 -185
  126. neverlib/.history/audio_aug/audio_aug_20250826220747.py +0 -185
  127. neverlib/.history/audio_aug/audio_aug_20250826220801.py +0 -186
  128. neverlib/.history/audio_aug/audio_aug_20250826220822.py +0 -186
  129. neverlib/.history/audio_aug/audio_aug_20250826220901.py +0 -186
  130. neverlib/.history/audio_aug/audio_aug_20250826221107.py +0 -187
  131. neverlib/.history/audio_aug/audio_aug_20250826221310.py +0 -188
  132. neverlib/.history/audio_aug/audio_aug_20250826221353.py +0 -191
  133. neverlib/.history/audio_aug/audio_aug_20250826221821.py +0 -191
  134. neverlib/.history/audio_aug/audio_aug_20250826221838.py +0 -191
  135. neverlib/.history/audio_aug/audio_aug_20250826221906.py +0 -191
  136. neverlib/.history/audio_aug/audio_aug_20250826221930.py +0 -191
  137. neverlib/.history/audio_aug/audio_aug_20250826221939.py +0 -191
  138. neverlib/.history/audio_aug/audio_aug_20250826221955.py +0 -191
  139. neverlib/.history/audio_aug/audio_aug_20250826222008.py +0 -197
  140. neverlib/.history/audio_aug/audio_aug_20250826222017.py +0 -200
  141. neverlib/.history/audio_aug/audio_aug_20250826222046.py +0 -203
  142. neverlib/.history/audio_aug/audio_aug_20250826222105.py +0 -203
  143. neverlib/.history/audio_aug/audio_aug_20250826222206.py +0 -203
  144. neverlib/.history/audio_aug/audio_aug_20250826222302.py +0 -203
  145. neverlib/.history/audio_aug/audio_aug_20250826222336.py +0 -203
  146. neverlib/.history/audio_aug/audio_aug_20250826222455.py +0 -204
  147. neverlib/.history/audio_aug/audio_aug_20250826222526.py +0 -204
  148. neverlib/.history/audio_aug/audio_aug_20250826222541.py +0 -204
  149. neverlib/.history/audio_aug/audio_aug_20250826222624.py +0 -202
  150. neverlib/.history/audio_aug/audio_aug_20250826222714.py +0 -205
  151. neverlib/.history/audio_aug/audio_aug_20250826222820.py +0 -205
  152. neverlib/.history/audio_aug/audio_aug_20250826222827.py +0 -205
  153. neverlib/.history/audio_aug/audio_aug_20250826222927.py +0 -232
  154. neverlib/.history/audio_aug/audio_aug_20250826223009.py +0 -232
  155. neverlib/.history/audio_aug/audio_aug_20250826223054.py +0 -232
  156. neverlib/.history/audio_aug/audio_aug_20250826223225.py +0 -233
  157. neverlib/.history/audio_aug/audio_aug_20250826223344.py +0 -236
  158. neverlib/.history/audio_aug/audio_aug_20250826223356.py +0 -236
  159. neverlib/.history/audio_aug/audio_aug_20250826223955.py +0 -242
  160. neverlib/.history/audio_aug/audio_aug_20250826224210.py +0 -240
  161. neverlib/.history/audio_aug/audio_aug_20250826224250.py +0 -242
  162. neverlib/.history/audio_aug/audio_aug_20250826224323.py +0 -280
  163. neverlib/.history/audio_aug/audio_aug_20250826224452.py +0 -263
  164. neverlib/.history/audio_aug/audio_aug_20250826224455.py +0 -263
  165. neverlib/.history/audio_aug/audio_aug_20250826224502.py +0 -263
  166. neverlib/.history/audio_aug/audio_aug_20250826224528.py +0 -263
  167. neverlib/.history/audio_aug/audio_aug_20250826224658.py +0 -263
  168. neverlib/.history/audio_aug/audio_aug_20250826224833.py +0 -264
  169. neverlib/.history/audio_aug/audio_aug_20250826225013.py +0 -269
  170. neverlib/.history/audio_aug/audio_aug_20250826225050.py +0 -269
  171. neverlib/.history/audio_aug/audio_aug_20250826225241.py +0 -268
  172. neverlib/.history/audio_aug/audio_aug_20250826225315.py +0 -266
  173. neverlib/.history/audio_aug/audio_aug_20250826225404.py +0 -266
  174. neverlib/.history/audio_aug/audio_aug_20250826225502.py +0 -265
  175. neverlib/.history/audio_aug/audio_aug_20250826225950.py +0 -267
  176. neverlib/.history/audio_aug/audio_aug_20250826225959.py +0 -268
  177. neverlib/.history/audio_aug/audio_aug_20250826230222.py +0 -271
  178. neverlib/.history/audio_aug/audio_aug_20250826230248.py +0 -270
  179. neverlib/.history/audio_aug/audio_aug_20250826230638.py +0 -266
  180. neverlib/.history/audio_aug/audio_aug_20250826230755.py +0 -266
  181. neverlib/.history/audio_aug/audio_aug_20250826230941.py +0 -265
  182. neverlib/.history/audio_aug/audio_aug_20250826231054.py +0 -266
  183. neverlib/.history/audio_aug/audio_aug_20250826231117.py +0 -266
  184. neverlib/.history/audio_aug/audio_aug_20250826231219.py +0 -266
  185. neverlib/.history/audio_aug/audio_aug_20250826232330.py +0 -266
  186. neverlib/.history/audio_aug/audio_aug_20250826232352.py +0 -266
  187. neverlib/.history/audio_aug/audio_aug_20250827152748.py +0 -268
  188. neverlib/.history/audio_aug/audio_aug_20250827152806.py +0 -268
  189. neverlib/.history/audio_aug/audio_aug_20250827152808.py +0 -268
  190. neverlib/.history/audio_aug/audio_aug_20250827152917.py +0 -283
  191. neverlib/.history/audio_aug/audio_aug_20250827152929.py +0 -281
  192. neverlib/.history/audio_aug/audio_aug_20250827153100.py +0 -286
  193. neverlib/.history/audio_aug/audio_aug_20250827153102.py +0 -286
  194. neverlib/.history/audio_aug/audio_aug_20250827153301.py +0 -295
  195. neverlib/.history/audio_aug/audio_aug_20250827153331.py +0 -298
  196. neverlib/.history/audio_aug/audio_aug_20250827153525.py +0 -303
  197. neverlib/.history/audio_aug/audio_aug_20250827153533.py +0 -304
  198. neverlib/.history/audio_aug/audio_aug_20250827153541.py +0 -321
  199. neverlib/.history/audio_aug/audio_aug_20250827153805.py +0 -322
  200. neverlib/.history/audio_aug/audio_aug_20250827153832.py +0 -323
  201. neverlib/.history/audio_aug/audio_aug_20250827153836.py +0 -324
  202. neverlib/.history/audio_aug/audio_aug_20250827153846.py +0 -324
  203. neverlib/.history/audio_aug/audio_aug_20250827153859.py +0 -325
  204. neverlib/.history/audio_aug/audio_aug_20250827154453.py +0 -337
  205. neverlib/.history/audio_aug/audio_aug_20250827154513.py +0 -355
  206. neverlib/.history/audio_aug/audio_aug_20250827154538.py +0 -356
  207. neverlib/.history/audio_aug/audio_aug_20250827154541.py +0 -357
  208. neverlib/.history/audio_aug/audio_aug_20250827154612.py +0 -357
  209. neverlib/.history/audio_aug/audio_aug_20250827154657.py +0 -360
  210. neverlib/.history/audio_aug/audio_aug_20250827154708.py +0 -360
  211. neverlib/.history/audio_aug/audio_aug_20250827154728.py +0 -366
  212. neverlib/.history/audio_aug/audio_aug_20250827154755.py +0 -367
  213. neverlib/.history/audio_aug/audio_aug_20250827154800.py +0 -367
  214. neverlib/.history/audio_aug/audio_aug_20250827154917.py +0 -368
  215. neverlib/.history/audio_aug/audio_aug_20250827154928.py +0 -369
  216. neverlib/.history/audio_aug/audio_aug_20250827154932.py +0 -370
  217. neverlib/.history/audio_aug/audio_aug_20250827154947.py +0 -372
  218. neverlib/.history/audio_aug/audio_aug_20250827155015.py +0 -375
  219. neverlib/.history/audio_aug/audio_aug_20250827155106.py +0 -375
  220. neverlib/.history/audio_aug/audio_aug_20250827155114.py +0 -393
  221. neverlib/.history/audio_aug/audio_aug_20250827155207.py +0 -415
  222. neverlib/.history/audio_aug/audio_aug_20250827155300.py +0 -415
  223. neverlib/.history/audio_aug/audio_aug_20250827155321.py +0 -471
  224. neverlib/.history/audio_aug/audio_aug_20250827164703.py +0 -471
  225. neverlib/.history/audio_aug/audio_aug_20250827164749.py +0 -471
  226. neverlib/.history/audio_aug/audio_aug_20250827165252.py +0 -472
  227. neverlib/.history/audio_aug/audio_aug_20250827165334.py +0 -472
  228. neverlib/.history/audio_aug/audio_aug_20250827165404.py +0 -473
  229. neverlib/.history/audio_aug/audio_aug_20250827165610.py +0 -473
  230. neverlib/.history/audio_aug/audio_aug_20250827165805.py +0 -473
  231. neverlib/.history/audio_aug/audio_aug_20250827170056.py +0 -473
  232. neverlib/.history/audio_aug/audio_aug_20250827170106.py +0 -472
  233. neverlib/.history/audio_aug/audio_aug_20250827170143.py +0 -472
  234. neverlib/.history/audio_aug/audio_aug_20250827170216.py +0 -472
  235. neverlib/.history/audio_aug/audio_aug_20250827170218.py +0 -472
  236. neverlib/.history/audio_aug/audio_aug_20250827170314.py +0 -472
  237. neverlib/.history/audio_aug/audio_aug_20250827171500.py +0 -471
  238. neverlib/.history/audio_aug/audio_aug_20250827172347.py +0 -471
  239. neverlib/.history/audio_aug/audio_aug_20250827172558.py +0 -470
  240. neverlib/.history/audio_aug/audio_aug_20250827172559.py +0 -470
  241. neverlib/.history/audio_aug/audio_aug_20250827172801.py +0 -470
  242. neverlib/.history/audio_aug/audio_aug_20250827182522.py +0 -470
  243. neverlib/.history/audio_aug/audio_aug_20250827182526.py +0 -470
  244. neverlib/.history/audio_aug/audio_aug_20250827182626.py +0 -470
  245. neverlib/.history/audio_aug/audio_aug_20250827182715.py +0 -470
  246. neverlib/.history/audio_aug/audio_aug_20250904185444.py +0 -470
  247. neverlib/.history/audio_aug/audio_aug_20250904185538.py +0 -445
  248. neverlib/.history/dataAnalyze/__init___20250805234204.py +0 -87
  249. neverlib/.history/dataAnalyze/__init___20250806204125.py +0 -14
  250. neverlib/.history/dataAnalyze/__init___20250806204139.py +0 -14
  251. neverlib/.history/dataAnalyze/__init___20250806204159.py +0 -14
  252. neverlib/.history/data_analyze/__init___20250806204158.py +0 -14
  253. neverlib/.history/data_analyze/__init___20250827163248.py +0 -14
  254. neverlib/.history/filter/__init___20250820103351.py +0 -70
  255. neverlib/.history/filter/__init___20250821102348.py +0 -70
  256. neverlib/.history/filter/__init___20250821102405.py +0 -14
  257. neverlib/.history/filter/auto_eq/__init___20250819213121.py +0 -36
  258. neverlib/.history/filter/auto_eq/__init___20250821102241.py +0 -36
  259. neverlib/.history/filter/auto_eq/__init___20250821102259.py +0 -36
  260. neverlib/.history/filter/auto_eq/__init___20250821102307.py +0 -36
  261. neverlib/.history/filter/auto_eq/__init___20250821102310.py +0 -36
  262. neverlib/.history/filter/auto_eq/__init___20250821102318.py +0 -36
  263. neverlib/.history/filter/auto_eq/__init___20250821102507.py +0 -36
  264. neverlib/.history/filter/auto_eq/de_eq_20250820103848.py +0 -361
  265. neverlib/.history/filter/auto_eq/de_eq_20250821102422.py +0 -360
  266. neverlib/.history/filter/auto_eq/freq_eq_20250805234206.py +0 -75
  267. neverlib/.history/filter/auto_eq/freq_eq_20250820140732.py +0 -75
  268. neverlib/.history/filter/auto_eq/freq_eq_20250820140745.py +0 -75
  269. neverlib/.history/filter/auto_eq/freq_eq_20250820140816.py +0 -75
  270. neverlib/.history/filter/auto_eq/freq_eq_20250820140938.py +0 -77
  271. neverlib/.history/filter/auto_eq/freq_eq_20250820141003.py +0 -77
  272. neverlib/.history/filter/auto_eq/freq_eq_20250820141006.py +0 -77
  273. neverlib/.history/filter/auto_eq/freq_eq_20250820141019.py +0 -77
  274. neverlib/.history/filter/auto_eq/freq_eq_20250820141049.py +0 -77
  275. neverlib/.history/filter/auto_eq/freq_eq_20250820141211.py +0 -77
  276. neverlib/.history/filter/auto_eq/freq_eq_20250820141227.py +0 -77
  277. neverlib/.history/filter/auto_eq/freq_eq_20250820141311.py +0 -78
  278. neverlib/.history/filter/auto_eq/freq_eq_20250820141340.py +0 -78
  279. neverlib/.history/filter/auto_eq/freq_eq_20250820141712.py +0 -78
  280. neverlib/.history/filter/auto_eq/freq_eq_20250820141733.py +0 -78
  281. neverlib/.history/filter/auto_eq/freq_eq_20250820141755.py +0 -78
  282. neverlib/.history/filter/auto_eq/freq_eq_20250821102434.py +0 -76
  283. neverlib/.history/filter/auto_eq/freq_eq_20250821102500.py +0 -76
  284. neverlib/.history/filter/auto_eq/freq_eq_20250821102502.py +0 -76
  285. neverlib/.history/filter/auto_eq/freq_eq_20250821143140.py +0 -76
  286. neverlib/.history/filter/auto_eq/freq_eq_20250821153208.py +0 -76
  287. neverlib/.history/filter/auto_eq/freq_eq_20250821153214.py +0 -76
  288. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820102957.py +0 -380
  289. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113054.py +0 -380
  290. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113150.py +0 -380
  291. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113520.py +0 -385
  292. neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113525.py +0 -385
  293. neverlib/.history/filter/auto_eq/ga_eq_basic_20250821102212.py +0 -385
  294. neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110521.py +0 -385
  295. neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110652.py +0 -385
  296. neverlib/.history/filter/common_20250806002134.py +0 -37
  297. neverlib/.history/filter/common_20250821120448.py +0 -49
  298. neverlib/.history/filter/common_20250821120453.py +0 -49
  299. neverlib/.history/metrics/dnsmos_20250806001612.py +0 -160
  300. neverlib/.history/metrics/dnsmos_20250815180659.py +0 -160
  301. neverlib/.history/metrics/dnsmos_20250815180701.py +0 -158
  302. neverlib/.history/metrics/dnsmos_20250815181321.py +0 -154
  303. neverlib/.history/metrics/dnsmos_20250815181327.py +0 -154
  304. neverlib/.history/metrics/dnsmos_20250815181331.py +0 -154
  305. neverlib/.history/metrics/dnsmos_20250815181620.py +0 -154
  306. neverlib/.history/metrics/dnsmos_20250815181631.py +0 -154
  307. neverlib/.history/metrics/dnsmos_20250815181742.py +0 -154
  308. neverlib/.history/metrics/dnsmos_20250815181824.py +0 -153
  309. neverlib/.history/metrics/dnsmos_20250815181834.py +0 -153
  310. neverlib/.history/metrics/dnsmos_20250815181922.py +0 -153
  311. neverlib/.history/metrics/dnsmos_20250815182011.py +0 -147
  312. neverlib/.history/metrics/dnsmos_20250815182036.py +0 -144
  313. neverlib/.history/metrics/dnsmos_20250815182936.py +0 -143
  314. neverlib/.history/metrics/dnsmos_20250815182942.py +0 -143
  315. neverlib/.history/metrics/dnsmos_20250815183032.py +0 -137
  316. neverlib/.history/metrics/dnsmos_20250815183101.py +0 -144
  317. neverlib/.history/metrics/dnsmos_20250815183121.py +0 -144
  318. neverlib/.history/metrics/dnsmos_20250815183123.py +0 -143
  319. neverlib/.history/metrics/dnsmos_20250815183214.py +0 -143
  320. neverlib/.history/metrics/dnsmos_20250815183240.py +0 -143
  321. neverlib/.history/metrics/dnsmos_20250815183248.py +0 -144
  322. neverlib/.history/metrics/dnsmos_20250815183407.py +0 -142
  323. neverlib/.history/metrics/dnsmos_20250815183409.py +0 -142
  324. neverlib/.history/metrics/dnsmos_20250815183431.py +0 -142
  325. neverlib/.history/metrics/dnsmos_20250815183507.py +0 -140
  326. neverlib/.history/metrics/dnsmos_20250815183513.py +0 -139
  327. neverlib/.history/metrics/dnsmos_20250815183618.py +0 -139
  328. neverlib/.history/metrics/dnsmos_20250815183709.py +0 -140
  329. neverlib/.history/metrics/dnsmos_20250815183756.py +0 -137
  330. neverlib/.history/metrics/dnsmos_20250815183815.py +0 -128
  331. neverlib/.history/metrics/dnsmos_20250815183827.py +0 -129
  332. neverlib/.history/metrics/dnsmos_20250815183913.py +0 -117
  333. neverlib/.history/metrics/dnsmos_20250815183914.py +0 -117
  334. neverlib/.history/metrics/dnsmos_20250815184003.py +0 -118
  335. neverlib/.history/metrics/dnsmos_20250815184040.py +0 -118
  336. neverlib/.history/metrics/dnsmos_20250815184049.py +0 -118
  337. neverlib/.history/metrics/dnsmos_20250815184104.py +0 -117
  338. neverlib/.history/metrics/dnsmos_20250815184200.py +0 -117
  339. neverlib/.history/metrics/lpc_lsp_metric_20250816015944.py +0 -128
  340. neverlib/.history/metrics/lpc_lsp_metric_20250816020142.py +0 -128
  341. neverlib/.history/metrics/lpc_lsp_metric_20250816020156.py +0 -128
  342. neverlib/.history/metrics/lpc_lsp_metric_20250816020554.py +0 -130
  343. neverlib/.history/metrics/lpc_lsp_metric_20250816020600.py +0 -125
  344. neverlib/.history/metrics/lpc_lsp_metric_20250816020631.py +0 -120
  345. neverlib/.history/metrics/lpc_lsp_metric_20250816020746.py +0 -118
  346. neverlib/.history/metrics/lpc_me_20250816013111.py +0 -0
  347. neverlib/.history/metrics/lpc_me_20250816013129.py +0 -121
  348. neverlib/.history/metrics/lpc_me_20250816015430.py +0 -103
  349. neverlib/.history/metrics/lpc_me_20250816015535.py +0 -96
  350. neverlib/.history/metrics/lpc_me_20250816015542.py +0 -96
  351. neverlib/.history/metrics/lpc_me_20250816015636.py +0 -97
  352. neverlib/.history/metrics/lpc_me_20250816015658.py +0 -104
  353. neverlib/.history/metrics/lpc_me_20250816015703.py +0 -100
  354. neverlib/.history/metrics/lpc_me_20250816015945.py +0 -128
  355. neverlib/.history/metrics/snr_20250806010538.py +0 -177
  356. neverlib/.history/metrics/snr_20250806211634.py +0 -184
  357. neverlib/.history/metrics/snr_20250827224201.py +0 -182
  358. neverlib/.history/metrics/snr_20250827234019.py +0 -186
  359. neverlib/.history/metrics/snr_20250827234028.py +0 -186
  360. neverlib/.history/metrics/snr_20250827234030.py +0 -186
  361. neverlib/.history/metrics/spec_20250805234209.py +0 -45
  362. neverlib/.history/metrics/spec_20250816135530.py +0 -11
  363. neverlib/.history/metrics/spec_20250816135654.py +0 -16
  364. neverlib/.history/metrics/spec_20250816135736.py +0 -68
  365. neverlib/.history/metrics/spec_20250816135904.py +0 -75
  366. neverlib/.history/metrics/spec_20250816135921.py +0 -82
  367. neverlib/.history/metrics/spec_20250816140111.py +0 -82
  368. neverlib/.history/metrics/spec_20250816140543.py +0 -136
  369. neverlib/.history/metrics/spec_20250816140559.py +0 -172
  370. neverlib/.history/metrics/spec_20250816140602.py +0 -172
  371. neverlib/.history/metrics/spec_20250816140608.py +0 -172
  372. neverlib/.history/metrics/spec_20250816140654.py +0 -148
  373. neverlib/.history/metrics/spec_20250816140705.py +0 -144
  374. neverlib/.history/metrics/spec_20250816140755.py +0 -138
  375. neverlib/.history/metrics/spec_20250816140823.py +0 -170
  376. neverlib/.history/metrics/spec_20250816140832.py +0 -170
  377. neverlib/.history/metrics/spec_20250816140833.py +0 -170
  378. neverlib/.history/metrics/spec_20250816140922.py +0 -147
  379. neverlib/.history/metrics/spec_20250816141148.py +0 -107
  380. neverlib/.history/metrics/spec_20250816141219.py +0 -123
  381. neverlib/.history/metrics/spec_20250816141732.py +0 -178
  382. neverlib/.history/metrics/spec_20250816141740.py +0 -178
  383. neverlib/.history/metrics/spec_20250816142030.py +0 -178
  384. neverlib/.history/metrics/spec_20250816142107.py +0 -135
  385. neverlib/.history/metrics/spec_20250816142126.py +0 -135
  386. neverlib/.history/metrics/spec_20250816142410.py +0 -135
  387. neverlib/.history/metrics/spec_20250816142415.py +0 -136
  388. neverlib/.history/metrics/spec_metric_20250816135156.py +0 -0
  389. neverlib/.history/metrics/spec_metric_20250816135226.py +0 -5
  390. neverlib/.history/metrics/spec_metric_20250816135227.py +0 -10
  391. neverlib/.history/metrics/spec_metric_20250816135306.py +0 -15
  392. neverlib/.history/metrics/spec_metric_20250816135442.py +0 -31
  393. neverlib/.history/metrics/spec_metric_20250816135448.py +0 -31
  394. neverlib/.history/metrics/spec_metric_20250816135520.py +0 -29
  395. neverlib/.history/metrics/spec_metric_20250816135537.py +0 -63
  396. neverlib/.history/metrics/spec_metric_20250816135653.py +0 -65
  397. neverlib/.history/utils/audio_split_20250805234209.py +0 -268
  398. neverlib/.history/utils/audio_split_20250904185309.py +0 -268
  399. neverlib/.history/utils/utils_20250813165516.py +0 -330
  400. neverlib/.history/utils/utils_20250904181341.py +0 -328
  401. neverlib/.history/utils/utils_20250904185546.py +0 -352
  402. neverlib/.history/utils/utils_20250904185548.py +0 -353
  403. neverlib/.history/utils/utils_20250904185603.py +0 -353
  404. neverlib/.history/utils/utils_20250904185636.py +0 -353
  405. neverlib/.history/utils/utils_20250904185658.py +0 -358
  406. neverlib/.history/utils/utils_20250904190053.py +0 -359
  407. neverlib/.history/vad/PreProcess_20250805234211.py +0 -63
  408. neverlib/.history/vad/PreProcess_20250809232455.py +0 -63
  409. neverlib/.history/vad/PreProcess_20250816020725.py +0 -66
  410. neverlib/.history/vad/VAD_Silero_20250805234211.py +0 -50
  411. neverlib/.history/vad/VAD_Silero_20250809232456.py +0 -50
  412. neverlib/.history/vad/VAD_WebRTC_20250805234211.py +0 -61
  413. neverlib/.history/vad/VAD_WebRTC_20250809232456.py +0 -61
  414. neverlib/.history/vad/VAD_funasr_20250805234211.py +0 -54
  415. neverlib/.history/vad/VAD_funasr_20250809232456.py +0 -54
  416. neverlib/.history/vad/VAD_vadlib_20250805234211.py +0 -70
  417. neverlib/.history/vad/VAD_vadlib_20250809232455.py +0 -70
  418. neverlib/.history/vad/VAD_whisper_20250805234211.py +0 -55
  419. neverlib/.history/vad/VAD_whisper_20250809232456.py +0 -55
  420. neverlib/.specstory/.what-is-this.md +0 -69
  421. neverlib/.specstory/history/2025-08-05_17-06Z-/350/277/231/344/270/200/346/255/245/347/232/204/347/233/256/347/232/204/346/230/257/344/273/200/344/271/210.md +0 -424
  422. neverlib/.specstory/history/2025-08-22_02-10Z-/345/256/214/345/226/204/345/207/275/346/225/260/347/232/204/345/212/237/350/203/275/345/222/214/345/217/230/351/207/217/345/220/215/345/273/272/350/256/256.md +0 -247
  423. neverlib/.specstory/history/2025-08-26_11-54Z-oserror-missing-shared-object-file.md +0 -87
  424. neverlib/.specstory/history/2025-08-27_08-07Z-/345/256/214/345/226/204/346/265/213/350/257/225/346/226/207/346/241/243/347/232/204/350/256/250/350/256/272.md +0 -296
  425. neverlib/.specstory/history/2025-08-27_08-29Z-delete-python-file-command.md +0 -211
  426. neverlib/.specstory/history/2025-08-27_09-05Z-/345/234/250jupyter/344/270/255/346/222/255/346/224/276/351/237/263/351/242/221/347/232/204/344/273/243/347/240/201/344/277/256/346/224/271.md +0 -357
  427. neverlib-0.2.7.dist-info/RECORD +0 -510
  428. {neverlib-0.2.7.dist-info → neverlib-0.2.9.dist-info}/WHEEL +0 -0
  429. {neverlib-0.2.7.dist-info → neverlib-0.2.9.dist-info}/licenses/LICENSE +0 -0
  430. {neverlib-0.2.7.dist-info → neverlib-0.2.9.dist-info}/top_level.txt +0 -0
@@ -1,424 +0,0 @@
1
- <!-- Generated by SpecStory -->
2
-
3
- # 这一步的目的是什么 (2025-08-05 17:06Z)
4
-
5
- _**User**_
6
-
7
- 这一步是什么目的?
8
-
9
- ---
10
-
11
- _**Assistant**_
12
-
13
- 这一步的目的是使用多线程并发处理来加速音频质量评估计算。
14
-
15
- 让我解释一下这段代码的具体作用:
16
-
17
- ```129:138:metrics/dnsmos.py
18
- with concurrent.futures.ThreadPoolExecutor() as executor:
19
- future_to_url = {executor.submit(compute_score, clip, desired_fs, is_personalized_eval): clip for clip in clips}
20
- for future in tqdm(concurrent.futures.as_completed(future_to_url)):
21
- clip = future_to_url[future]
22
- try:
23
- data = future.result()
24
- except Exception as exc:
25
- print('%r generated an exception: %s' % (clip, clip, exc))
26
- else:
27
- rows.append(data)
28
- ```
29
-
30
- **主要目的:**
31
-
32
- 1. **并发处理**:使用 `ThreadPoolExecutor` 创建线程池,同时处理多个音频片段的评分计算,而不是串行处理
33
-
34
- 2. **性能优化**:当有多个音频片段需要评估时,并行计算可以显著减少总处理时间
35
-
36
- 3. **任务分发**:将每个音频片段(`clip`)的评分计算任务提交给线程池执行
37
-
38
- 4. **结果收集**:通过 `as_completed()` 收集完成的任务结果,并处理可能的异常情况
39
-
40
- 5. **进度跟踪**:使用 `tqdm` 显示处理进度
41
-
42
- 这种并发处理方式特别适合 I/O 密集型任务(如音频文件读取)和计算密集型任务(如音频质量评估),可以充分利用系统资源,提高整体处理效率。
43
-
44
- ---
45
-
46
- _**User**_
47
-
48
- 为什么不使用joblib里面的并行库
49
-
50
- ---
51
-
52
- _**Assistant**_
53
-
54
- 这是一个很好的问题!让我分析一下为什么这里选择使用 `concurrent.futures.ThreadPoolExecutor` 而不是 `joblib` 的并行库:
55
-
56
- **使用 `concurrent.futures.ThreadPoolExecutor` 的原因:**
57
-
58
- 1. **Python 标准库**:`concurrent.futures` 是 Python 3.2+ 的标准库,不需要额外安装依赖
59
-
60
- 2. **轻量级**:相比 `joblib`,`concurrent.futures` 更加轻量,没有额外的依赖包
61
-
62
- 3. **简单易用**:API 设计简洁,适合这种简单的并行任务
63
-
64
- 4. **线程池**:对于 I/O 密集型任务(如音频文件读取)和计算密集型任务(如音频质量评估),线程池通常比进程池更高效
65
-
66
- **`joblib` 的优势:**
67
-
68
- 1. **进程级并行**:`joblib` 默认使用多进程,可以绕过 Python 的 GIL 限制
69
- 2. **内存共享**:进程间可以共享内存,适合大数据处理
70
- 3. **更多功能**:提供缓存、进度条、错误处理等高级功能
71
-
72
- **为什么不选择 `joblib`:**
73
-
74
- 1. **依赖管理**:需要额外安装 `joblib` 包
75
- 2. **进程开销**:多进程启动和通信开销比线程大
76
- 3. **内存复制**:进程间数据传递需要序列化/反序列化
77
- 4. **过度设计**:对于这种简单的并行任务,`joblib` 可能过于复杂
78
-
79
- 在这个音频质量评估的场景下,`concurrent.futures.ThreadPoolExecutor` 提供了足够的性能提升,同时保持了代码的简洁性和依赖的最小化。
80
-
81
- ---
82
-
83
- _**User**_
84
-
85
- 你帮我改成单进程
86
-
87
- ---
88
-
89
- _**Assistant**_
90
-
91
- 我来帮你将这段代码改成单进程版本。首先让我查看一下完整的文件内容,了解上下文:
92
-
93
-
94
- ---
95
-
96
- Read file: metrics/dnsmos.py
97
-
98
- ---
99
-
100
- 现在我来将多线程版本改成单进程版本:
101
-
102
-
103
- ---
104
-
105
- <details><summary>Edit file: metrics/dnsmos.py</summary>
106
-
107
- undefined
108
-
109
- **Chunk 1**
110
- Lines added: 6, lines removed: 10
111
-
112
- ```diff
113
- @@ -127,14 +127,10 @@
114
- clips.extend(audio_clips_list)
115
-
116
- - with concurrent.futures.ThreadPoolExecutor() as executor:
117
- - future_to_url = {executor.submit(compute_score, clip, desired_fs, is_personalized_eval): clip for clip in clips}
118
- - for future in tqdm(concurrent.futures.as_completed(future_to_url)):
119
- - clip = future_to_url[future]
120
- - try:
121
- - data = future.result()
122
- - except Exception as exc:
123
- - print('%r generated an exception: %s' % (clip, exc))
124
- - else:
125
- - rows.append(data)
126
- + for clip in tqdm(clips):
127
- + try:
128
- + data = compute_score(clip, desired_fs, is_personalized_eval)
129
- + rows.append(data)
130
- + except Exception as exc:
131
- + print('%r generated an exception: %s' % (clip, exc))
132
-
133
- df = pd.DataFrame(rows)
134
- ```
135
-
136
- </details>
137
-
138
- ---
139
-
140
- 完成!我已经将多线程版本改成了单进程版本。主要变化如下:
141
-
142
- **修改前(多线程):**
143
- - 使用 `concurrent.futures.ThreadPoolExecutor()` 创建线程池
144
- - 通过 `executor.submit()` 提交任务
145
- - 使用 `as_completed()` 异步收集结果
146
-
147
- **修改后(单进程):**
148
- - 直接使用 `for` 循环遍历音频片段
149
- - 同步调用 `compute_score()` 函数
150
- - 顺序处理每个音频片段
151
-
152
- **优势:**
153
- 1. **代码更简单**:去掉了复杂的并发逻辑
154
- 2. **调试更容易**:单进程执行,错误追踪更直接
155
- 3. **内存使用更少**:不需要维护线程池和任务队列
156
- 4. **依赖更少**:不需要 `concurrent.futures` 模块
157
-
158
- **注意事项:**
159
- - 处理时间会变长,因为失去了并行处理的优势
160
- - 如果音频文件很多,总处理时间会显著增加
161
- - 适合调试或小规模测试使用
162
-
163
- 现在代码会按顺序处理每个音频片段,每个片段处理完成后才会处理下一个。
164
-
165
- ---
166
-
167
- _**User**_
168
-
169
- 这里的目的是什么?
170
-
171
- ---
172
-
173
- _**Assistant**_
174
-
175
- 让我查看一下这段代码的上下文,了解这个循环的目的:
176
-
177
-
178
- ---
179
-
180
- Read file: metrics/dnsmos.py
181
-
182
- ---
183
-
184
- 让我再查看一下更早的代码,了解 `models` 变量是如何定义的:
185
-
186
-
187
- ---
188
-
189
- Read file: metrics/dnsmos.py
190
-
191
- ---
192
-
193
- 现在我明白了!让我解释一下这个循环的目的:
194
-
195
- ```119:125:metrics/dnsmos.py
196
- for m in tqdm(models):
197
- max_recursion_depth = 10
198
- audio_path = os.path.join(args.testset_dir, m)
199
- audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
200
- while len(audio_clips_list) == 0 and max_recursion_depth > 0:
201
- audio_path = os.path.join(audio_path, "**")
202
- audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
203
- max_recursion_depth -= 1
204
- clips.extend(audio_clips_list)
205
- ```
206
-
207
- **这个循环的目的是:**
208
-
209
- 1. **遍历测试集目录**:`models = glob.glob(os.path.join(args.testset_dir, "*"))` 获取测试集目录下的所有子目录和文件
210
-
211
- 2. **递归搜索音频文件**:对于每个子目录,搜索其中的 `.wav` 音频文件
212
-
213
- 3. **处理嵌套目录结构**:如果当前目录没有找到音频文件,会递归地搜索更深层的子目录(最多10层深度)
214
-
215
- 4. **收集所有音频文件路径**:将所有找到的音频文件路径添加到 `clips` 列表中
216
-
217
- **具体工作流程:**
218
- - 遍历测试集目录下的每个子目录
219
- - 在每个子目录中搜索 `.wav` 文件
220
- - 如果没找到,使用 `**` 通配符递归搜索更深层目录
221
- - 最多递归10层,避免无限循环
222
- - 将所有找到的音频文件路径收集到 `clips` 列表中
223
-
224
- **为什么需要这样做:**
225
- - 测试集可能有复杂的目录结构
226
- - 音频文件可能分散在不同的子目录中
227
- - 需要找到所有需要评估的音频文件
228
- - 为后续的音频质量评估做准备
229
-
230
- 这是一个文件发现和收集的预处理步骤,确保程序能找到所有需要处理的音频文件。
231
-
232
- ---
233
-
234
- _**User**_
235
-
236
- 那他为什么不用os.walk
237
-
238
- ---
239
-
240
- _**Assistant**_
241
-
242
- 你说得很对!使用 `os.walk()` 确实是一个更好的选择。让我分析一下为什么:
243
-
244
- **当前代码的问题:**
245
- ```python
246
- for m in tqdm(models):
247
- max_recursion_depth = 10
248
- audio_path = os.path.join(args.testset_dir, m)
249
- audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
250
- while len(audio_clips_list) == 0 and max_recursion_depth > 0:
251
- audio_path = os.path.join(audio_path, "**")
252
- audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
253
- max_recursion_depth -= 1
254
- clips.extend(audio_clips_list)
255
- ```
256
-
257
- **使用 `os.walk()` 的优势:**
258
-
259
- 1. **更简洁**:一行代码就能完成递归遍历
260
- 2. **更高效**:`os.walk()` 是专门为目录遍历优化的
261
- 3. **更可靠**:不需要手动管理递归深度和路径拼接
262
- 4. **更清晰**:代码意图更明确,可读性更好
263
-
264
- **改进后的代码应该是:**
265
- ```python
266
- for root, dirs, files in os.walk(args.testset_dir):
267
- for file in files:
268
- if file.endswith('.wav'):
269
- clips.append(os.path.join(root, file))
270
- ```
271
-
272
- **或者更简洁的版本:**
273
- ```python
274
- clips = []
275
- for root, dirs, files in os.walk(args.testset_dir):
276
- clips.extend([os.path.join(root, f) for f in files if f.endswith('.wav')])
277
- ```
278
-
279
- **为什么原代码没有使用 `os.walk()`:**
280
- 1. **历史原因**:可能是从旧代码迁移过来的
281
- 2. **兼容性考虑**:`glob.glob()` 在某些系统上可能有不同的行为
282
- 3. **路径处理**:原代码可能需要对路径进行特殊处理
283
- 4. **进度显示**:原代码想要显示每个子目录的处理进度
284
-
285
- 你的建议很对,使用 `os.walk()` 确实是更优雅和高效的解决方案。要不要我帮你改成使用 `os.walk()` 的版本?
286
-
287
- ---
288
-
289
- _**User**_
290
-
291
- 帮我修改,使用walk
292
-
293
- ---
294
-
295
- _**Assistant**_
296
-
297
- 好的,我来帮你修改代码,使用 `os.walk()` 来替代当前的递归搜索逻辑:
298
-
299
-
300
- ---
301
-
302
- <details><summary>Edit file: metrics/dnsmos.py</summary>
303
-
304
- undefined
305
-
306
- **Chunk 1**
307
- Lines added: 9, lines removed: 10
308
-
309
- ```diff
310
- @@ -114,16 +114,15 @@
311
- rows = []
312
- clips = []
313
- - clips = glob.glob(os.path.join(args.testset_dir, "*.wav"))
314
- is_personalized_eval = args.personalized_MOS
315
- desired_fs = SAMPLING_RATE
316
- - for m in tqdm(models):
317
- - max_recursion_depth = 10
318
- - audio_path = os.path.join(args.testset_dir, m)
319
- - audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
320
- - while len(audio_clips_list) == 0 and max_recursion_depth > 0:
321
- - audio_path = os.path.join(audio_path, "**")
322
- - audio_clips_list = glob.glob(os.path.join(audio_path, "*.wav"))
323
- - max_recursion_depth -= 1
324
- - clips.extend(audio_clips_list)
325
- +
326
- + # 使用 os.walk 递归搜索所有 .wav 文件
327
- + print("正在搜索音频文件...")
328
- + for root, dirs, files in os.walk(args.testset_dir):
329
- + for file in files:
330
- + if file.endswith('.wav'):
331
- + clips.append(os.path.join(root, file))
332
- +
333
- + print(f"找到 {len(clips)} 个音频文件")
334
-
335
- for clip in tqdm(clips):
336
- ```
337
-
338
- </details>
339
-
340
- ---
341
-
342
- 完成!我已经将代码修改为使用 `os.walk()` 的版本。主要改进如下:
343
-
344
- **修改前的问题:**
345
- - 复杂的递归逻辑,需要手动管理递归深度
346
- - 使用 `glob.glob()` 进行多次路径搜索
347
- - 代码冗长且难以理解
348
-
349
- **修改后的优势:**
350
- 1. **代码更简洁**:从原来的8行代码减少到5行
351
- 2. **更高效**:`os.walk()` 是专门优化的目录遍历函数
352
- 3. **更可靠**:不需要手动管理递归深度和路径拼接
353
- 4. **更清晰**:代码意图明确,易于理解和维护
354
- 5. **添加了进度提示**:显示搜索状态和找到的文件数量
355
-
356
- **新的工作流程:**
357
- 1. 使用 `os.walk()` 递归遍历测试集目录
358
- 2. 检查每个文件是否为 `.wav` 格式
359
- 3. 将找到的音频文件路径添加到 `clips` 列表
360
- 4. 显示找到的文件总数
361
-
362
- 现在代码更加简洁高效,而且功能完全一样。`os.walk()` 会自动处理所有层级的目录遍历,不需要手动管理递归深度。
363
-
364
- ---
365
-
366
- _**User**_
367
-
368
- 这是啥回事?
369
-
370
- ---
371
-
372
- _**Assistant**_
373
-
374
- 看起来你在尝试提交 git 时遇到了问题。错误信息显示:
375
-
376
- ```
377
- fatal: could not read '修复bug+DNSMOS': No such file or directory
378
- ```
379
-
380
- **问题分析:**
381
- 这个错误是因为 `git commit -t` 命令的用法不正确。`-t` 参数是用来指定一个文件作为提交信息的模板,而不是直接写提交信息。
382
-
383
- **正确的 git commit 命令应该是:**
384
-
385
- 1. **使用 `-m` 参数直接写提交信息:**
386
- ```bash
387
- git commit -m "修复bug+DNSMOS"
388
- ```
389
-
390
- 2. **或者先添加文件,再提交:**
391
- ```bash
392
- git add metrics/dnsmos.py
393
- git commit -m "修复bug+DNSMOS"
394
- ```
395
-
396
- 3. **或者使用交互式提交:**
397
- ```bash
398
- git add metrics/dnsmos.py
399
- git commit
400
- ```
401
-
402
- **你刚才的修改内容:**
403
- 从代码修改来看,你对 `metrics/dnsmos.py` 文件做了很大的重构:
404
- - 简化了类的构造函数
405
- - 移除了命令行参数解析
406
- - 简化了主函数逻辑
407
- - 使用了 `neverlib.utils.get_path_list`
408
-
409
- **建议的提交步骤:**
410
- ```bash
411
- # 1. 添加修改的文件
412
- git add metrics/dnsmos.py
413
-
414
- # 2. 提交更改
415
- git commit -m "重构DNSMOS模块:简化代码结构,移除命令行参数,优化类设计"
416
-
417
- # 3. 推送到远程仓库(如果需要)
418
- git push
419
- ```
420
-
421
- 这样就能成功提交你的代码修改了!
422
-
423
- ---
424
-
@@ -1,247 +0,0 @@
1
- <!-- Generated by SpecStory -->
2
-
3
- # 完善函数的功能和变量名建议 (2025-08-22 02:10Z)
4
-
5
- _**User**_
6
-
7
- 帮我完善这个函数,包括功能建议和变量名建议
8
-
9
- ---
10
-
11
- _**Assistant**_
12
-
13
- 我来帮你完善这个函数。让我先仔细分析一下当前的代码,然后提供改进建议。
14
-
15
-
16
- ---
17
-
18
- Read file: audio_aug/audio_aug.py
19
-
20
- ---
21
-
22
- 基于对代码的分析,我来为你的 `snr_aug_changeClean` 函数提供完善建议:
23
-
24
- ## 功能改进建议
25
-
26
- ### 1. 参数验证和类型提示
27
- - 添加参数类型提示
28
- - 增加参数范围验证
29
- - 添加更详细的错误信息
30
-
31
- ### 2. 功能增强
32
- - 支持批量处理
33
- - 添加可选的功率计算方法
34
- - 增加日志记录功能
35
- - 支持不同的归一化策略
36
-
37
- ### 3. 性能优化
38
- - 使用向量化操作
39
- - 添加缓存机制(如果需要重复计算)
40
-
41
- ## 变量名改进建议
42
-
43
- ### 当前变量名问题:
44
- - `clean_scale` → `clean_amplitude_factor` 或 `clean_gain`
45
- - `noisy` → `noisy_signal` 或 `augmented_signal`
46
- - `scale_factor` → `clip_prevention_factor` 或 `normalization_factor`
47
-
48
- ## 完善后的函数代码
49
-
50
- ```python:audio_aug/audio_aug.py
51
- def snr_aug_changeClean(
52
- clean_signal: np.ndarray,
53
- noise_signal: np.ndarray,
54
- target_snr_db: float,
55
- clip_check: bool = True,
56
- power_method: str = "mean",
57
- eps: float = 1e-8
58
- ) -> tuple[np.ndarray, np.ndarray]:
59
- """
60
- 保持噪声不变,改变纯净语音的幅度以达到目标信噪比
61
-
62
- Args:
63
- clean_signal: 纯净语音信号,形状为 (T,) 或 (T, C)
64
- noise_signal: 噪声信号,形状必须与clean_signal相同
65
- target_snr_db: 目标信噪比,单位为dB
66
- clip_check: 是否进行削波检查,默认True
67
- power_method: 功率计算方法,"mean"或"rms",默认"mean"
68
- eps: 数值稳定性常数,默认1e-8
69
-
70
- Returns:
71
- tuple: (增强后的含噪信号, 调整后的纯净信号)
72
-
73
- Raises:
74
- ValueError: 当参数无效时
75
- AssertionError: 当信号形状不匹配时
76
- """
77
- # 参数验证
78
- if target_snr_db < -50 or target_snr_db > 100:
79
- raise ValueError(f"目标信噪比应在-50到100dB之间,当前值: {target_snr_db}")
80
-
81
- if clean_signal.shape != noise_signal.shape:
82
- raise AssertionError(f"信号形状不匹配: clean_signal{clean_signal.shape} != noise_signal{noise_signal.shape}")
83
-
84
- # 计算信号功率
85
- if power_method == "mean":
86
- clean_power = np.mean(clean_signal ** 2)
87
- noise_power = np.mean(noise_signal ** 2)
88
- elif power_method == "rms":
89
- clean_power = np.sqrt(np.mean(clean_signal ** 2)) ** 2
90
- noise_power = np.sqrt(np.mean(noise_signal ** 2)) ** 2
91
- else:
92
- raise ValueError(f"不支持的功率计算方法: {power_method},请使用 'mean' 或 'rms'")
93
-
94
- # 计算纯净信号需要的幅度因子
95
- clean_amplitude_factor = np.sqrt(
96
- noise_power * 10 ** (target_snr_db / 10) / (clean_power + eps)
97
- )
98
-
99
- # 生成含噪信号
100
- augmented_signal = clean_signal * clean_amplitude_factor + noise_signal
101
-
102
- # 削波检查和预防
103
- if clip_check:
104
- max_amplitude = np.max(np.abs(augmented_signal))
105
- if max_amplitude > 1.0:
106
- normalization_factor = 1.0 / max_amplitude
107
- augmented_signal *= normalization_factor
108
- # 同时调整纯净信号以保持一致性
109
- adjusted_clean_signal = clean_signal * clean_amplitude_factor * normalization_factor
110
- else:
111
- adjusted_clean_signal = clean_signal * clean_amplitude_factor
112
- else:
113
- adjusted_clean_signal = clean_signal * clean_amplitude_factor
114
-
115
- return augmented_signal, adjusted_clean_signal
116
- ```
117
-
118
- ## 主要改进点总结
119
-
120
- 1. **参数验证**: 添加了信噪比范围检查和功率计算方法验证
121
- 2. **类型提示**: 使用Python类型提示提高代码可读性
122
- 3. **变量命名**: 使用更清晰、描述性的变量名
123
- 4. **功能扩展**: 支持不同的功率计算方法(均值或RMS)
124
- 5. **错误处理**: 提供更详细的错误信息和异常处理
125
- 6. **文档完善**: 详细的docstring说明参数、返回值和异常
126
- 7. **代码结构**: 更清晰的逻辑分组和注释
127
-
128
- 这些改进使函数更加健壮、可读和可维护,同时保持了原有的核心功能。
129
-
130
- ---
131
-
132
- _**User**_
133
-
134
- 均值或RMS 有区别吗?
135
-
136
- ---
137
-
138
- _**Assistant**_
139
-
140
- 是的,均值和RMS在计算信号功率时确实有区别!让我详细解释一下:
141
-
142
- ## 均值和RMS的区别
143
-
144
- ### 1. **均值方法 (Mean)**
145
- ```python
146
- clean_power = np.mean(clean_signal ** 2)
147
- ```
148
- - 计算所有样本点平方值的算术平均值
149
- - 对异常值(outliers)比较敏感
150
- - 适用于信号幅度相对稳定的情况
151
-
152
- ### 2. **RMS方法 (Root Mean Square)**
153
- ```python
154
- clean_power = np.sqrt(np.mean(clean_signal ** 2))
155
- ```
156
- - 先计算平方值的均值,再开平方根
157
- - 更准确地反映信号的有效值
158
- - 在音频处理中更常用,因为RMS值与感知响度更相关
159
-
160
- ## 实际差异示例
161
-
162
- 让我用一个简单的例子来说明:
163
-
164
- ```python
165
- import numpy as np
166
-
167
- # 模拟一个音频信号
168
- signal = np.array([0.1, 0.2, 0.15, 0.25, 0.18])
169
-
170
- # 均值方法
171
- mean_power = np.mean(signal ** 2)
172
- print(f"均值功率: {mean_power:.6f}")
173
-
174
- # RMS方法
175
- rms_power = np.sqrt(np.mean(signal ** 2)) ** 2
176
- print(f"RMS功率: {rms_power:.6f}")
177
-
178
- # 注意:RMS功率实际上等于均值功率!
179
- print(f"两者相等: {np.isclose(mean_power, rms_power)}")
180
- ```
181
-
182
- ## 关键发现
183
-
184
- **实际上,对于功率计算,均值和RMS是等价的!**
185
-
186
- - `np.mean(signal ** 2)` = 均值功率
187
- - `np.sqrt(np.mean(signal ** 2)) ** 2` = RMS功率
188
-
189
- 这是因为:
190
- 1. RMS = √(均值(signal²))
191
- 2. RMS功率 = RMS² = (√(均值(signal²)))² = 均值(signal²)
192
-
193
- ## 建议
194
-
195
- 既然两种方法结果相同,我建议简化函数:
196
-
197
- ```python:audio_aug/audio_aug.py
198
- def snr_aug_changeClean(
199
- clean_signal: np.ndarray,
200
- noise_signal: np.ndarray,
201
- target_snr_db: float,
202
- clip_check: bool = True,
203
- eps: float = 1e-8
204
- ) -> tuple[np.ndarray, np.ndarray]:
205
- """
206
- 保持噪声不变,改变纯净语音的幅度以达到目标信噪比
207
-
208
- Args:
209
- clean_signal: 纯净语音信号
210
- noise_signal: 噪声信号
211
- target_snr_db: 目标信噪比(dB)
212
- clip_check: 是否进行削波检查
213
- eps: 数值稳定性常数
214
-
215
- Returns:
216
- tuple: (增强后的含噪信号, 调整后的纯净信号)
217
- """
218
- # 参数验证
219
- if target_snr_db < -50 or target_snr_db > 100:
220
- raise ValueError(f"目标信噪比应在-50到100dB之间,当前值: {target_snr_db}")
221
-
222
- if clean_signal.shape != noise_signal.shape:
223
- raise AssertionError(f"信号形状不匹配: clean_signal{clean_signal.shape} != noise_signal{noise_signal.shape}")
224
-
225
- # 计算信号功率(使用均值方法即可)
226
- clean_power = np.mean(clean_signal ** 2)
227
- noise_power = np.mean(noise_signal ** 2)
228
-
229
- # 计算纯净信号需要的幅度因子
230
- clean_amplitude_factor = np.sqrt(
231
- noise_power * 10 ** (target_snr_db / 10) / (clean_power + eps)
232
- )
233
-
234
- # ... 其余代码保持不变 ...
235
- ```
236
-
237
- ## 总结
238
-
239
- - **均值和RMS在功率计算上结果相同**
240
- - **不需要提供两种方法选择**
241
- - **均值方法更直接,计算效率更高**
242
- - **在音频处理中,均值功率是标准做法**
243
-
244
- 所以之前的建议中关于功率计算方法的选择是多余的,直接使用均值方法即可。
245
-
246
- ---
247
-