MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / librosa_pad_lr

Function librosa_pad_lr

utils/audio.py:38–47  ·  view source on GitHub ↗

compute right padding (final frame) or both sides padding (first and final frames)

(x, fsize, fshift, pad_sides=1)

Source from the content-addressed store, hash-verified

36
37
38def librosa_pad_lr(x, fsize, fshift, pad_sides=1):
39 '''compute right padding (final frame) or both sides padding (first and final frames)
40 '''
41 assert pad_sides in (1, 2)
42 # return int(fsize // 2)
43 pad = (x.shape[0] // fshift + 1) * fshift - x.shape[0]
44 if pad_sides == 1:
45 return 0, pad
46 else:
47 return pad // 2, pad // 2 + pad % 2
48
49
50# Conversions

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected