Skip to content

Commit

Permalink
Fixed samplerate of read audio file
Browse files Browse the repository at this point in the history
  • Loading branch information
louiskirsch committed May 18, 2017
1 parent 449a3af commit db61338
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion speecht/preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _extract_audio_id(cls, audio_file):

@classmethod
def _transform_sample(cls, audio_file, preprocess_fnc):
audio_data, samplerate = librosa.load(audio_file)
audio_data, samplerate = librosa.load(audio_file, sr=None)
audio_fragments = preprocess_fnc(audio_data, samplerate)
audio_id = cls._extract_audio_id(audio_file)

Expand Down
4 changes: 2 additions & 2 deletions speecht/tests/test_speechCorpusReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class TestSpeechCorpusReader(TestCase):

BASE_DIR = 'tests/data/'
BASE_DIR = 'speecht/tests/data/'
TEST_FILES_DIR = 'train'
PREPROCESS_DIR = 'tests/data/preprocessed'
SAMPLE_FILE = BASE_DIR + TEST_FILES_DIR + '/1089-134686-0037.flac'
Expand Down Expand Up @@ -42,7 +42,7 @@ def test__transform_sample(self):
audio_id, audio_fragments = transformed

self.assertEqual(audio_id, '1089-134686-0037')
self.assertEqual(audio_fragments.shape, (114881,))
self.assertEqual(audio_fragments.shape, (83360,))

def test_generate_samples(self):
samples = list(self.reader.generate_samples(self.TEST_FILES_DIR, lambda x, y: x))
Expand Down

0 comments on commit db61338

Please sign in to comment.