Adapters
Afar
music
Edit model card

pip install spleeter

import os from spleeter.separator import Separator from spleeter.audio.adapter import AudioAdapter

def separate_vocals(input_file, output_dir): # 创建一个Separator对象,使用2stems预训练模型(vocals 和 accompaniment) separator = Separator('spleeter:2stems')

# 创建输出目录(如果不存在)
os.makedirs(output_dir, exist_ok=True)

# 执行分离
separator.separate_to_file(input_file, output_dir)

print(f"分离完成。结果保存在 {output_dir}")

使用示例

if name == "main": input_mp3 = "path/to/your/input.mp3" # 替换为你的MP3文件路径 output_directory = "path/to/output/directory" # 替换为你想要保存输出的目录

separate_vocals(input_mp3, output_directory)
Downloads last month
0
Inference API
Unable to determine this model’s pipeline type. Check the docs .

Dataset used to train Yinghoo/spleete