Dr. Richard Zinck commited on
Commit
70c40af
1 Parent(s): 52fc447
Files changed (1) hide show
  1. bat_ident.py +11 -4
bat_ident.py CHANGED
@@ -195,11 +195,18 @@ def get_raw_audio_from_file(fpath: str):
195
  The signal split into a list of chunks.
196
  """
197
  # Open file
198
- sig, rate = audio.openAudioFile(fpath, cfg.SAMPLE_RATE,0.0,2)
199
-
 
 
 
 
200
  # Split into raw audio chunks
201
- chunks = audio.splitSignal(sig, cfg.SAMPLE_RATE, cfg.SIG_LENGTH, cfg.SIG_OVERLAP, cfg.SIG_MINLEN)
202
-
 
 
 
203
  return chunks
204
 
205
 
 
195
  The signal split into a list of chunks.
196
  """
197
  # Open file
198
+ try:
199
+ sig, rate = audio.openAudioFile(fpath, cfg.SAMPLE_RATE)
200
+ except Exception as ex:
201
+ print(f"Error: Cannot open audio file at load {afile}", flush=True)
202
+ utils.writeErrorLog(ex)
203
+ chunks = None
204
  # Split into raw audio chunks
205
+ try:
206
+ chunks = audio.splitSignal(sig, cfg.SAMPLE_RATE, cfg.SIG_LENGTH, cfg.SIG_OVERLAP, cfg.SIG_MINLEN)
207
+ except Exception as ex:
208
+ print(f"Error: Cannot chunk audio file {afile}", flush=True)
209
+ utils.writeErrorLog(ex)
210
  return chunks
211
 
212