Hendrik Schroeter commited on
Commit
7f47b0f
·
unverified ·
1 Parent(s): ba5932c
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -8,7 +8,6 @@ import markdown
8
  import matplotlib.pyplot as plt
9
  import numpy as np
10
  import torch
11
- import torchaudio as ta
12
  from loguru import logger
13
 
14
  from df import config
@@ -72,16 +71,15 @@ def mix_and_denoise(speech_rec, speech_upl, noise, snr):
72
  speech_file = speech_rec
73
  sp_kwargs = {"frame_offset": 4800}
74
  meta = None
75
- try:
76
- print(ta.info(speech_file))
77
- speech, meta = load_audio(speech_file, sr, **sp_kwargs)
78
- except RuntimeError as e:
79
- if meta is not None:
80
- print(meta)
81
- raise
82
  # Chrome saves files as opus now.
83
- sp_kwargs["format"] = "opus"
84
- speech, meta = load_audio(speech_file, sr, **sp_kwargs)
 
 
 
 
85
 
86
  logger.info(f"Loaded speech with shape {speech.shape}")
87
  noise, _ = load_audio(noise, sr)
 
8
  import matplotlib.pyplot as plt
9
  import numpy as np
10
  import torch
 
11
  from loguru import logger
12
 
13
  from df import config
 
71
  speech_file = speech_rec
72
  sp_kwargs = {"frame_offset": 4800}
73
  meta = None
74
+ for f in ("wav", "mp3", "flac", "vorbis", "opus"):
75
+ print(f)
 
 
 
 
 
76
  # Chrome saves files as opus now.
77
+ sp_kwargs["format"] = f
78
+ try:
79
+ speech, meta = load_audio(speech_file, sr, **sp_kwargs)
80
+ except RuntimeError as e:
81
+ if meta is not None:
82
+ print(meta)
83
 
84
  logger.info(f"Loaded speech with shape {speech.shape}")
85
  noise, _ = load_audio(noise, sr)