pad_zero

ketos.audio.utils.misc.pad_zero(x, pad_left=0, pad_right=0)[source]

Pad array with zeros along the first axis (0).

Args:
x: numpy.array

The data to be padded.

pad_left: int

Amount of padding on the left

pad_right: int

Amount of padding on the right

Returns:
x_padded: numpy.array

Padded array

Example:
>>> from ketos.audio.utils.misc import pad_zero
>>> arr = np.arange(9) #create a simple array
>>> print(arr)
[0 1 2 3 4 5 6 7 8]
>>> arr = pad_zero(arr, pad_right=3) #pad on the right
>>> print(arr)
[0 1 2 3 4 5 6 7 8 0 0 0]