Hendrik Schroeter commited on
Commit
6b3c03e
1 Parent(s): fd1fecc

chrome stores as opus

Browse files
Files changed (2) hide show
  1. app.py +6 -9
  2. requirements.txt +0 -1
app.py CHANGED
@@ -57,7 +57,9 @@ def mix_at_snr(clean, noise, snr, eps=1e-10):
57
 
58
  def mix_and_denoise(speech_rec, speech_upl, noise, snr):
59
  sr = config("sr", 48000, int, section="df")
60
- logger.info(f"Got parameters speech_rec: {speech_rec}, speech_upl: {speech_upl}, noise: {noise}, snr: {snr}")
 
 
61
  if noise is None:
62
  noise = "samples/dkitchen.wav"
63
  sp_kwargs = {}
@@ -71,14 +73,9 @@ def mix_and_denoise(speech_rec, speech_upl, noise, snr):
71
  try:
72
  speech, meta = load_audio(speech_file, sr, **sp_kwargs)
73
  except RuntimeError as e:
74
- logger.error("Could not load audio: " + str(e))
75
- import os
76
- import librosa
77
-
78
- print(os.path.getsize(speech_file))
79
- print(os.path.getmtime(speech_file))
80
- meta = object()
81
- speech, meta.sample_rate = librosa.load(speech_file, sr)
82
 
83
  logger.info(f"Loaded speech with shape {speech.shape}")
84
  noise, _ = load_audio(noise, sr)
 
57
 
58
  def mix_and_denoise(speech_rec, speech_upl, noise, snr):
59
  sr = config("sr", 48000, int, section="df")
60
+ logger.info(
61
+ f"Got parameters speech_rec: {speech_rec}, speech_upl: {speech_upl}, noise: {noise}, snr: {snr}"
62
+ )
63
  if noise is None:
64
  noise = "samples/dkitchen.wav"
65
  sp_kwargs = {}
 
73
  try:
74
  speech, meta = load_audio(speech_file, sr, **sp_kwargs)
75
  except RuntimeError as e:
76
+ # Chrome saves files as opus now.
77
+ sp_kwargs["format"] = "opus"
78
+ speech, meta = load_audio(speech_file, sr, **sp_kwargs)
 
 
 
 
 
79
 
80
  logger.info(f"Loaded speech with shape {speech.shape}")
81
  noise, _ = load_audio(noise, sr)
requirements.txt CHANGED
@@ -4,4 +4,3 @@ deepfilternet
4
  matplotlib
5
  markdown
6
  gradio
7
- librosa
 
4
  matplotlib
5
  markdown
6
  gradio