-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeepfilter_interface.py
38 lines (30 loc) · 1.38 KB
/
deepfilter_interface.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import subprocess
def process_audio(input_wav, output_dir, options={}):
"""
Appelle DeepFilterNet pour traiter un fichier audio avec les options spécifiées.
"""
print("[DEBUG] Début de process_audio")
print(f"[DEBUG] Paramètres reçus: input={input_wav}, output_dir={output_dir}, options={options}")
command = [
"deep-filter", input_wav, "-o", output_dir
]
# Ajout des options
if options['postfilter']:
command += ['--pf']
if options['pf_beta']:
command += ['--pf-beta', str(options['pf_beta'])]
if options['atten_lim_db']:
command += ['--atten-lim-db', str(options['atten_lim_db'])]
print(f"[DEBUG] Commande complète: {' '.join(command)}")
try:
# Exécuter la commande et capturer la sortie
result = subprocess.run(command, capture_output=True, text=True)
print(f"[DEBUG] Sortie standard: {result.stdout}")
print(f"[DEBUG] Sortie d'erreur: {result.stderr}")
print(f"[DEBUG] Code de retour: {result.returncode}")
if result.returncode != 0:
print(f"[ERROR] La commande a échoué avec le code {result.returncode}")
except Exception as e:
print(f"[ERROR] Erreur lors de l'exécution de la commande: {str(e)}")
raise
print("[DEBUG] Fin de process_audio")