Aashiue commited on
Commit
439a401
·
verified ·
1 Parent(s): d42e96e

Create utils.py

Browse files
Files changed (1) hide show
  1. utils.py +14 -0
utils.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import nussl
2
+ import os
3
+
4
+ def run_separation(file_path):
5
+ signal = nussl.AudioSignal(file_path)
6
+ repet = nussl.separation.primitive.Repet(signal)
7
+ bg, fg = repet()
8
+
9
+ bg_file = "bg.wav"
10
+ fg_file = "fg.wav"
11
+ bg.write_audio_to_file(bg_file)
12
+ fg.write_audio_to_file(fg_file)
13
+
14
+ return {"background": bg_file, "foreground": fg_file}