Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
  • Loading branch information
CjangCjengh authored Aug 23, 2022
1 parent a4a33fb commit b31b7ea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from json import loads
from torch import load
import logging
import l


class HParams():
Expand Down Expand Up @@ -67,3 +67,8 @@ def get_hparams_from_file(config_path):

hparams = HParams(**config)
return hparams


def load_audio_to_torch(full_path, target_sampling_rate):
audio, sampling_rate = librosa.load(full_path, sr=target_sampling_rate, mono=True)
return torch.FloatTensor(audio.astype(np.float32))

0 comments on commit b31b7ea

Please sign in to comment.