MCPcopy Create free account
hub / github.com/dmlc/decord / add_padding

Method add_padding

python/decord/audio_reader.py:144–155  ·  view source on GitHub ↗

Pad the audio samples so that it starts at time 0. Returns ------- int Number of samples padded

(self)

Source from the content-addressed store, hash-verified

142 return self._num_padding
143
144 def add_padding(self):
145 """Pad the audio samples so that it starts at time 0.
146
147 Returns
148 -------
149 int
150 Number of samples padded
151
152 """
153 self._array = np.pad(self._array, ((0, 0), (self.__get_num_padding(), 0)), 'constant', constant_values=0)
154 self._duration += self.__get_num_padding() * self.sample_rate
155 return self.__get_num_padding()
156
157 def get_info(self):
158 """Log out the basic info about the audio stream."""

Callers 2

__init__Method · 0.80
test_add_paddingFunction · 0.80

Calls 1

__get_num_paddingMethod · 0.95

Tested by 1

test_add_paddingFunction · 0.64