Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions crepe/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,18 @@ def process_file(file, output=None, model_capacity='full', viterbi=False,
"""
try:
sr, audio = wavfile.read(file)
except ValueError:
print("CREPE: Could not read %s" % file, file=sys.stderr)
raise
except ValueError as wavfile_error:
# scipy.wavfile cannot read 24-bit files and is in general prone to failing.
# If it fails reading, let's fall back on wavio, a library that works most of the times.
print(wavfile_error)
print('CREPE: scipy.wavfile cannot read the file. Attempting with the wavio library...')
try:
import wavio
_f = wavio.read(file)
sr, audio = _f.rate, _f.data
except:
print("CREPE: Could not read %s" % file, file=sys.stderr)
raise

time, frequency, confidence, activation = predict(
audio, sr,
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ h5py>=2.7.0,<3.0.0
hmmlearn>=0.2.0,<0.3.0
imageio>=2.3.0
scikit-learn>=0.16
wavio==0.0.4