Skip to content

Commit 5428cc6

Browse files
author
Rick-McCoy
committed
Fixed major bug
m4a raw data is in 16 bit format, not 8 bit
1 parent 7f63571 commit 5428cc6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def read_wav_np(wavpath):
1313
file_format = wavpath.split('.')[-1]
1414
audio = AudioSegment.from_file(wavpath, file_format)
1515
data = audio.raw_data
16-
wav = np.frombuffer(data, dtype=np.uint8)
16+
wav = np.frombuffer(data, dtype=np.uint16)
1717

1818
if len(wav.shape) == 2:
1919
wav = wav[:, 0]
@@ -37,6 +37,6 @@ def cut_wav(L, wav):
3737
'constant', constant_values=0.0)
3838
else:
3939
start = random.randint(0, samples - L)
40-
wav = wav[start:start+L]
40+
wav = wav[start:start + L]
4141

4242
return wav

0 commit comments

Comments
 (0)