decipher.autoencoder

Convolutional autoencoder embedder (Best et al. 2023 architecture): 128-bin log-mel frontend, 5-layer strided CNN encoder, 256-dim bottleneck, optional decoder for spectrogram reconstruction.

class decipher.autoencoder.AutoencoderEmbedder
class AutoencoderEmbedder:
    def __init__(
        self,
        weights_path: Path | str,
        sr: int = 22050,
        clip_seconds: float = 2.0,
        bottleneck_dim: int = 256,
        device: str = "cpu",
    )

    def embed_clip(self, clip: np.ndarray) -> np.ndarray
        # → (bottleneck_dim,)

    def embed_clips(
        self,
        clips: list[np.ndarray],
        batch_size: int = 32,
    ) -> np.ndarray
        # → (n_clips, bottleneck_dim)

    def reconstruct_mel(
        self,
        embeddings: np.ndarray,
        batch_size: int = 32,
    ) -> np.ndarray
        # → (n_clips, n_mels, n_time)

The decoder is optional — call reconstruct_mel only if the loaded checkpoint contains decoder weights.

Each clip is internally resampled to sr and center-padded/cropped to clip_seconds.