    def __init__(self, cfg, dataset, is_valid=False):
        """
        Args:
            cfg: config
            dataset: dataset name
            is_valid: whether to use train or valid dataset
        """
        self.data_root_dir = cfg.dataset
        self.data_list = []
        # walk through the dataset directory recursively, save all files ends with .wav/.mp3/.opus/.flac/.m4a
        for root, _, files in os.walk(self.data_root_dir):
            for file in files:
                if file.endswith((".wav", ".mp3", ".opus", ".flac", ".m4a")):
                    self.data_list.append(os.path.join(root, file))
        self.sr = cfg.preprocess_params.sr
        self.duration_range = cfg.preprocess_params.duration_range
        self.to_mel = torchaudio.transforms.MelSpectrogram(
            n_mels=cfg.preprocess_params.spect_params.n_mels,
            n_fft=cfg.preprocess_params.spect_params.n_fft,
            win_length=cfg.preprocess_params.spect_params.win_length,
            hop_length=cfg.preprocess_params.spect_params.hop_length,
        )
        self.mean, self.std = -4, 4
Args:
cfg: config
dataset: dataset name
is_valid: whether to use train or valid dataset
models/codec/facodec/facodec_dataset.py