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 @@ -1631,6 +1631,7 @@ def loudness(waveform: Tensor, sample_rate: int):
16311631 gate_duration = 0.4
16321632 overlap = 0.75
16331633 gamma_abs = - 70.0
1634+ kweight_bias = - 0.691
16341635 gate_samples = int (round (gate_duration * sample_rate ))
16351636 step = int (round (gate_samples * (1 - overlap )))
16361637
@@ -1655,15 +1656,15 @@ def loudness(waveform: Tensor, sample_rate: int):
16551656
16561657 energy_filtered = torch .sum (gated_blocks * energy , dim = - 1 ) / torch .count_nonzero (gated_blocks , dim = - 1 )
16571658 energy_weighted = torch .sum (g * energy_filtered , dim = - 1 )
1658- gamma_rel = - 0.691 + 10 * torch .log10 (energy_weighted ) - 10
1659+ gamma_rel = kweight_bias + 10 * torch .log10 (energy_weighted ) - 10
16591660
16601661 # Apply relative gating of the blocks
16611662 gated_blocks = torch .logical_and (gated_blocks .squeeze (- 2 ), loudness > gamma_rel .unsqueeze (- 1 ))
16621663 gated_blocks = gated_blocks .unsqueeze (- 2 )
16631664
16641665 energy_filtered = torch .sum (gated_blocks * energy , dim = - 1 ) / torch .count_nonzero (gated_blocks , dim = - 1 )
16651666 energy_weighted = torch .sum (g * energy_filtered , dim = - 1 )
1666- LKFS = - 0.691 + 10 * torch .log10 (energy_weighted )
1667+ LKFS = kweight_bias + 10 * torch .log10 (energy_weighted )
16671668 return LKFS
16681669
16691670
You can’t perform that action at this time.
0 commit comments