File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1629,6 +1629,7 @@ def loudness(waveform: Tensor, sample_rate: int):
16291629 gate_duration = 0.4
16301630 overlap = 0.75
16311631 gamma_abs = - 70.0
1632+ kweight_bias = - 0.691
16321633 gate_samples = int (round (gate_duration * sample_rate ))
16331634 step = int (round (gate_samples * (1 - overlap )))
16341635
@@ -1653,15 +1654,15 @@ def loudness(waveform: Tensor, sample_rate: int):
16531654
16541655 energy_filtered = torch .sum (gated_blocks * energy , dim = - 1 ) / torch .count_nonzero (gated_blocks , dim = - 1 )
16551656 energy_weighted = torch .sum (g * energy_filtered , dim = - 1 )
1656- gamma_rel = - 0.691 + 10 * torch .log10 (energy_weighted ) - 10
1657+ gamma_rel = kweight_bias + 10 * torch .log10 (energy_weighted ) - 10
16571658
16581659 # Apply relative gating of the blocks
16591660 gated_blocks = torch .logical_and (gated_blocks .squeeze (- 2 ), loudness > gamma_rel .unsqueeze (- 1 ))
16601661 gated_blocks = gated_blocks .unsqueeze (- 2 )
16611662
16621663 energy_filtered = torch .sum (gated_blocks * energy , dim = - 1 ) / torch .count_nonzero (gated_blocks , dim = - 1 )
16631664 energy_weighted = torch .sum (g * energy_filtered , dim = - 1 )
1664- LKFS = - 0.691 + 10 * torch .log10 (energy_weighted )
1665+ LKFS = kweight_bias + 10 * torch .log10 (energy_weighted )
16651666 return LKFS
16661667
16671668
You can’t perform that action at this time.
0 commit comments