File size: 349 Bytes
439a401
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import nussl
import os

def run_separation(file_path):
    signal = nussl.AudioSignal(file_path)
    repet = nussl.separation.primitive.Repet(signal)
    bg, fg = repet()

    bg_file = "bg.wav"
    fg_file = "fg.wav"
    bg.write_audio_to_file(bg_file)
    fg.write_audio_to_file(fg_file)

    return {"background": bg_file, "foreground": fg_file}