Separate the singing voice from the music online free

AI Voice Separation

Separate Singing Voice from Music

from flask import Flask, request, jsonify, send_file from spleeter.separator import Separator import tempfile import os app = Flask(__name__) separator = Separator('spleeter:2stems') @app.route('/separate', methods=['POST']) def separate_audio(): if 'audioFile' not in request.files: return "No file uploaded", 400 audio_file = request.files['audioFile'] with tempfile.TemporaryDirectory() as tmpdir: input_path = os.path.join(tmpdir, 'input.wav') audio_file.save(input_path) # Perform separation output_path = os.path.join(tmpdir, 'output') separator.separate_to_file(input_path, output_path) # Load separated files voice_path = os.path.join(output_path, 'input', 'vocals.wav') music_path = os.path.join(output_path, 'input', 'accompaniment.wav') # Convert files to bytes for sending with open(voice_path, 'rb') as f: voice_bytes = f.read() with open(music_path, 'rb') as f: music_bytes = f.read() return jsonify({'voice': list(voice_bytes), 'music': list(music_bytes)}) if __name__ == '__main__': app.run(debug=True)

0 ความคิดเห็น:

โพสต์แนะนำ

How to recycle gold and silver from cpu computer scrap Old CPU Scrap Gold Value

How to recycle gold and silver from cpu computer scrap  Old CPU Scrap Gold Value youtube Subscribe to this ►►► https://goo.gl/9...