MCPcopy
hub / github.com/facebookresearch/encodec / decode

Method decode

encodec/model.py:167–178  ·  view source on GitHub ↗

Decode the given frames into a waveform. Note that the output might be a bit bigger than the input. In that case, any extra steps at the end can be trimmed.

(self, encoded_frames: tp.List[EncodedFrame])

Source from the content-addressed store, hash-verified

165 return codes, scale
166
167 def decode(self, encoded_frames: tp.List[EncodedFrame]) -> torch.Tensor:
168 """Decode the given frames into a waveform.
169 Note that the output might be a bit bigger than the input. In that case,
170 any extra steps at the end can be trimmed.
171 """
172 segment_length = self.segment_length
173 if segment_length is None:
174 assert len(encoded_frames) == 1
175 return self._decode_frame(encoded_frames[0])
176
177 frames = [self._decode_frame(frame) for frame in encoded_frames]
178 return _linear_overlap_add(frames, self.segment_stride or 1)
179
180 def _decode_frame(self, encoded_frame: EncodedFrame) -> torch.Tensor:
181 codes, scale = encoded_frame

Callers 5

forwardMethod · 0.95
mainFunction · 0.45
decompress_from_fileFunction · 0.45
read_ecdc_headerFunction · 0.45
_decode_frameMethod · 0.45

Calls 2

_decode_frameMethod · 0.95
_linear_overlap_addFunction · 0.85

Tested by

no test coverage detected