neverlib 0.2.8__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.
- neverlib/QA/ImpactNoiseRejection.py +119 -0
- neverlib/QA/impact_noise_rejection.png +0 -0
- neverlib/QA/out.pcm +0 -0
- neverlib/QA/out.wav +0 -0
- neverlib/audio_aug/README.md +3 -0
- neverlib/audio_aug/__init__.py +0 -54
- neverlib/data_analyze/__init__.py +0 -44
- neverlib/filter/__init__.py +0 -23
- neverlib/filter/auto_eq/__init__.py +0 -36
- neverlib/filter/core.py +8 -5
- neverlib/metrics/README.md +35 -0
- neverlib/metrics/__init__.py +0 -36
- neverlib/metrics/pesq_c/PESQ +0 -0
- neverlib/signal_gen/babble_noise_generate.py +113 -0
- neverlib/tests/__init__.py +0 -17
- neverlib/utils/README.md +29 -0
- neverlib/utils/__init__.py +6 -50
- neverlib/utils/audio_split.py +20 -20
- neverlib/utils/checkGPU.py +52 -79
- neverlib/utils/floder.py +115 -0
- neverlib/utils/pcm.py +42 -0
- neverlib/utils/utils.py +3 -92
- neverlib/vad/__init__.py +0 -38
- {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/METADATA +15 -1
- neverlib-0.2.9.dist-info/RECORD +119 -0
- neverlib/.claude/settings.local.json +0 -9
- neverlib/.history/Docs/audio_aug/del_20250827162530.py +0 -0
- neverlib/.history/Docs/audio_aug/del_20250827162540.py +0 -2
- neverlib/.history/Docs/audio_aug/del_20250827162541.py +0 -7
- neverlib/.history/Docs/audio_aug/del_20250827162606.py +0 -7
- neverlib/.history/Docs/audio_aug/del_20250827162637.py +0 -8
- neverlib/.history/Docs/audio_aug/del_20250827162645.py +0 -8
- neverlib/.history/Docs/audio_aug/del_20250827162723.py +0 -9
- neverlib/.history/Docs/audio_aug/del_20250827162739.py +0 -9
- neverlib/.history/Docs/audio_aug/test_snr_20250806011311.py +0 -0
- neverlib/.history/Docs/audio_aug/test_snr_20250806011331.py +0 -75
- neverlib/.history/Docs/audio_aug/test_snr_20250806011342.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250806011352.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250806011403.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250806011413.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250806011435.py +0 -55
- neverlib/.history/Docs/audio_aug/test_snr_20250827161751.py +0 -55
- neverlib/.history/Docs/audio_aug/test_snr_20250827161754.py +0 -55
- neverlib/.history/Docs/audio_aug/test_snr_20250827161833.py +0 -54
- neverlib/.history/Docs/audio_aug/test_snr_20250827162017.py +0 -56
- neverlib/.history/Docs/audio_aug/test_snr_20250827162021.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250827162028.py +0 -57
- neverlib/.history/Docs/audio_aug/test_snr_20250827162033.py +0 -55
- neverlib/.history/Docs/audio_aug_test/del_20250827162738.py +0 -9
- neverlib/.history/Docs/audio_aug_test/del_20250827162819.py +0 -9
- neverlib/.history/Docs/audio_aug_test/del_20250827162830.py +0 -9
- neverlib/.history/Docs/audio_aug_test/del_20250827162846.py +0 -9
- neverlib/.history/Docs/audio_aug_test/del_20250827162851.py +0 -9
- neverlib/.history/Docs/audio_aug_test/del_20250827162903.py +0 -10
- neverlib/.history/Docs/audio_aug_test/del_20250827162921.py +0 -10
- neverlib/.history/Docs/audio_aug_test/del_20250827162926.py +0 -10
- neverlib/.history/Docs/audio_aug_test/del_20250827163030.py +0 -10
- neverlib/.history/Docs/audio_aug_test/del_20250827163032.py +0 -10
- neverlib/.history/Docs/vad/1_20250810032405.py +0 -0
- neverlib/.history/Docs/vad/1_20250810032417.py +0 -39
- neverlib/.history/QA/html2markdown_20250822234112.md +0 -0
- neverlib/.history/QA/html2markdown_20250822234140.py +0 -9
- neverlib/.history/QA/html2markdown_20250822234141.md +0 -9
- neverlib/.history/QA/html2markdown_20250822234159.py +0 -12
- neverlib/.history/QA/html2markdown_20250822234200.py +0 -17
- neverlib/.history/QA/html2markdown_20250822234236.py +0 -17
- neverlib/.history/QA/html2markdown_20250822234340.py +0 -14
- neverlib/.history/QA/html2markdown_20250822234522.py +0 -18
- neverlib/.history/QA/html2markdown_20250822234601.py +0 -20
- neverlib/.history/QA/html2markdown_20250822234615.py +0 -22
- neverlib/.history/QA/html2markdown_20250822234715.py +0 -28
- neverlib/.history/QA/html2markdown_20250822234720.py +0 -27
- neverlib/.history/QA/html2markdown_20250822234903.py +0 -27
- neverlib/.history/__init___20250805234212.py +0 -41
- neverlib/.history/__init___20250904102635.py +0 -39
- neverlib/.history/__init___20250904102836.py +0 -34
- neverlib/.history/__init___20250904102838.py +0 -39
- neverlib/.history/__init___20250904102851.py +0 -33
- neverlib/.history/audio_aug/audio_aug_20250806010451.py +0 -125
- neverlib/.history/audio_aug/audio_aug_20250806010750.py +0 -138
- neverlib/.history/audio_aug/audio_aug_20250806010759.py +0 -140
- neverlib/.history/audio_aug/audio_aug_20250806010803.py +0 -140
- neverlib/.history/audio_aug/audio_aug_20250806010809.py +0 -140
- neverlib/.history/audio_aug/audio_aug_20250806011108.py +0 -140
- neverlib/.history/audio_aug/audio_aug_20250826155913.py +0 -158
- neverlib/.history/audio_aug/audio_aug_20250826164159.py +0 -159
- neverlib/.history/audio_aug/audio_aug_20250826164217.py +0 -160
- neverlib/.history/audio_aug/audio_aug_20250826164408.py +0 -161
- neverlib/.history/audio_aug/audio_aug_20250826164423.py +0 -161
- neverlib/.history/audio_aug/audio_aug_20250826164529.py +0 -161
- neverlib/.history/audio_aug/audio_aug_20250826164824.py +0 -161
- neverlib/.history/audio_aug/audio_aug_20250826164932.py +0 -162
- neverlib/.history/audio_aug/audio_aug_20250826164947.py +0 -162
- neverlib/.history/audio_aug/audio_aug_20250826165403.py +0 -162
- neverlib/.history/audio_aug/audio_aug_20250826165421.py +0 -162
- neverlib/.history/audio_aug/audio_aug_20250826165509.py +0 -163
- neverlib/.history/audio_aug/audio_aug_20250826165702.py +0 -163
- neverlib/.history/audio_aug/audio_aug_20250826165732.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826170041.py +0 -163
- neverlib/.history/audio_aug/audio_aug_20250826170105.py +0 -164
- neverlib/.history/audio_aug/audio_aug_20250826170154.py +0 -164
- neverlib/.history/audio_aug/audio_aug_20250826170220.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826170221.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826170228.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826170231.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826212001.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220038.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220133.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220148.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220154.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220156.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220314.py +0 -165
- neverlib/.history/audio_aug/audio_aug_20250826220343.py +0 -184
- neverlib/.history/audio_aug/audio_aug_20250826220345.py +0 -184
- neverlib/.history/audio_aug/audio_aug_20250826220349.py +0 -184
- neverlib/.history/audio_aug/audio_aug_20250826220429.py +0 -184
- neverlib/.history/audio_aug/audio_aug_20250826220447.py +0 -184
- neverlib/.history/audio_aug/audio_aug_20250826220601.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220638.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220641.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220647.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220653.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220655.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220731.py +0 -185
- neverlib/.history/audio_aug/audio_aug_20250826220739.py +0 -185
- neverlib/.history/audio_aug/audio_aug_20250826220747.py +0 -185
- neverlib/.history/audio_aug/audio_aug_20250826220801.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220822.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826220901.py +0 -186
- neverlib/.history/audio_aug/audio_aug_20250826221107.py +0 -187
- neverlib/.history/audio_aug/audio_aug_20250826221310.py +0 -188
- neverlib/.history/audio_aug/audio_aug_20250826221353.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221821.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221838.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221906.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221930.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221939.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826221955.py +0 -191
- neverlib/.history/audio_aug/audio_aug_20250826222008.py +0 -197
- neverlib/.history/audio_aug/audio_aug_20250826222017.py +0 -200
- neverlib/.history/audio_aug/audio_aug_20250826222046.py +0 -203
- neverlib/.history/audio_aug/audio_aug_20250826222105.py +0 -203
- neverlib/.history/audio_aug/audio_aug_20250826222206.py +0 -203
- neverlib/.history/audio_aug/audio_aug_20250826222302.py +0 -203
- neverlib/.history/audio_aug/audio_aug_20250826222336.py +0 -203
- neverlib/.history/audio_aug/audio_aug_20250826222455.py +0 -204
- neverlib/.history/audio_aug/audio_aug_20250826222526.py +0 -204
- neverlib/.history/audio_aug/audio_aug_20250826222541.py +0 -204
- neverlib/.history/audio_aug/audio_aug_20250826222624.py +0 -202
- neverlib/.history/audio_aug/audio_aug_20250826222714.py +0 -205
- neverlib/.history/audio_aug/audio_aug_20250826222820.py +0 -205
- neverlib/.history/audio_aug/audio_aug_20250826222827.py +0 -205
- neverlib/.history/audio_aug/audio_aug_20250826222927.py +0 -232
- neverlib/.history/audio_aug/audio_aug_20250826223009.py +0 -232
- neverlib/.history/audio_aug/audio_aug_20250826223054.py +0 -232
- neverlib/.history/audio_aug/audio_aug_20250826223225.py +0 -233
- neverlib/.history/audio_aug/audio_aug_20250826223344.py +0 -236
- neverlib/.history/audio_aug/audio_aug_20250826223356.py +0 -236
- neverlib/.history/audio_aug/audio_aug_20250826223955.py +0 -242
- neverlib/.history/audio_aug/audio_aug_20250826224210.py +0 -240
- neverlib/.history/audio_aug/audio_aug_20250826224250.py +0 -242
- neverlib/.history/audio_aug/audio_aug_20250826224323.py +0 -280
- neverlib/.history/audio_aug/audio_aug_20250826224452.py +0 -263
- neverlib/.history/audio_aug/audio_aug_20250826224455.py +0 -263
- neverlib/.history/audio_aug/audio_aug_20250826224502.py +0 -263
- neverlib/.history/audio_aug/audio_aug_20250826224528.py +0 -263
- neverlib/.history/audio_aug/audio_aug_20250826224658.py +0 -263
- neverlib/.history/audio_aug/audio_aug_20250826224833.py +0 -264
- neverlib/.history/audio_aug/audio_aug_20250826225013.py +0 -269
- neverlib/.history/audio_aug/audio_aug_20250826225050.py +0 -269
- neverlib/.history/audio_aug/audio_aug_20250826225241.py +0 -268
- neverlib/.history/audio_aug/audio_aug_20250826225315.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826225404.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826225502.py +0 -265
- neverlib/.history/audio_aug/audio_aug_20250826225950.py +0 -267
- neverlib/.history/audio_aug/audio_aug_20250826225959.py +0 -268
- neverlib/.history/audio_aug/audio_aug_20250826230222.py +0 -271
- neverlib/.history/audio_aug/audio_aug_20250826230248.py +0 -270
- neverlib/.history/audio_aug/audio_aug_20250826230638.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826230755.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826230941.py +0 -265
- neverlib/.history/audio_aug/audio_aug_20250826231054.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826231117.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826231219.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826232330.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250826232352.py +0 -266
- neverlib/.history/audio_aug/audio_aug_20250827152748.py +0 -268
- neverlib/.history/audio_aug/audio_aug_20250827152806.py +0 -268
- neverlib/.history/audio_aug/audio_aug_20250827152808.py +0 -268
- neverlib/.history/audio_aug/audio_aug_20250827152917.py +0 -283
- neverlib/.history/audio_aug/audio_aug_20250827152929.py +0 -281
- neverlib/.history/audio_aug/audio_aug_20250827153100.py +0 -286
- neverlib/.history/audio_aug/audio_aug_20250827153102.py +0 -286
- neverlib/.history/audio_aug/audio_aug_20250827153301.py +0 -295
- neverlib/.history/audio_aug/audio_aug_20250827153331.py +0 -298
- neverlib/.history/audio_aug/audio_aug_20250827153525.py +0 -303
- neverlib/.history/audio_aug/audio_aug_20250827153533.py +0 -304
- neverlib/.history/audio_aug/audio_aug_20250827153541.py +0 -321
- neverlib/.history/audio_aug/audio_aug_20250827153805.py +0 -322
- neverlib/.history/audio_aug/audio_aug_20250827153832.py +0 -323
- neverlib/.history/audio_aug/audio_aug_20250827153836.py +0 -324
- neverlib/.history/audio_aug/audio_aug_20250827153846.py +0 -324
- neverlib/.history/audio_aug/audio_aug_20250827153859.py +0 -325
- neverlib/.history/audio_aug/audio_aug_20250827154453.py +0 -337
- neverlib/.history/audio_aug/audio_aug_20250827154513.py +0 -355
- neverlib/.history/audio_aug/audio_aug_20250827154538.py +0 -356
- neverlib/.history/audio_aug/audio_aug_20250827154541.py +0 -357
- neverlib/.history/audio_aug/audio_aug_20250827154612.py +0 -357
- neverlib/.history/audio_aug/audio_aug_20250827154657.py +0 -360
- neverlib/.history/audio_aug/audio_aug_20250827154708.py +0 -360
- neverlib/.history/audio_aug/audio_aug_20250827154728.py +0 -366
- neverlib/.history/audio_aug/audio_aug_20250827154755.py +0 -367
- neverlib/.history/audio_aug/audio_aug_20250827154800.py +0 -367
- neverlib/.history/audio_aug/audio_aug_20250827154917.py +0 -368
- neverlib/.history/audio_aug/audio_aug_20250827154928.py +0 -369
- neverlib/.history/audio_aug/audio_aug_20250827154932.py +0 -370
- neverlib/.history/audio_aug/audio_aug_20250827154947.py +0 -372
- neverlib/.history/audio_aug/audio_aug_20250827155015.py +0 -375
- neverlib/.history/audio_aug/audio_aug_20250827155106.py +0 -375
- neverlib/.history/audio_aug/audio_aug_20250827155114.py +0 -393
- neverlib/.history/audio_aug/audio_aug_20250827155207.py +0 -415
- neverlib/.history/audio_aug/audio_aug_20250827155300.py +0 -415
- neverlib/.history/audio_aug/audio_aug_20250827155321.py +0 -471
- neverlib/.history/audio_aug/audio_aug_20250827164703.py +0 -471
- neverlib/.history/audio_aug/audio_aug_20250827164749.py +0 -471
- neverlib/.history/audio_aug/audio_aug_20250827165252.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827165334.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827165404.py +0 -473
- neverlib/.history/audio_aug/audio_aug_20250827165610.py +0 -473
- neverlib/.history/audio_aug/audio_aug_20250827165805.py +0 -473
- neverlib/.history/audio_aug/audio_aug_20250827170056.py +0 -473
- neverlib/.history/audio_aug/audio_aug_20250827170106.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827170143.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827170216.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827170218.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827170314.py +0 -472
- neverlib/.history/audio_aug/audio_aug_20250827171500.py +0 -471
- neverlib/.history/audio_aug/audio_aug_20250827172347.py +0 -471
- neverlib/.history/audio_aug/audio_aug_20250827172558.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827172559.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827172801.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827182522.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827182526.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827182626.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250827182715.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250904185444.py +0 -470
- neverlib/.history/audio_aug/audio_aug_20250904185538.py +0 -445
- neverlib/.history/dataAnalyze/__init___20250805234204.py +0 -87
- neverlib/.history/dataAnalyze/__init___20250806204125.py +0 -14
- neverlib/.history/dataAnalyze/__init___20250806204139.py +0 -14
- neverlib/.history/dataAnalyze/__init___20250806204159.py +0 -14
- neverlib/.history/data_analyze/__init___20250806204158.py +0 -14
- neverlib/.history/data_analyze/__init___20250827163248.py +0 -14
- neverlib/.history/filter/__init___20250820103351.py +0 -70
- neverlib/.history/filter/__init___20250821102348.py +0 -70
- neverlib/.history/filter/__init___20250821102405.py +0 -14
- neverlib/.history/filter/auto_eq/__init___20250819213121.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102241.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102259.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102307.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102310.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102318.py +0 -36
- neverlib/.history/filter/auto_eq/__init___20250821102507.py +0 -36
- neverlib/.history/filter/auto_eq/de_eq_20250820103848.py +0 -361
- neverlib/.history/filter/auto_eq/de_eq_20250821102422.py +0 -360
- neverlib/.history/filter/auto_eq/freq_eq_20250805234206.py +0 -75
- neverlib/.history/filter/auto_eq/freq_eq_20250820140732.py +0 -75
- neverlib/.history/filter/auto_eq/freq_eq_20250820140745.py +0 -75
- neverlib/.history/filter/auto_eq/freq_eq_20250820140816.py +0 -75
- neverlib/.history/filter/auto_eq/freq_eq_20250820140938.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141003.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141006.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141019.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141049.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141211.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141227.py +0 -77
- neverlib/.history/filter/auto_eq/freq_eq_20250820141311.py +0 -78
- neverlib/.history/filter/auto_eq/freq_eq_20250820141340.py +0 -78
- neverlib/.history/filter/auto_eq/freq_eq_20250820141712.py +0 -78
- neverlib/.history/filter/auto_eq/freq_eq_20250820141733.py +0 -78
- neverlib/.history/filter/auto_eq/freq_eq_20250820141755.py +0 -78
- neverlib/.history/filter/auto_eq/freq_eq_20250821102434.py +0 -76
- neverlib/.history/filter/auto_eq/freq_eq_20250821102500.py +0 -76
- neverlib/.history/filter/auto_eq/freq_eq_20250821102502.py +0 -76
- neverlib/.history/filter/auto_eq/freq_eq_20250821143140.py +0 -76
- neverlib/.history/filter/auto_eq/freq_eq_20250821153208.py +0 -76
- neverlib/.history/filter/auto_eq/freq_eq_20250821153214.py +0 -76
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250820102957.py +0 -380
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113054.py +0 -380
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113150.py +0 -380
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113520.py +0 -385
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250820113525.py +0 -385
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250821102212.py +0 -385
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110521.py +0 -385
- neverlib/.history/filter/auto_eq/ga_eq_basic_20250901110652.py +0 -385
- neverlib/.history/filter/common_20250806002134.py +0 -37
- neverlib/.history/filter/common_20250821120448.py +0 -49
- neverlib/.history/filter/common_20250821120453.py +0 -49
- neverlib/.history/metrics/dnsmos_20250806001612.py +0 -160
- neverlib/.history/metrics/dnsmos_20250815180659.py +0 -160
- neverlib/.history/metrics/dnsmos_20250815180701.py +0 -158
- neverlib/.history/metrics/dnsmos_20250815181321.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181327.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181331.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181620.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181631.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181742.py +0 -154
- neverlib/.history/metrics/dnsmos_20250815181824.py +0 -153
- neverlib/.history/metrics/dnsmos_20250815181834.py +0 -153
- neverlib/.history/metrics/dnsmos_20250815181922.py +0 -153
- neverlib/.history/metrics/dnsmos_20250815182011.py +0 -147
- neverlib/.history/metrics/dnsmos_20250815182036.py +0 -144
- neverlib/.history/metrics/dnsmos_20250815182936.py +0 -143
- neverlib/.history/metrics/dnsmos_20250815182942.py +0 -143
- neverlib/.history/metrics/dnsmos_20250815183032.py +0 -137
- neverlib/.history/metrics/dnsmos_20250815183101.py +0 -144
- neverlib/.history/metrics/dnsmos_20250815183121.py +0 -144
- neverlib/.history/metrics/dnsmos_20250815183123.py +0 -143
- neverlib/.history/metrics/dnsmos_20250815183214.py +0 -143
- neverlib/.history/metrics/dnsmos_20250815183240.py +0 -143
- neverlib/.history/metrics/dnsmos_20250815183248.py +0 -144
- neverlib/.history/metrics/dnsmos_20250815183407.py +0 -142
- neverlib/.history/metrics/dnsmos_20250815183409.py +0 -142
- neverlib/.history/metrics/dnsmos_20250815183431.py +0 -142
- neverlib/.history/metrics/dnsmos_20250815183507.py +0 -140
- neverlib/.history/metrics/dnsmos_20250815183513.py +0 -139
- neverlib/.history/metrics/dnsmos_20250815183618.py +0 -139
- neverlib/.history/metrics/dnsmos_20250815183709.py +0 -140
- neverlib/.history/metrics/dnsmos_20250815183756.py +0 -137
- neverlib/.history/metrics/dnsmos_20250815183815.py +0 -128
- neverlib/.history/metrics/dnsmos_20250815183827.py +0 -129
- neverlib/.history/metrics/dnsmos_20250815183913.py +0 -117
- neverlib/.history/metrics/dnsmos_20250815183914.py +0 -117
- neverlib/.history/metrics/dnsmos_20250815184003.py +0 -118
- neverlib/.history/metrics/dnsmos_20250815184040.py +0 -118
- neverlib/.history/metrics/dnsmos_20250815184049.py +0 -118
- neverlib/.history/metrics/dnsmos_20250815184104.py +0 -117
- neverlib/.history/metrics/dnsmos_20250815184200.py +0 -117
- neverlib/.history/metrics/lpc_lsp_metric_20250816015944.py +0 -128
- neverlib/.history/metrics/lpc_lsp_metric_20250816020142.py +0 -128
- neverlib/.history/metrics/lpc_lsp_metric_20250816020156.py +0 -128
- neverlib/.history/metrics/lpc_lsp_metric_20250816020554.py +0 -130
- neverlib/.history/metrics/lpc_lsp_metric_20250816020600.py +0 -125
- neverlib/.history/metrics/lpc_lsp_metric_20250816020631.py +0 -120
- neverlib/.history/metrics/lpc_lsp_metric_20250816020746.py +0 -118
- neverlib/.history/metrics/lpc_me_20250816013111.py +0 -0
- neverlib/.history/metrics/lpc_me_20250816013129.py +0 -121
- neverlib/.history/metrics/lpc_me_20250816015430.py +0 -103
- neverlib/.history/metrics/lpc_me_20250816015535.py +0 -96
- neverlib/.history/metrics/lpc_me_20250816015542.py +0 -96
- neverlib/.history/metrics/lpc_me_20250816015636.py +0 -97
- neverlib/.history/metrics/lpc_me_20250816015658.py +0 -104
- neverlib/.history/metrics/lpc_me_20250816015703.py +0 -100
- neverlib/.history/metrics/lpc_me_20250816015945.py +0 -128
- neverlib/.history/metrics/snr_20250806010538.py +0 -177
- neverlib/.history/metrics/snr_20250806211634.py +0 -184
- neverlib/.history/metrics/snr_20250827224201.py +0 -182
- neverlib/.history/metrics/snr_20250827234019.py +0 -186
- neverlib/.history/metrics/snr_20250827234028.py +0 -186
- neverlib/.history/metrics/snr_20250827234030.py +0 -186
- neverlib/.history/metrics/spec_20250805234209.py +0 -45
- neverlib/.history/metrics/spec_20250816135530.py +0 -11
- neverlib/.history/metrics/spec_20250816135654.py +0 -16
- neverlib/.history/metrics/spec_20250816135736.py +0 -68
- neverlib/.history/metrics/spec_20250816135904.py +0 -75
- neverlib/.history/metrics/spec_20250816135921.py +0 -82
- neverlib/.history/metrics/spec_20250816140111.py +0 -82
- neverlib/.history/metrics/spec_20250816140543.py +0 -136
- neverlib/.history/metrics/spec_20250816140559.py +0 -172
- neverlib/.history/metrics/spec_20250816140602.py +0 -172
- neverlib/.history/metrics/spec_20250816140608.py +0 -172
- neverlib/.history/metrics/spec_20250816140654.py +0 -148
- neverlib/.history/metrics/spec_20250816140705.py +0 -144
- neverlib/.history/metrics/spec_20250816140755.py +0 -138
- neverlib/.history/metrics/spec_20250816140823.py +0 -170
- neverlib/.history/metrics/spec_20250816140832.py +0 -170
- neverlib/.history/metrics/spec_20250816140833.py +0 -170
- neverlib/.history/metrics/spec_20250816140922.py +0 -147
- neverlib/.history/metrics/spec_20250816141148.py +0 -107
- neverlib/.history/metrics/spec_20250816141219.py +0 -123
- neverlib/.history/metrics/spec_20250816141732.py +0 -178
- neverlib/.history/metrics/spec_20250816141740.py +0 -178
- neverlib/.history/metrics/spec_20250816142030.py +0 -178
- neverlib/.history/metrics/spec_20250816142107.py +0 -135
- neverlib/.history/metrics/spec_20250816142126.py +0 -135
- neverlib/.history/metrics/spec_20250816142410.py +0 -135
- neverlib/.history/metrics/spec_20250816142415.py +0 -136
- neverlib/.history/metrics/spec_metric_20250816135156.py +0 -0
- neverlib/.history/metrics/spec_metric_20250816135226.py +0 -5
- neverlib/.history/metrics/spec_metric_20250816135227.py +0 -10
- neverlib/.history/metrics/spec_metric_20250816135306.py +0 -15
- neverlib/.history/metrics/spec_metric_20250816135442.py +0 -31
- neverlib/.history/metrics/spec_metric_20250816135448.py +0 -31
- neverlib/.history/metrics/spec_metric_20250816135520.py +0 -29
- neverlib/.history/metrics/spec_metric_20250816135537.py +0 -63
- neverlib/.history/metrics/spec_metric_20250816135653.py +0 -65
- neverlib/.history/utils/audio_split_20250805234209.py +0 -268
- neverlib/.history/utils/audio_split_20250904185309.py +0 -268
- neverlib/.history/utils/utils_20250813165516.py +0 -330
- neverlib/.history/utils/utils_20250904181341.py +0 -328
- neverlib/.history/utils/utils_20250904185546.py +0 -352
- neverlib/.history/utils/utils_20250904185548.py +0 -353
- neverlib/.history/utils/utils_20250904185603.py +0 -353
- neverlib/.history/utils/utils_20250904185636.py +0 -353
- neverlib/.history/utils/utils_20250904185658.py +0 -358
- neverlib/.history/utils/utils_20250904190053.py +0 -359
- neverlib/.history/vad/PreProcess_20250805234211.py +0 -63
- neverlib/.history/vad/PreProcess_20250809232455.py +0 -63
- neverlib/.history/vad/PreProcess_20250816020725.py +0 -66
- neverlib/.history/vad/VAD_Silero_20250805234211.py +0 -50
- neverlib/.history/vad/VAD_Silero_20250809232456.py +0 -50
- neverlib/.history/vad/VAD_WebRTC_20250805234211.py +0 -61
- neverlib/.history/vad/VAD_WebRTC_20250809232456.py +0 -61
- neverlib/.history/vad/VAD_funasr_20250805234211.py +0 -54
- neverlib/.history/vad/VAD_funasr_20250809232456.py +0 -54
- neverlib/.history/vad/VAD_vadlib_20250805234211.py +0 -70
- neverlib/.history/vad/VAD_vadlib_20250809232455.py +0 -70
- neverlib/.history/vad/VAD_whisper_20250805234211.py +0 -55
- neverlib/.history/vad/VAD_whisper_20250809232456.py +0 -55
- neverlib/.specstory/.what-is-this.md +0 -69
- 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
- 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
- neverlib/.specstory/history/2025-08-26_11-54Z-oserror-missing-shared-object-file.md +0 -87
- 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
- neverlib/.specstory/history/2025-08-27_08-29Z-delete-python-file-command.md +0 -211
- 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
- neverlib-0.2.8.dist-info/RECORD +0 -510
- {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/WHEEL +0 -0
- {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/licenses/LICENSE +0 -0
- {neverlib-0.2.8.dist-info → neverlib-0.2.9.dist-info}/top_level.txt +0 -0
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
<!-- Generated by SpecStory -->
|
|
2
|
-
|
|
3
|
-
# 在jupyter中播放音频的代码修改 (2025-08-27 09:05Z)
|
|
4
|
-
|
|
5
|
-
_**User**_
|
|
6
|
-
|
|
7
|
-
我想要在jupyter中听音频该如何改代码
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
_**Assistant**_
|
|
12
|
-
|
|
13
|
-
我需要查看当前的代码,了解如何在Jupyter中添加音频播放功能。
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
Read file: Docs/audio_aug_test/test_volume.ipynb
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
Read file: Docs/audio_aug_test/test_volume.ipynb
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
我注意到您想在Jupyter中播放音频文件。在您的代码中,第12行有一个被注释掉的导入语句:`# from IPython.display import Audio, display`。要在Jupyter中播放音频,您需要取消这行的注释并添加播放音频的代码。
|
|
26
|
-
|
|
27
|
-
以下是修改建议:
|
|
28
|
-
|
|
29
|
-
```python:Docs/audio_aug_test/test_volume.ipynb
|
|
30
|
-
# 确保使用本地版本而非安装版本
|
|
31
|
-
import os
|
|
32
|
-
import sys
|
|
33
|
-
sys.path.append("../../")
|
|
34
|
-
from audio_aug import volume_aug_linmax, volume_aug_dbrms, volume_aug_lufs, measure_loudness
|
|
35
|
-
import soundfile as sf
|
|
36
|
-
import numpy as np
|
|
37
|
-
import matplotlib.pyplot as plt
|
|
38
|
-
from IPython.display import Audio, display
|
|
39
|
-
|
|
40
|
-
wav_path = "/data03/never/Dataset/kws_data/Command_Word/group_a_class/zh/pos_example/上一首/037/soft_normal_male_25_151_vadstart5920_vadend33600_snr14.2.wav"
|
|
41
|
-
wav, sr = sf.read(wav_path, always_2d=True, dtype="float32")
|
|
42
|
-
wav = wav[:, 1]
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
然后在需要播放音频的单元格中添加以下代码:
|
|
46
|
-
|
|
47
|
-
```python
|
|
48
|
-
# 播放原始音频
|
|
49
|
-
display(Audio(wav, rate=sr))
|
|
50
|
-
|
|
51
|
-
# 播放处理后的音频(比如wav_linear)
|
|
52
|
-
display(Audio(wav_linear, rate=sr))
|
|
53
|
-
|
|
54
|
-
# 播放处理后的音频(比如wav_dbrms)
|
|
55
|
-
display(Audio(wav_dbrms, rate=sr))
|
|
56
|
-
|
|
57
|
-
# 播放处理后的音频(比如wav_lufs)
|
|
58
|
-
display(Audio(wav_lufs, rate=sr))
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
您可以在任何需要播放音频的单元格中添加这些代码。例如,在每个处理完音频后的单元格中添加对应的播放代码,或者创建一个新的单元格专门用于播放所有处理过的音频进行比较。
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
_**User**_
|
|
66
|
-
|
|
67
|
-
jupyte有画时域波形的函数吗?
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
_**Assistant**_
|
|
72
|
-
|
|
73
|
-
是的,Jupyter中可以使用matplotlib库来绘制时域波形。从您当前的代码中可以看到,您已经在使用matplotlib绘制波形了。
|
|
74
|
-
|
|
75
|
-
在您的代码中,已经有时域波形的绘制:
|
|
76
|
-
|
|
77
|
-
```python
|
|
78
|
-
plt.figure(figsize=(10, 6))
|
|
79
|
-
plt.subplot(2, 1, 1)
|
|
80
|
-
time = np.arange(len(wav)) / sr
|
|
81
|
-
plt.plot(time, wav) # 这里就是绘制时域波形
|
|
82
|
-
plt.ylim(-1, 1)
|
|
83
|
-
plt.grid()
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
这段代码创建了一个图形,其中上半部分绘制了音频信号的时域波形,下半部分绘制了频谱图。
|
|
87
|
-
|
|
88
|
-
如果您想单独绘制更美观的时域波形,可以使用以下代码:
|
|
89
|
-
|
|
90
|
-
```python
|
|
91
|
-
def plot_waveform(signal, sample_rate, title="波形图"):
|
|
92
|
-
"""绘制音频波形的时域图"""
|
|
93
|
-
duration = len(signal) / sample_rate
|
|
94
|
-
time = np.linspace(0, duration, len(signal))
|
|
95
|
-
|
|
96
|
-
plt.figure(figsize=(12, 4))
|
|
97
|
-
plt.plot(time, signal, color='blue')
|
|
98
|
-
plt.title(title)
|
|
99
|
-
plt.xlabel('时间 (秒)')
|
|
100
|
-
plt.ylabel('振幅')
|
|
101
|
-
plt.grid(True)
|
|
102
|
-
plt.tight_layout()
|
|
103
|
-
plt.show()
|
|
104
|
-
|
|
105
|
-
# 使用方法
|
|
106
|
-
plot_waveform(wav, sr, "原始音频波形")
|
|
107
|
-
plot_waveform(wav_linear, sr, "线性增强后的波形")
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
这个函数会创建一个更清晰、更专注于时域表示的波形图,包含适当的标签和网格。
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
_**User**_
|
|
115
|
-
|
|
116
|
-
wav_linear = volume_aug_linmax(wav, 0.5, hpf=True)
|
|
117
|
-
为什么这段代码后,wav初始值会被改变
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
_**Assistant**_
|
|
122
|
-
|
|
123
|
-
<details>
|
|
124
|
-
<summary>Searched codebase "volume_aug_linmax function implementation" • **14** results</summary>
|
|
125
|
-
|
|
126
|
-
| File | Lines |
|
|
127
|
-
|------|-------|
|
|
128
|
-
| `audio_aug/audio_aug.py` | L283-372 |
|
|
129
|
-
| `.history/audio_aug/audio_aug_20250827170056.py` | L283-374 |
|
|
130
|
-
| `.history/audio_aug/audio_aug_20250827170216.py` | L283-373 |
|
|
131
|
-
| `.history/audio_aug/audio_aug_20250827170314.py` | L283-373 |
|
|
132
|
-
| `.history/audio_aug/audio_aug_20250827170143.py` | L283-373 |
|
|
133
|
-
| `.history/audio_aug/audio_aug_20250827170106.py` | L283-373 |
|
|
134
|
-
| `.history/audio_aug/audio_aug_20250827171500.py` | L283-372 |
|
|
135
|
-
| `.history/audio_aug/audio_aug_20250827170218.py` | L283-373 |
|
|
136
|
-
| `audio_aug/audio_aug.py` | L257-301 |
|
|
137
|
-
| `.history/audio_aug/audio_aug_20250827170106.py` | L257-302 |
|
|
138
|
-
| `.history/audio_aug/audio_aug_20250827170056.py` | L257-303 |
|
|
139
|
-
| `.history/audio_aug/audio_aug_20250827170216.py` | L257-302 |
|
|
140
|
-
| `Docs/audio_aug/test_volume.ipynb` | Lundefined-22 |
|
|
141
|
-
| `.history/audio_aug/audio_aug_20250827170143.py` | L257-302 |
|
|
142
|
-
|
|
143
|
-
</details>
|
|
144
|
-
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
问题在于`volume_aug_linmax`函数中直接修改了输入参数`wav`的值。查看函数实现,在第323行有一个关键操作:
|
|
148
|
-
|
|
149
|
-
```python
|
|
150
|
-
wav *= scalar
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
这行代码直接对传入的`wav`数组进行了原地修改(in-place modification),而不是创建一个新的数组。在Python中,NumPy数组是可变对象,当你将数组传递给函数时,函数接收的是数组的引用,而不是数组的副本。因此,当函数中修改了这个数组,原始数组也会被修改。
|
|
154
|
-
|
|
155
|
-
要避免这个问题,您可以在调用函数前先创建原始数据的副本:
|
|
156
|
-
|
|
157
|
-
```python
|
|
158
|
-
# 创建wav的副本再传入函数
|
|
159
|
-
wav_copy = wav.copy()
|
|
160
|
-
wav_linear = volume_aug_linmax(wav_copy, 0.5, hpf=True)
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
或者修改`volume_aug_linmax`函数,让它在内部处理时不修改原始数据:
|
|
164
|
-
|
|
165
|
-
```python
|
|
166
|
-
def volume_aug_linmax(wav, target_level, hpf=False, sr=16000, order=4, cutoff=100):
|
|
167
|
-
"""
|
|
168
|
-
音量增强, 使用linmax方法
|
|
169
|
-
Args:
|
|
170
|
-
wav: 音频
|
|
171
|
-
target_level: 目标音量, 单位dB
|
|
172
|
-
hpf: 是否高通滤波
|
|
173
|
-
sr: 采样率
|
|
174
|
-
order: 滤波器阶数
|
|
175
|
-
cutoff: 截止频率
|
|
176
|
-
"""
|
|
177
|
-
assert target_level > 0 and target_level < 1, "target_level must be between 0 and 1"
|
|
178
|
-
# 创建输入数据的副本,避免修改原始数据
|
|
179
|
-
wav_out = wav.copy()
|
|
180
|
-
wav_tmp = wav.copy()
|
|
181
|
-
if hpf:
|
|
182
|
-
wav_tmp = HPFilter(wav_tmp, sr=sr, order=order, cutoff=cutoff)
|
|
183
|
-
wav_max = np.max(np.abs(wav_tmp))
|
|
184
|
-
scalar = target_level / (wav_max + EPS)
|
|
185
|
-
wav_out *= scalar
|
|
186
|
-
wav_out = limiter(wav_out)
|
|
187
|
-
|
|
188
|
-
return wav_out
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
这样修改后,函数就不会改变原始输入数据了。
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
_**User**_
|
|
196
|
-
|
|
197
|
-
不太理解,局部变量为什么会改变局全局变量,有没有其他解法,比如深浅拷贝方式
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
_**Assistant**_
|
|
202
|
-
|
|
203
|
-
这个问题涉及到Python中对象的传递方式和可变对象的特性。让我解释一下:
|
|
204
|
-
|
|
205
|
-
### 为什么局部变量会改变全局变量
|
|
206
|
-
|
|
207
|
-
在Python中,当你将一个变量传递给函数时,实际上传递的是对象的引用,而不是对象的副本。对于可变对象(如列表、字典、NumPy数组等),这意味着函数内部对该对象的修改会影响到函数外部的原始对象。
|
|
208
|
-
|
|
209
|
-
在`volume_aug_linmax`函数中:
|
|
210
|
-
```python
|
|
211
|
-
def volume_aug_linmax(wav, target_level, hpf=False, sr=16000, order=4, cutoff=100):
|
|
212
|
-
# ...
|
|
213
|
-
wav *= scalar # 直接修改了传入的wav对象
|
|
214
|
-
# ...
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
这里的`wav`参数接收的是外部传入的NumPy数组的引用,所以当函数内部使用`*=`运算符修改它时,外部的原始数组也被修改了。
|
|
218
|
-
|
|
219
|
-
### 解决方案
|
|
220
|
-
|
|
221
|
-
#### 1. 深拷贝与浅拷贝
|
|
222
|
-
|
|
223
|
-
对于NumPy数组,可以使用以下方法创建副本:
|
|
224
|
-
|
|
225
|
-
- **浅拷贝**:`wav.copy()`或`np.copy(wav)`
|
|
226
|
-
- 对于一维数组,浅拷贝已经足够
|
|
227
|
-
- 这会创建一个新的数组对象,但内部的复杂对象(如果有)仍然是引用
|
|
228
|
-
|
|
229
|
-
- **深拷贝**:`import copy; copy.deepcopy(wav)`
|
|
230
|
-
- 完全复制整个对象及其所有嵌套对象
|
|
231
|
-
- 对于简单的NumPy数组,通常不需要深拷贝
|
|
232
|
-
|
|
233
|
-
#### 2. 在调用函数前创建副本
|
|
234
|
-
|
|
235
|
-
```python
|
|
236
|
-
# 方法1:使用NumPy的copy方法
|
|
237
|
-
wav_copy = wav.copy()
|
|
238
|
-
wav_linear = volume_aug_linmax(wav_copy, 0.5, hpf=True)
|
|
239
|
-
|
|
240
|
-
# 方法2:使用NumPy的array函数创建新数组
|
|
241
|
-
wav_copy = np.array(wav)
|
|
242
|
-
wav_linear = volume_aug_linmax(wav_copy, 0.5, hpf=True)
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
#### 3. 修改函数返回新对象而不修改输入
|
|
246
|
-
|
|
247
|
-
```python
|
|
248
|
-
def volume_aug_linmax_fixed(wav, target_level, hpf=False, sr=16000, order=4, cutoff=100):
|
|
249
|
-
"""
|
|
250
|
-
音量增强, 使用linmax方法(不修改输入)
|
|
251
|
-
"""
|
|
252
|
-
assert target_level > 0 and target_level < 1, "target_level must be between 0 and 1"
|
|
253
|
-
# 创建输入数据的副本
|
|
254
|
-
wav_out = wav.copy() # 关键是这一步
|
|
255
|
-
wav_tmp = wav.copy()
|
|
256
|
-
if hpf:
|
|
257
|
-
wav_tmp = HPFilter(wav_tmp, sr=sr, order=order, cutoff=cutoff)
|
|
258
|
-
wav_max = np.max(np.abs(wav_tmp))
|
|
259
|
-
scalar = target_level / (wav_max + EPS)
|
|
260
|
-
wav_out *= scalar # 修改副本而不是原始数据
|
|
261
|
-
wav_out = limiter(wav_out)
|
|
262
|
-
return wav_out
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
#### 4. 函数式编程方法(不修改任何输入)
|
|
266
|
-
|
|
267
|
-
```python
|
|
268
|
-
def volume_aug_linmax_functional(wav, target_level, hpf=False, sr=16000, order=4, cutoff=100):
|
|
269
|
-
"""
|
|
270
|
-
音量增强, 使用linmax方法(函数式方法)
|
|
271
|
-
"""
|
|
272
|
-
assert target_level > 0 and target_level < 1, "target_level must be between 0 and 1"
|
|
273
|
-
wav_tmp = wav.copy() if hpf else wav
|
|
274
|
-
if hpf:
|
|
275
|
-
wav_tmp = HPFilter(wav_tmp, sr=sr, order=order, cutoff=cutoff)
|
|
276
|
-
wav_max = np.max(np.abs(wav_tmp))
|
|
277
|
-
scalar = target_level / (wav_max + EPS)
|
|
278
|
-
# 创建新数组而不是修改原始数组
|
|
279
|
-
return limiter(wav * scalar)
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
对于您的情况,最简单的解决方案是在调用函数前创建一个副本,或者修改函数内部创建副本。对于NumPy数组,通常`.copy()`方法就足够了,不需要使用`copy.deepcopy()`,因为NumPy数组通常不包含嵌套的复杂对象。
|
|
283
|
-
|
|
284
|
-
---
|
|
285
|
-
|
|
286
|
-
_**User**_
|
|
287
|
-
|
|
288
|
-
我改成了这样还是有问题
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
|
-
_**Assistant**_
|
|
293
|
-
|
|
294
|
-
我看到您修改了`volume_aug_dbrms`函数,但问题可能出在`volume_aug_linmax`函数上。让我们检查一下`volume_aug_linmax`函数的当前实现:
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
Read file: audio_aug/audio_aug.py
|
|
299
|
-
|
|
300
|
-
---
|
|
301
|
-
|
|
302
|
-
我发现问题所在了。尽管您修改了`volume_aug_dbrms`函数使其不改变原始数组,但`volume_aug_linmax`函数仍然有问题。在第322行:
|
|
303
|
-
|
|
304
|
-
```python
|
|
305
|
-
wav *= scalar
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
这行代码直接修改了输入的`wav`数组。虽然在第317行创建了`wav_tmp = wav.copy()`,但这个副本只用于计算,而实际的音量调整仍然是在原始`wav`上进行的。
|
|
309
|
-
|
|
310
|
-
要解决这个问题,您需要修改`volume_aug_linmax`函数,使其像`volume_aug_dbrms`一样不修改原始输入:
|
|
311
|
-
|
|
312
|
-
```python
|
|
313
|
-
def volume_aug_linmax(wav, target_level, hpf=False, sr=16000, order=4, cutoff=100):
|
|
314
|
-
"""
|
|
315
|
-
音量增强, 使用linmax方法
|
|
316
|
-
Args:
|
|
317
|
-
wav: 音频
|
|
318
|
-
target_level: 目标音量, 单位dB
|
|
319
|
-
hpf: 是否高通滤波
|
|
320
|
-
sr: 采样率
|
|
321
|
-
order: 滤波器阶数
|
|
322
|
-
cutoff: 截止频率
|
|
323
|
-
"""
|
|
324
|
-
assert target_level > 0 and target_level < 1, "target_level must be between 0 and 1"
|
|
325
|
-
wav_tmp = wav.copy()
|
|
326
|
-
if hpf:
|
|
327
|
-
wav_tmp = HPFilter(wav_tmp, sr=sr, order=order, cutoff=cutoff)
|
|
328
|
-
wav_max = np.max(np.abs(wav_tmp))
|
|
329
|
-
scalar = target_level / (wav_max + EPS)
|
|
330
|
-
wav_opt = wav.copy() * scalar # 创建新数组而不是修改原始数组
|
|
331
|
-
wav_opt = limiter(wav_opt)
|
|
332
|
-
|
|
333
|
-
return wav_opt
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
关键的改变是:
|
|
337
|
-
1. 创建一个新的数组`wav_opt`来存储调整后的音频,而不是修改原始的`wav`
|
|
338
|
-
2. 使用`wav.copy() * scalar`而不是`wav *= scalar`来避免原地修改
|
|
339
|
-
|
|
340
|
-
同样,我注意到`volume_aug_lufs`函数也有类似问题,在第370行:
|
|
341
|
-
|
|
342
|
-
```python
|
|
343
|
-
wav = wav * scalar
|
|
344
|
-
```
|
|
345
|
-
|
|
346
|
-
虽然这看起来像是创建了新数组,但实际上Python可能会优化这个操作为原地修改。为了安全起见,也应该修改为:
|
|
347
|
-
|
|
348
|
-
```python
|
|
349
|
-
wav_opt = wav.copy() * scalar
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
然后返回`wav_opt`而不是修改后的`wav`。
|
|
353
|
-
|
|
354
|
-
修改后的`volume_aug_linmax`函数应该不会再改变原始的`wav`数组了。
|
|
355
|
-
|
|
356
|
-
---
|
|
357
|
-
|