alibabasglab commited on
Commit
c932300
1 Parent(s): 06931e3

Update speechscore.py

Browse files
Files changed (1) hide show
  1. speechscore.py +5 -3
speechscore.py CHANGED
@@ -53,17 +53,19 @@ class ScoresList:
53
  score_rate:
54
  the sampling rate specified for scoring the files.
55
  """
 
 
56
  if test_path is None:
57
  print(f'Please provide audio path for test_path')
58
  return
59
  results = {}
60
  if isinstance(test_path, tuple):
61
  sr, audio = test_path
62
- if sr != 16000:
63
- audio = resampy.resample(audio, sr, 16000, axis=0)
64
  data = {}
65
  data['audio'] = [audio]
66
- data['rate'] = 16000
67
 
68
  for score in self.scores:
69
  result_score = score.scoring(data, window, score_rate)
 
53
  score_rate:
54
  the sampling rate specified for scoring the files.
55
  """
56
+ if score_rate is None:
57
+ score_rate = 16000
58
  if test_path is None:
59
  print(f'Please provide audio path for test_path')
60
  return
61
  results = {}
62
  if isinstance(test_path, tuple):
63
  sr, audio = test_path
64
+ if sr != score_rate:
65
+ audio = resampy.resample(audio, sr, score_rate, axis=0)
66
  data = {}
67
  data['audio'] = [audio]
68
+ data['rate'] = score_rate
69
 
70
  for score in self.scores:
71
  result_score = score.scoring(data, window, score_rate)