Spaces:
Running
Running
File size: 620 Bytes
d7013e6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from abc import ABC, abstractmethod
from typing import Any
import torch
class IAudioProcessor(ABC):
"""Interface for audio feature extraction."""
@abstractmethod
def load(self, path: str) -> torch.Tensor:
"""Load raw audio from file. Returns waveform tensor."""
...
@abstractmethod
def extract_features(self, waveform: torch.Tensor) -> torch.Tensor:
"""Extract features (e.g. mel spectrogram) from waveform."""
...
@abstractmethod
def normalize(self, features: torch.Tensor) -> torch.Tensor:
"""Normalize features for model input."""
...
|