neverlib 0.2.8__py3-none-any.whl → 0.3.0__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/Docs/audio_aug/test_volume.ipynb +8 -8
- neverlib/Docs/filter/biquad.ipynb +1 -1
- neverlib/Docs/filter/filter_family.ipynb +4 -4
- neverlib/Docs/vad/VAD_WebRTC.ipynb +4 -4
- neverlib/Docs/vad/VAD_whisper.ipynb +2 -2
- neverlib/LLM/__init__.py +37 -0
- neverlib/LLM/bailian.py +342 -0
- neverlib/LLM/image.py +73 -0
- neverlib/LLM/text.py +32 -0
- neverlib/QA/ImpactNoiseRejection.py +119 -0
- neverlib/QA/gen_init.py +13 -16
- neverlib/__init__.py +5 -5
- neverlib/audio_aug/HarmonicDistortion.py +11 -11
- neverlib/audio_aug/README.md +3 -0
- neverlib/audio_aug/__init__.py +2 -2
- neverlib/audio_aug/audio_aug.py +18 -18
- neverlib/audio_aug/coder_aug.py +25 -25
- neverlib/audio_aug/coder_aug2.py +10 -10
- neverlib/audio_aug/loss_packet_aug.py +16 -16
- neverlib/audio_aug/quant_aug.py +7 -7
- neverlib/data_analyze/README.md +1 -1
- neverlib/data_analyze/__init__.py +2 -2
- neverlib/data_analyze/dataset_analyzer.py +2 -2
- neverlib/data_analyze/quality_metrics.py +12 -12
- neverlib/data_analyze/statistics.py +1 -1
- neverlib/data_analyze/visualization.py +1 -1
- neverlib/filter/README.md +3 -3
- neverlib/filter/__init__.py +2 -2
- neverlib/filter/auto_eq/README.md +2 -2
- neverlib/filter/auto_eq/__init__.py +2 -2
- neverlib/filter/auto_eq/de_eq.py +1 -1
- neverlib/filter/auto_eq/ga_eq_advanced.py +2 -2
- neverlib/filter/auto_eq/ga_eq_basic.py +1 -1
- neverlib/filter/biquad.py +1 -1
- neverlib/filter/core.py +8 -5
- neverlib/metrics/README.md +35 -0
- neverlib/metrics/__init__.py +2 -2
- neverlib/metrics/dnsmos.py +2 -2
- neverlib/metrics/lpc_lsp.py +8 -8
- neverlib/metrics/pesq_c/PESQ +0 -0
- neverlib/metrics/snr.py +5 -5
- neverlib/metrics/spec.py +23 -23
- neverlib/metrics/test_pesq.py +3 -3
- neverlib/signal_gen/babble_noise_generate.py +113 -0
- neverlib/tests/__init__.py +2 -2
- neverlib/tests/test_imports.py +1 -1
- neverlib/utils/README.md +29 -0
- neverlib/utils/__init__.py +24 -16
- neverlib/utils/audio_split.py +21 -21
- neverlib/utils/checkGPU.py +52 -79
- neverlib/utils/floder.py +115 -0
- neverlib/utils/lazy_expose.py +1 -1
- neverlib/utils/lazy_module.py +6 -6
- neverlib/utils/message.py +2 -3
- neverlib/utils/pcm.py +42 -0
- neverlib/utils/utils.py +108 -91
- neverlib/vad/README.md +5 -5
- neverlib/vad/__init__.py +2 -2
- neverlib/vad/utils.py +1 -1
- {neverlib-0.2.8.dist-info → neverlib-0.3.0.dist-info}/METADATA +17 -3
- neverlib-0.3.0.dist-info/RECORD +120 -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.3.0.dist-info}/WHEEL +0 -0
- {neverlib-0.2.8.dist-info → neverlib-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {neverlib-0.2.8.dist-info → neverlib-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
|
-
#
|
|
7
|
+
# 仅在类型检查时导入, 提供IDE补全支持
|
|
8
8
|
from .dataset_analyzer import AudioFileInfo, DatasetAnalyzer, analyze_audio_dataset
|
|
9
9
|
from .quality_metrics import QualityAnalyzer, audio_health_check, comprehensive_quality_assessment
|
|
10
10
|
from .rms_distrubution import get_rms_vad
|
|
@@ -66,4 +66,4 @@ if TYPE_CHECKING:
|
|
|
66
66
|
'AudioVisualizer',
|
|
67
67
|
'create_analysis_dashboard',
|
|
68
68
|
'plot_dataset_overview',
|
|
69
|
-
]
|
|
69
|
+
]
|
|
@@ -130,7 +130,7 @@ class DatasetAnalyzer:
|
|
|
130
130
|
has_clipping = max_amplitude >= 0.99
|
|
131
131
|
is_silent = mean_amplitude < 1e-6
|
|
132
132
|
|
|
133
|
-
# SNR
|
|
133
|
+
# SNR估计(基于信号强度和噪声层)
|
|
134
134
|
snr_estimate = None
|
|
135
135
|
try:
|
|
136
136
|
if not is_silent:
|
|
@@ -548,7 +548,7 @@ def analyze_audio_dataset(directory: str, output_dir: str = None,
|
|
|
548
548
|
|
|
549
549
|
Args:
|
|
550
550
|
directory: 音频文件目录
|
|
551
|
-
output_dir:
|
|
551
|
+
output_dir: 输出目录(可选)
|
|
552
552
|
extensions: 支持的文件扩展名
|
|
553
553
|
sr: 目标采样率
|
|
554
554
|
n_jobs: 并行作业数
|
|
@@ -32,12 +32,12 @@ class QualityAnalyzer:
|
|
|
32
32
|
|
|
33
33
|
Args:
|
|
34
34
|
signal_audio: 含有信号和噪声的音频
|
|
35
|
-
noise_audio:
|
|
36
|
-
signal_start:
|
|
37
|
-
signal_end:
|
|
35
|
+
noise_audio: 纯噪声音频(可选)
|
|
36
|
+
signal_start: 信号开始位置(当噪声未单独提供时使用)
|
|
37
|
+
signal_end: 信号结束位置(当噪声未单独提供时使用)
|
|
38
38
|
|
|
39
39
|
Returns:
|
|
40
|
-
SNR
|
|
40
|
+
SNR值(dB)
|
|
41
41
|
"""
|
|
42
42
|
if noise_audio is not None:
|
|
43
43
|
# 如果提供了噪声音频
|
|
@@ -72,7 +72,7 @@ class QualityAnalyzer:
|
|
|
72
72
|
|
|
73
73
|
Args:
|
|
74
74
|
audio: 音频信号
|
|
75
|
-
fundamental_freq:
|
|
75
|
+
fundamental_freq: 基频(Hz), 如果不提供则自动检测
|
|
76
76
|
num_harmonics: 考虑的谐波数量
|
|
77
77
|
|
|
78
78
|
Returns:
|
|
@@ -127,7 +127,7 @@ class QualityAnalyzer:
|
|
|
127
127
|
percentile_high: 高百分位数
|
|
128
128
|
|
|
129
129
|
Returns:
|
|
130
|
-
|
|
130
|
+
动态范围(dB)
|
|
131
131
|
"""
|
|
132
132
|
amplitude = np.abs(audio)
|
|
133
133
|
amplitude = amplitude[amplitude > 0] # 避免log(0)
|
|
@@ -148,7 +148,7 @@ class QualityAnalyzer:
|
|
|
148
148
|
|
|
149
149
|
Args:
|
|
150
150
|
audio: 测试音频信号
|
|
151
|
-
reference_audio:
|
|
151
|
+
reference_audio: 参考音频信号(可选)
|
|
152
152
|
|
|
153
153
|
Returns:
|
|
154
154
|
(频率数组, 幅度响应数组)
|
|
@@ -187,11 +187,11 @@ class QualityAnalyzer:
|
|
|
187
187
|
|
|
188
188
|
def loudness_range(self, audio: np.ndarray, gate_threshold: float = -70) -> dict:
|
|
189
189
|
"""
|
|
190
|
-
|
|
190
|
+
计算响度范围(基于EBU R128标准的简化版本)
|
|
191
191
|
|
|
192
192
|
Args:
|
|
193
193
|
audio: 音频信号
|
|
194
|
-
gate_threshold:
|
|
194
|
+
gate_threshold: 门限阈值(dB)
|
|
195
195
|
|
|
196
196
|
Returns:
|
|
197
197
|
响度统计信息字典
|
|
@@ -203,7 +203,7 @@ class QualityAnalyzer:
|
|
|
203
203
|
blocks = []
|
|
204
204
|
for i in range(0, len(audio) - block_size, hop_size):
|
|
205
205
|
block = audio[i:i + block_size]
|
|
206
|
-
#
|
|
206
|
+
# 简化的响度计算(使用RMS近似)
|
|
207
207
|
rms = np.sqrt(np.mean(block ** 2))
|
|
208
208
|
if rms > 0:
|
|
209
209
|
loudness = 20 * np.log10(rms)
|
|
@@ -235,7 +235,7 @@ class QualityAnalyzer:
|
|
|
235
235
|
processed: 处理后音频
|
|
236
236
|
|
|
237
237
|
Returns:
|
|
238
|
-
|
|
238
|
+
谱失真度(dB)
|
|
239
239
|
"""
|
|
240
240
|
# 确保两个信号长度相同
|
|
241
241
|
min_len = min(len(original), len(processed))
|
|
@@ -265,7 +265,7 @@ def comprehensive_quality_assessment(audio: np.ndarray, sr: int = 22050,
|
|
|
265
265
|
Args:
|
|
266
266
|
audio: 待评估音频
|
|
267
267
|
sr: 采样率
|
|
268
|
-
reference:
|
|
268
|
+
reference: 参考音频(可选)
|
|
269
269
|
|
|
270
270
|
Returns:
|
|
271
271
|
质量评估结果字典
|
neverlib/filter/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# neverlib.filter
|
|
2
2
|
|
|
3
|
-
本项目包含音频滤波器的实现和自动EQ匹配算法, 主要基于 scipy.signal 进行封装和扩展, 提供便捷的音频滤波器设计、处理功能以及智能EQ
|
|
3
|
+
本项目包含音频滤波器的实现和自动EQ匹配算法, 主要基于 scipy.signal 进行封装和扩展, 提供便捷的音频滤波器设计、处理功能以及智能EQ补偿解决方案.
|
|
4
4
|
|
|
5
5
|
## 主要功能
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
### 核心文件说明
|
|
20
20
|
- `filters.py`: 提供 EQFilter 类, 包含多种滤波器的设计和实现
|
|
21
|
-
- `biquad.py`:
|
|
21
|
+
- `biquad.py`: 二阶节(Biquad)滤波器的实现, 支持逐点处理
|
|
22
22
|
- `common.py`: 基础滤波器函数, 提供 numpy/scipy 和 torch 版本
|
|
23
23
|
|
|
24
24
|
### 自动EQ匹配算法 (AudoEQ/)
|
|
@@ -64,7 +64,7 @@ output = [biquad.process(x) for x in input_signal]
|
|
|
64
64
|
对于需要自动EQ匹配的场景, 可以直接运行AudoEQ中的脚本:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
#
|
|
67
|
+
# 快速频谱匹配(推荐入门)
|
|
68
68
|
cd AudoEQ
|
|
69
69
|
python auto_eq_spectral_direct.py
|
|
70
70
|
|
neverlib/filter/__init__.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
|
-
#
|
|
7
|
+
# 仅在类型检查时导入, 提供IDE补全支持
|
|
8
8
|
from .biquad import BiquadFilter
|
|
9
9
|
from .common import HPFilter, HPFilter_torch, LPFilter
|
|
10
10
|
from .core import EQFilter, EQ_test, eq_process, eq_process_test
|
|
@@ -37,4 +37,4 @@ if TYPE_CHECKING:
|
|
|
37
37
|
'EQ_test',
|
|
38
38
|
'eq_process',
|
|
39
39
|
'eq_process_test',
|
|
40
|
-
]
|
|
40
|
+
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Audio EQ Matching Scripts Collection
|
|
2
2
|
|
|
3
|
-
本文件夹包含多种不同算法的音频EQ匹配脚本, 可以自动分析两个音频文件的频谱差异并生成EQ
|
|
3
|
+
本文件夹包含多种不同算法的音频EQ匹配脚本, 可以自动分析两个音频文件的频谱差异并生成EQ补偿参数.
|
|
4
4
|
|
|
5
5
|
## 📁 脚本概览
|
|
6
6
|
|
|
@@ -162,4 +162,4 @@ SAMPLE_RATE = 16000 # 采样率
|
|
|
162
162
|
|
|
163
163
|
## 📄 许可证
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
本项目仅供学习和研究使用.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
|
-
#
|
|
7
|
+
# 仅在类型检查时导入, 提供IDE补全支持
|
|
8
8
|
from .de_eq import get_filter_function, match_frequency_response, plot_spectra_comparison
|
|
9
9
|
from .freq_eq import get_freq_eq
|
|
10
10
|
from .ga_eq_advanced import EQConfig, EQOptimizer, load_config_from_yaml, main
|
|
@@ -52,4 +52,4 @@ if TYPE_CHECKING:
|
|
|
52
52
|
'get_single_filter_freq_response_db_from_coeffs',
|
|
53
53
|
'individual_creator',
|
|
54
54
|
'main_ga',
|
|
55
|
-
]
|
|
55
|
+
]
|
neverlib/filter/auto_eq/de_eq.py
CHANGED
|
@@ -355,4 +355,4 @@ if __name__ == '__main__':
|
|
|
355
355
|
print(f" 频段 {i + 1}: 类型={params['filter_type']}, Fc={params['fc']:.1f}, Q={params['Q']:.2f}" +
|
|
356
356
|
(f", 增益={params['dBgain']:.2f}" if params['dBgain'] is not None else ""))
|
|
357
357
|
else:
|
|
358
|
-
print("未生成EQ
|
|
358
|
+
print("未生成EQ参数或处理中发生错误. ")
|
|
@@ -119,7 +119,7 @@ class EQOptimizer:
|
|
|
119
119
|
|
|
120
120
|
def _setup_deap(self):
|
|
121
121
|
"""设置DEAP遗传算法框架"""
|
|
122
|
-
#
|
|
122
|
+
# 清除之前的注册(如果有的话)
|
|
123
123
|
if hasattr(creator, "FitnessMin"):
|
|
124
124
|
del creator.FitnessMin
|
|
125
125
|
if hasattr(creator, "Individual"):
|
|
@@ -177,7 +177,7 @@ class EQOptimizer:
|
|
|
177
177
|
return individual,
|
|
178
178
|
|
|
179
179
|
def get_magnitude_spectrum_db(self, audio: np.ndarray, sr: int, n_fft: int) -> Tuple[np.ndarray, np.ndarray]:
|
|
180
|
-
"""
|
|
180
|
+
"""获取音频的幅度谱(dB)"""
|
|
181
181
|
f_spec, t_spec, Sxx_spec = signal.spectrogram(
|
|
182
182
|
audio, fs=sr, nperseg=n_fft, noverlap=n_fft // 4,
|
|
183
183
|
scaling='spectrum', mode='magnitude'
|
|
@@ -204,7 +204,7 @@ def evaluate_individual(individual_chromosome):
|
|
|
204
204
|
|
|
205
205
|
# 调整复杂度惩罚项的计算方式, 使其与误差的量级更相关
|
|
206
206
|
# 例如, 如果误差本身就很大, 那么滤波器的数量惩罚可以相对小一些
|
|
207
|
-
# 或者, 如果目标EQ
|
|
207
|
+
# 或者, 如果目标EQ形状本身就很复杂(变化剧烈), 那么多用几个滤波器也是合理的
|
|
208
208
|
# penalty_scale = 1 + np.mean(np.abs(target_eq_shape_db_global)) # 基于目标EQ形状的平均绝对值
|
|
209
209
|
penalty_scale = np.sum(target_eq_shape_db_global**2) / len(target_eq_shape_db_global) if len(target_eq_shape_db_global) > 0 else 1.0
|
|
210
210
|
if penalty_scale < 1e-3:
|
neverlib/filter/biquad.py
CHANGED
neverlib/filter/core.py
CHANGED
|
@@ -322,9 +322,8 @@ def EQ_test():
|
|
|
322
322
|
from scipy import signal
|
|
323
323
|
|
|
324
324
|
fs = 16000
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
b, a = PeakingFilter(1500, 5, Q=0.5)
|
|
325
|
+
eq = EQFilter(fs)
|
|
326
|
+
b, a = eq.LowshelfFilter(4000, 6, Q=0.7)
|
|
328
327
|
print(b)
|
|
329
328
|
print(a)
|
|
330
329
|
|
|
@@ -335,5 +334,9 @@ def EQ_test():
|
|
|
335
334
|
plt.ylabel('Amplitude [dB]')
|
|
336
335
|
plt.grid(which='both', axis='both') # 显示网格
|
|
337
336
|
# 画红色的垂直线, 标记截止频率
|
|
338
|
-
plt.xscale('log') # x轴对数化
|
|
339
|
-
plt.
|
|
337
|
+
# plt.xscale('log') # x轴对数化
|
|
338
|
+
plt.savefig('./lowshelf_freq_response.png')
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
if __name__ == "__main__":
|
|
342
|
+
EQ_test()
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
https://github.com/ftshijt/speech_evaluation?tab=readme-ov-file
|
|
2
|
+
https://github.com/Amir-Ivry/MAPSS-measures
|
|
3
|
+
https://github.com/espnet/espnet/blob/f517b63fe5defb865e2067b11c2dfc516150868d/utils/eval-source-separation.py#L361
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
F0 Correlation
|
|
10
|
+
|
|
11
|
+
F0 Root Mean Square Error
|
|
12
|
+
sdr
|
|
13
|
+
isr
|
|
14
|
+
sir
|
|
15
|
+
sar
|
|
16
|
+
perm
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Convolutional scale-invariant signal-to-distortion ratio (CI-SDR) [x]
|
|
20
|
+
Scale-invariant signal-to-noise ratio (SI-SNR) [x]
|
|
21
|
+
Speech BERT Score
|
|
22
|
+
Discrete Speech BLEU Score [x]
|
|
23
|
+
Discrete Speech Token Edit Distance
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
STOI
|
|
29
|
+
ESTOI
|
|
30
|
+
PESQ
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
音频特征:
|
|
34
|
+
https://github.com/libAudioFlux/audioFlux
|
|
35
|
+
https://github.com/csteinmetz1/pyloudnorm
|
neverlib/metrics/__init__.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
from typing import TYPE_CHECKING, Any
|
|
5
5
|
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
|
-
#
|
|
7
|
+
# 仅在类型检查时导入, 提供IDE补全支持
|
|
8
8
|
from .dnsmos import ComputeScore
|
|
9
9
|
from .lpc_lsp import framing, lpc_lsp_distance, lpc_to_lsp
|
|
10
10
|
from .snr import get_snr, get_snr_from_noisy, psnr, seg_snr, si_sdr
|
|
@@ -56,4 +56,4 @@ if TYPE_CHECKING:
|
|
|
56
56
|
'mean_rms_amplitude',
|
|
57
57
|
'peak_amplitude',
|
|
58
58
|
'rms_amplitude',
|
|
59
|
-
]
|
|
59
|
+
]
|
neverlib/metrics/dnsmos.py
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Author: 凌逆战 | Never
|
|
3
3
|
Date: 2025-08-06 10:00:00
|
|
4
4
|
Description:
|
|
5
|
-
要计算个性化 MOS
|
|
6
|
-
要计算常规 MOS
|
|
5
|
+
要计算个性化 MOS 分数(干扰说话者受到惩罚), 请提供“-p”参数, 例如:python dnsmos.py -t ./SampleClips -o sample.csv -p
|
|
6
|
+
要计算常规 MOS 分数, 请省略“-p”参数. 例如:python dnsmos.py -t ./SampleClips -o sample.csv
|
|
7
7
|
'''
|
|
8
8
|
import librosa
|
|
9
9
|
import numpy as np
|
neverlib/metrics/lpc_lsp.py
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
主要组件
|
|
8
8
|
|
|
9
9
|
预处理函数:
|
|
10
|
-
- pre_emphasis():
|
|
10
|
+
- pre_emphasis(): 预加重滤波, 增强高频成分
|
|
11
11
|
- framing(): 分帧处理并应用汉明窗
|
|
12
12
|
|
|
13
13
|
LPC分析:
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
距离计算:
|
|
18
18
|
- lsp_mse(): 计算LSP向量间的均方误差
|
|
19
|
-
- lpc_lsp_distance():
|
|
19
|
+
- lpc_lsp_distance(): 主函数, 返回平均失真度和逐帧失真列表
|
|
20
20
|
|
|
21
21
|
技术特点
|
|
22
22
|
|
|
23
|
-
- 使用soundfile
|
|
24
|
-
- librosa进行LPC
|
|
25
|
-
- 基于LSP
|
|
23
|
+
- 使用soundfile读取音频(支持多种格式)
|
|
24
|
+
- librosa进行LPC分析(替代了自定义算法)
|
|
25
|
+
- 基于LSP的频域失真测量, 对量化误差敏感度更低
|
|
26
26
|
- 逐帧分析捕捉语音时变特性
|
|
27
27
|
|
|
28
28
|
应用场景
|
|
@@ -52,7 +52,7 @@ def framing(signal, frame_size, frame_stride, fs):
|
|
|
52
52
|
|
|
53
53
|
def lpc_to_lsp(a, num_points=512):
|
|
54
54
|
"""
|
|
55
|
-
LPC -> LSP
|
|
55
|
+
LPC -> LSP 转换(简易近似版, 零点搜索法)
|
|
56
56
|
"""
|
|
57
57
|
p = len(a) - 1
|
|
58
58
|
a = np.array(a)
|
|
@@ -91,7 +91,7 @@ def lpc_lsp_distance(ref_wav, test_wav, frame_size=0.025, frame_stride=0.01, ord
|
|
|
91
91
|
ref_frames = framing(ref_sig, frame_size, frame_stride, fs_r)
|
|
92
92
|
test_frames = framing(test_sig, frame_size, frame_stride, fs_t)
|
|
93
93
|
|
|
94
|
-
#
|
|
94
|
+
# 对齐帧数(简单切到最短)
|
|
95
95
|
num_frames = min(len(ref_frames), len(test_frames))
|
|
96
96
|
ref_frames = ref_frames[:num_frames]
|
|
97
97
|
test_frames = test_frames[:num_frames]
|
|
@@ -102,7 +102,7 @@ def lpc_lsp_distance(ref_wav, test_wav, frame_size=0.025, frame_stride=0.01, ord
|
|
|
102
102
|
a_test = librosa.lpc(test_frames[i], order=order)
|
|
103
103
|
lsp_ref = lpc_to_lsp(a_ref)
|
|
104
104
|
lsp_test = lpc_to_lsp(a_test)
|
|
105
|
-
#
|
|
105
|
+
# 对齐长度(简单裁切)
|
|
106
106
|
min_len = min(len(lsp_ref), len(lsp_test))
|
|
107
107
|
# 计算两个 LSP 向量的均方差
|
|
108
108
|
dist = np.mean((lsp_ref[:min_len] - lsp_test[:min_len]) ** 2)
|
neverlib/metrics/pesq_c/PESQ
CHANGED
|
File without changes
|
neverlib/metrics/snr.py
CHANGED
|
@@ -129,15 +129,15 @@ def psnr(clean, noisy, max_val=None):
|
|
|
129
129
|
|
|
130
130
|
def si_sdr(reference, estimate, epsilon=1e-8):
|
|
131
131
|
"""
|
|
132
|
-
计算尺度不变信噪比 (Scale-Invariant Signal-to-Distortion Ratio, SI-SDR)
|
|
132
|
+
计算尺度不变信噪比 (Scale-Invariant Signal-to-Distortion Ratio, SI-SDR).
|
|
133
133
|
|
|
134
134
|
Args:
|
|
135
|
-
reference (np.ndarray): 原始的、干净的参考信号 (一维数组)
|
|
136
|
-
estimate (np.ndarray): 模型估计或处理后的信号 (一维数组)
|
|
137
|
-
epsilon (float): 一个非常小的数值, 用于防止分母为零,
|
|
135
|
+
reference (np.ndarray): 原始的、干净的参考信号 (一维数组).
|
|
136
|
+
estimate (np.ndarray): 模型估计或处理后的信号 (一维数组).
|
|
137
|
+
epsilon (float): 一个非常小的数值, 用于防止分母为零, 保证数值稳定性.
|
|
138
138
|
|
|
139
139
|
Returns:
|
|
140
|
-
float: SI-SDR 值, 单位为分贝 (dB)
|
|
140
|
+
float: SI-SDR 值, 单位为分贝 (dB).
|
|
141
141
|
"""
|
|
142
142
|
assert reference.shape == estimate.shape, "reference和estimate的维度不一样"
|
|
143
143
|
|
neverlib/metrics/spec.py
CHANGED
|
@@ -9,7 +9,7 @@ Description: 音频信号频域客观度量指标计算工具
|
|
|
9
9
|
|
|
10
10
|
2. LSD (Log-Spectral Distance) - 对数谱距离
|
|
11
11
|
- 在对数功率谱域计算信号距离
|
|
12
|
-
-
|
|
12
|
+
- 更符合人耳听觉特性, 常用于语音质量评估
|
|
13
13
|
|
|
14
14
|
3. MCD (Mel-Cepstral Distance) - 梅尔倒谱距离
|
|
15
15
|
- 基于MFCC特征的音频相似性度量
|
|
@@ -24,16 +24,16 @@ from neverlib.utils import EPS
|
|
|
24
24
|
|
|
25
25
|
def sd(ref_wav, test_wav, n_fft=2048, hop_length=512, win_length=None):
|
|
26
26
|
"""
|
|
27
|
-
计算两个音频信号之间的频谱距离 (Spectral Distance)
|
|
28
|
-
|
|
27
|
+
计算两个音频信号之间的频谱距离 (Spectral Distance).
|
|
28
|
+
该指标衡量两个信号在频域上的差异程度.
|
|
29
29
|
Args:
|
|
30
30
|
ref_wav (np.ndarray): 参考音频信号 (一维数组)
|
|
31
31
|
test_wav (np.ndarray): 测试音频信号 (一维数组)
|
|
32
|
-
n_fft (int): FFT
|
|
33
|
-
hop_length (int):
|
|
34
|
-
win_length (int, optional):
|
|
32
|
+
n_fft (int): FFT点数, 决定频率分辨率, 默认为2048
|
|
33
|
+
hop_length (int): 帧移, 决定时间分辨率, 默认为512
|
|
34
|
+
win_length (int, optional): 窗长, 如果为None则默认为n_fft
|
|
35
35
|
Returns:
|
|
36
|
-
float:
|
|
36
|
+
float: 频谱距离值, 值越小表示两个信号越相似
|
|
37
37
|
"""
|
|
38
38
|
assert len(ref_wav) == len(test_wav), "输入信号长度必须相同"
|
|
39
39
|
|
|
@@ -58,21 +58,21 @@ def sd(ref_wav, test_wav, n_fft=2048, hop_length=512, win_length=None):
|
|
|
58
58
|
|
|
59
59
|
def lsd(ref_wav, test_wav, n_fft=2048, hop_length=512, win_length=None):
|
|
60
60
|
"""
|
|
61
|
-
计算两个一维音频信号之间的对数谱距离 (Log-Spectral Distance, LSD)
|
|
62
|
-
该实现遵循标准的LSD定义:
|
|
61
|
+
计算两个一维音频信号之间的对数谱距离 (Log-Spectral Distance, LSD).
|
|
62
|
+
该实现遵循标准的LSD定义: 整体均方根误差.
|
|
63
63
|
|
|
64
64
|
Args:
|
|
65
|
-
ref_wav (np.ndarray): 原始的、干净的参考信号 (一维数组)
|
|
66
|
-
test_wav (np.ndarray): 模型估计或处理后的信号 (一维数组)
|
|
67
|
-
n_fft (int): FFT点数,
|
|
68
|
-
hop_length (int): 帧移,
|
|
69
|
-
win_length (int, optional):
|
|
70
|
-
epsilon (float): 一个非常小的数值, 用于防止对零取对数,
|
|
65
|
+
ref_wav (np.ndarray): 原始的、干净的参考信号 (一维数组).
|
|
66
|
+
test_wav (np.ndarray): 模型估计或处理后的信号 (一维数组).
|
|
67
|
+
n_fft (int): FFT点数, 决定了频率分辨率.
|
|
68
|
+
hop_length (int): 帧移, 决定了时间分辨率.
|
|
69
|
+
win_length (int, optional): 窗长. 如果为None, 则默认为n_fft.
|
|
70
|
+
epsilon (float): 一个非常小的数值, 用于防止对零取对数, 保证数值稳定性.
|
|
71
71
|
|
|
72
72
|
Returns:
|
|
73
|
-
float: 对数谱距离值, 单位为分贝 (dB)
|
|
73
|
+
float: 对数谱距离值, 单位为分贝 (dB).
|
|
74
74
|
"""
|
|
75
|
-
assert ref_wav.ndim == 1 and test_wav.ndim == 1, "
|
|
75
|
+
assert ref_wav.ndim == 1 and test_wav.ndim == 1, "输入信号必须是一维数组. "
|
|
76
76
|
|
|
77
77
|
if win_length is None:
|
|
78
78
|
win_length = n_fft
|
|
@@ -100,17 +100,17 @@ def lsd(ref_wav, test_wav, n_fft=2048, hop_length=512, win_length=None):
|
|
|
100
100
|
|
|
101
101
|
def mcd(ref_wav, test_wav, sr=16000, n_mfcc=13):
|
|
102
102
|
"""
|
|
103
|
-
计算两个音频信号之间的梅尔倒谱距离 (Mel-Cepstral Distance, MCD)
|
|
104
|
-
|
|
103
|
+
计算两个音频信号之间的梅尔倒谱距离 (Mel-Cepstral Distance, MCD).
|
|
104
|
+
该指标常用于语音合成质量评估, 值越小表示两个信号越相似.
|
|
105
105
|
|
|
106
106
|
Args:
|
|
107
107
|
ref_wav (np.ndarray): 参考音频信号 (一维数组)
|
|
108
108
|
test_wav (np.ndarray): 测试音频信号 (一维数组)
|
|
109
|
-
sr (int):
|
|
110
|
-
n_mfcc (int): MFCC
|
|
109
|
+
sr (int): 采样率, 默认为16000Hz
|
|
110
|
+
n_mfcc (int): MFCC系数个数, 默认为13
|
|
111
111
|
|
|
112
112
|
Returns:
|
|
113
|
-
float:
|
|
113
|
+
float: 梅尔倒谱距离值, 值越小表示两个信号越相似
|
|
114
114
|
|
|
115
115
|
"""
|
|
116
116
|
assert len(ref_wav) == len(test_wav), "输入信号长度必须相同"
|
|
@@ -119,7 +119,7 @@ def mcd(ref_wav, test_wav, sr=16000, n_mfcc=13):
|
|
|
119
119
|
ref_mfcc = librosa.feature.mfcc(y=ref_wav, sr=sr, n_mfcc=n_mfcc)
|
|
120
120
|
test_mfcc = librosa.feature.mfcc(y=test_wav, sr=sr, n_mfcc=n_mfcc)
|
|
121
121
|
|
|
122
|
-
# 计算MCD (跳过0
|
|
122
|
+
# 计算MCD (跳过0阶系数, 因为0阶主要表示能量)
|
|
123
123
|
diff = ref_mfcc[1:] - test_mfcc[1:]
|
|
124
124
|
mcd_value = (10.0 / np.log(10)) * np.sqrt(
|
|
125
125
|
2 * np.mean(np.sum(diff**2, axis=0)))
|
neverlib/metrics/test_pesq.py
CHANGED
|
@@ -3,7 +3,7 @@ Author: 凌逆战 | Never
|
|
|
3
3
|
Date: 2025-08-05 23:37:31
|
|
4
4
|
Description:
|
|
5
5
|
|
|
6
|
-
PESQ 包含 3 种类型的值:NB PESQ MOS、NB MOS LQO、WB MOS LQO
|
|
6
|
+
PESQ 包含 3 种类型的值:NB PESQ MOS、NB MOS LQO、WB MOS LQO. 此包仅返回NB PESQ MOS代表 的Raw MOS分数narrowband handset listening.
|
|
7
7
|
'''
|
|
8
8
|
import pesq
|
|
9
9
|
import pypesq
|
|
@@ -21,11 +21,11 @@ print(pypesq.pesq(clean, enhance, fs=fs)) # 3.817176103591919
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def pesq2mos(pesq):
|
|
24
|
-
""" 将PESQ值[-0.5, 4.5]映射到MOS-LQO得分[1, 4.5]
|
|
24
|
+
""" 将PESQ值[-0.5, 4.5]映射到MOS-LQO得分[1, 4.5]上, 映射函数来源于:P.862.1 """
|
|
25
25
|
return 0.999 + (4.999 - 0.999) / (1 + np.exp(-1.4945 * pesq + 4.6607))
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def mos2pesq(mos):
|
|
29
|
-
""" 将MOS-LQO得分[1, 4.5]映射到PESQ值[-0.5, 4.5]
|
|
29
|
+
""" 将MOS-LQO得分[1, 4.5]映射到PESQ值[-0.5, 4.5]上, 映射函数来源于:P.862.1"""
|
|
30
30
|
inlog = (4.999 - mos) / (mos - 0.999)
|
|
31
31
|
return (4.6607 - np.log(inlog)) / 1.4945
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# -*- coding:utf-8 -*-
|
|
2
|
+
# Author:凌逆战 | Never
|
|
3
|
+
# Date: 2024/6/14
|
|
4
|
+
"""
|
|
5
|
+
babble噪声生成
|
|
6
|
+
"""
|
|
7
|
+
import os
|
|
8
|
+
import torch
|
|
9
|
+
import random
|
|
10
|
+
import numpy as np
|
|
11
|
+
import soundfile as sf
|
|
12
|
+
import pickle
|
|
13
|
+
|
|
14
|
+
from neverlib.utils import get_path_list
|
|
15
|
+
from vad import EnergyVAD
|
|
16
|
+
from utils.audio_aug import volume_aug, add_reverb
|
|
17
|
+
from joblib import Parallel, delayed
|
|
18
|
+
from multiprocessing import Pool
|
|
19
|
+
|
|
20
|
+
vad = EnergyVAD(
|
|
21
|
+
sample_rate=16000,
|
|
22
|
+
frame_length=25, # in milliseconds
|
|
23
|
+
frame_shift=20, # in milliseconds
|
|
24
|
+
energy_threshold=0.05, # you may need to adjust this value
|
|
25
|
+
pre_emphasis=0.95,
|
|
26
|
+
) # default values are used here
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def get_one_babble(speech_path_list, rir_path_list):
|
|
30
|
+
sub_len = 0
|
|
31
|
+
sub_list = []
|
|
32
|
+
while sub_len < sentence_len:
|
|
33
|
+
speech_path = random.choice(speech_path_list)
|
|
34
|
+
rir_path = random.choice(rir_path_list)
|
|
35
|
+
# 加rir
|
|
36
|
+
with open(rir_path, 'rb') as f:
|
|
37
|
+
# arrayCoor (2,3) (num_mic, 3(x,y,z))
|
|
38
|
+
# sPos (4,3) (num_source, 3(x,y,z))
|
|
39
|
+
[arrayCoor, sPos, sAziPth, rir, L, rt, c, mtype, n, fs] = pickle.load(f)
|
|
40
|
+
rir = np.array(rir) # (souece, mic, T) (4, 3, 2668)
|
|
41
|
+
rir_idx = np.random.randint(0, rir.shape[0]) # 随机选择一个source
|
|
42
|
+
sPos = sPos[rir_idx] # (3,) (x,y,z)
|
|
43
|
+
DistMic2Source_1 = np.sqrt(np.sum((arrayCoor[0] - sPos) ** 2))
|
|
44
|
+
DistMic2Source_2 = np.sqrt(np.sum((arrayCoor[1] - sPos) ** 2))
|
|
45
|
+
if DistMic2Source_1 < 2 or DistMic2Source_2 < 2:
|
|
46
|
+
continue
|
|
47
|
+
rir = rir[rir_idx]
|
|
48
|
+
|
|
49
|
+
wav, _ = sf.read(speech_path, dtype='float32', always_2d=True)
|
|
50
|
+
assert wav.shape[-1] == 1, f"音频应该为单通道"
|
|
51
|
+
if len(wav) > sentence_len:
|
|
52
|
+
idx = random.randint(0, len(wav) - sentence_len)
|
|
53
|
+
wav = wav[idx:idx + sentence_len]
|
|
54
|
+
|
|
55
|
+
wav = wav / np.abs(wav).max() # 归一化
|
|
56
|
+
wav = vad.apply_vad(wav.T).T
|
|
57
|
+
|
|
58
|
+
wav = add_reverb(wav, rir, add_rir_ratio=1) # 双麦wav
|
|
59
|
+
# 音量增强
|
|
60
|
+
rms = np.sqrt(np.mean(wav ** 2))
|
|
61
|
+
wav *= random.uniform(0.5, 1.0) / rms
|
|
62
|
+
|
|
63
|
+
sub_len += len(wav)
|
|
64
|
+
sub_list.append(wav)
|
|
65
|
+
|
|
66
|
+
sub_babble = np.concatenate(sub_list, axis=0)
|
|
67
|
+
if sub_len >= sentence_len:
|
|
68
|
+
sub_babble = sub_babble[:sentence_len]
|
|
69
|
+
return sub_babble
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def babble_noise_generate(i, speech_path_list, rir_path_list):
|
|
73
|
+
source_num = random.randint(15, 25)
|
|
74
|
+
babble_noise = np.zeros((sentence_len, 2))
|
|
75
|
+
for _ in range(source_num):
|
|
76
|
+
sub_babble = get_one_babble(speech_path_list, rir_path_list)
|
|
77
|
+
babble_noise += sub_babble
|
|
78
|
+
|
|
79
|
+
babble_path = os.path.join(target_dir, f"babble_noise_{i}.wav")
|
|
80
|
+
print(babble_path)
|
|
81
|
+
babble_noise = babble_noise / np.max(np.abs(babble_noise)) * 0.5
|
|
82
|
+
sf.write(babble_path, babble_noise, sr)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if __name__ == "__main__":
|
|
86
|
+
speech_dir = "/data/never/kws_data/BigDataset/speech"
|
|
87
|
+
rir_dir = "/data/never/RIR/2mic_Line_r50mm_fs16k_4source_t60mix08_maxdist8m_2w"
|
|
88
|
+
target_dir = "/data/never/SE_dataset/babble_noise10"
|
|
89
|
+
# if os.path.exists(target_dir):
|
|
90
|
+
# os.system(f"rm -rf {target_dir}")
|
|
91
|
+
# os.makedirs(target_dir, exist_ok=True)
|
|
92
|
+
# else:
|
|
93
|
+
# os.makedirs(target_dir, exist_ok=True)
|
|
94
|
+
speech_path_list = get_path_list(speech_dir, "*.wav")
|
|
95
|
+
rir_path_list = get_path_list(rir_dir, "*.rir")
|
|
96
|
+
|
|
97
|
+
sentence_num = 20000
|
|
98
|
+
sr = 16000
|
|
99
|
+
volume_range = [0.5, 1.0]
|
|
100
|
+
sentence_len = sr * 10
|
|
101
|
+
# for i in range(10):
|
|
102
|
+
# babble_noise_generate(i, speech_path_list, rir_path_list)
|
|
103
|
+
|
|
104
|
+
# 多核并行处理
|
|
105
|
+
# Parallel(n_jobs=-1)(delayed(babble_noise_generate)(i, speech_path_list, rir_path_list) for i in range(sentence_num))
|
|
106
|
+
|
|
107
|
+
pool = Pool(32) # 创建进程池, 一定要放在 事件函数之后, 不然会保错
|
|
108
|
+
|
|
109
|
+
for i in range(sentence_num):
|
|
110
|
+
r = pool.apply_async(func=babble_noise_generate, args=(i, speech_path_list, rir_path_list,))
|
|
111
|
+
|
|
112
|
+
pool.close() # 关闭进程池
|
|
113
|
+
pool.join() # 回收进程池
|