| 26 | dac_version: str |
| 27 | |
| 28 | def save(self, path): |
| 29 | artifacts = { |
| 30 | "codes": self.codes.numpy().astype(np.uint16), |
| 31 | "metadata": { |
| 32 | "input_db": self.input_db.numpy().astype(np.float32), |
| 33 | "original_length": self.original_length, |
| 34 | "sample_rate": self.sample_rate, |
| 35 | "chunk_length": self.chunk_length, |
| 36 | "channels": self.channels, |
| 37 | "padding": self.padding, |
| 38 | "dac_version": SUPPORTED_VERSIONS[-1], |
| 39 | }, |
| 40 | } |
| 41 | path = Path(path).with_suffix(".dac") |
| 42 | with open(path, "wb") as f: |
| 43 | np.save(f, artifacts) |
| 44 | return path |
| 45 | |
| 46 | @classmethod |
| 47 | def load(cls, path): |