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])
| 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 |
no test coverage detected