Spaces:
Sleeping
Sleeping
Update app.py
Browse files27 unmodified lines282930313233326 unmodified lines36036136236336436570 unmodified lines43643743843944044172 unmodified lines5145155165175185195205 unmodified lines52652752852953053122 unmodified lines5545555565575585595605615625635643 unmodified lines56856957057157257357457514 unmodified lines5905915925935945955965975985996003 unmodified lines6046056066076086096106116 unmodified lines61861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766811 unmodified lines68068168268368468568615 unmodified lines7027037047057067079 unmodified lines7177187197207217227237247257267272 unmodified lines7307317327337347357367377387397407417427437447457467477487497507517524 unmodified lines7577587597607617625 unmodified lines7687697707717727732 unmodified lines77677777877978078127 unmodified linesimport gradio as grimport loggingimport timewarnings.filterwarnings("ignore")326 unmodified linesm_threads=2,device_base="cuda",):if device_base == "cuda":device = torch.device("cuda:0")processor_num = 070 unmodified linesreturn main_filepath, invert_filepathMDX_DOWNLOAD_LINK = "https://github.com/TRvlvr/model_repo/releases/download/all_public_uvr_models/"UVR_MODELS = ["UVR-MDX-NET-Voc_FT.onnx",72 unmodified linesif only_voiceless:logger.info("Voiceless Track Separation...")return run_mdx(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "UVR-MDX-NET-Inst_HQ_4.onnx"),5 unmodified linesdevice_base=device_base,)logger.info("Vocal Track Isolation...")vocals_path, instrumentals_path = run_mdx(mdx_model_params,22 unmodified linesdevice_base=device_base,)except Exception as e:if "0:00:" in str(e):gr.Info("Waiting 60 seconds for GPU quota")time.sleep(56)random_sleep()backup_vocals_path, main_vocals_path = run_mdx(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "UVR_MDXNET_KARA_2.onnx"),3 unmodified linesdenoise=True,device_base=device_base,)else:raise eelse:backup_vocals_path, main_vocals_path = None, vocals_path14 unmodified linesdevice_base=device_base,)except Exception as e:if "0:00:" in str(e):gr.Info("Waiting 60 seconds for GPU quota")time.sleep(56)random_sleep()_, vocals_dereverb_path = run_mdx(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "Reverb_HQ_By_FoxJoy.onnx"),3 unmodified linesdenoise=True,device_base=device_base,)else:raise eelse:vocals_dereverb_path = main_vocals_path6 unmodified lines)def sound_separate(media_file, stem, main, dereverb):if not media_file:raise ValueError("The audio pls")if not stem:raise ValueError("Select vocal or background...")hash_audio = str(get_hash(media_file))outputs = []start_time = time.time()if stem == "vocal":try:_, _, _, _, vocal_audio = process_uvr_task(orig_song_path=media_file,song_id=hash_audio+"mdx",main_vocals=main,dereverb=dereverb,remove_files_output_dir=False,)outputs.append(vocal_audio)except Exception as error:gr.Info(str(error))logger.error(str(error))if stem == "background":background_audio, _ = process_uvr_task(orig_song_path=media_file,song_id=hash_audio+"voiceless",only_voiceless=True,remove_files_output_dir=False,)# copy_files(background_audio, ".")outputs.append(background_audio)end_time = time.time()execution_time = end_time - start_timelogger.info(f"Execution time: {execution_time} seconds")if not outputs:raise Exception("Error in sound separate")return outputs11 unmodified linesreturn gr.Radio(choices=["vocal", "background"],value="vocal",label="Vocal",# info="",)15 unmodified lines)def button_conf():return gr.Button("Inference",9 unmodified lines)def show_vocal_components(input_bool):param = True if input_bool == "vocal" else Falsereturn gr.update(visible=param), gr.update(visible=param)def get_gui(theme):2 unmodified linesgr.Markdown(description)aud = audio_conf()with gr.Column():with gr.Row():stem_gui = stem_conf()with gr.Column():with gr.Row():main_gui = main_conf()dereverb_gui = dereverb_conf()stem_gui.change(show_vocal_components,[stem_gui],[main_gui, dereverb_gui],)button_base = button_conf()output_base = output_conf()4 unmodified linesstem_gui,main_gui,dereverb_gui,],outputs=[output_base],)5 unmodified lines"vocal",False,False,],],fn=sound_separate,2 unmodified linesstem_gui,main_gui,dereverb_gui,],outputs=[output_base],cache_examples=False,27 unmodified lines28293031323334353637326 unmodified lines36436536636736836937070 unmodified lines44144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553672 unmodified lines6096106116126136146156165 unmodified lines62262362462562662762862922 unmodified lines6526536546556566576583 unmodified lines66266366466566666714 unmodified lines6826836846856866876883 unmodified lines6926936946956966976 unmodified lines70470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193211 unmodified lines94494594694794894995015 unmodified lines966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912209 unmodified lines123012311232123312341235123612371238123912401241124212431244124512461247124812492 unmodified lines1252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413054 unmodified lines1310131113121313131413151316131713181319132013211322132313245 unmodified lines133013311332133313341335133613371338133913402 unmodified lines13431344134513461347134813491350135113521353135413551356135727 unmodified linesimport gradio as grimport loggingimport timeimport tracebackfrom pedalboard import Pedalboard, Reverb, Delay, Chorus, Compressor, Gain, HighpassFilter, LowpassFilterfrom pedalboard.io import AudioFileimport numpy as npwarnings.filterwarnings("ignore")326 unmodified linesm_threads=2,device_base="cuda",):if device_base == "cuda":device = torch.device("cuda:0")processor_num = 070 unmodified linesreturn main_filepath, invert_filepathdef run_mdx_beta(model_params,output_dir,model_path,filename,exclude_main=False,exclude_inversion=False,suffix=None,invert_suffix=None,denoise=False,keep_orig=True,m_threads=2,device_base="",):m_threads = 1duration = librosa.get_duration(filename=filename)if duration >= 60 and duration <= 120:m_threads = 8elif duration > 120:m_threads = 16logger.info(f"threads: {m_threads}")model_hash = MDX.get_hash(model_path)device = torch.device("cpu")processor_num = -1mp = model_params.get(model_hash)model = MDXModel(device,dim_f=mp["mdx_dim_f_set"],dim_t=2 ** mp["mdx_dim_t_set"],n_fft=mp["mdx_n_fft_scale_set"],stem_name=mp["primary_stem"],compensation=mp["compensate"],)mdx_sess = MDX(model_path, model, processor=processor_num)wave, sr = librosa.load(filename, mono=False, sr=44100)# normalizing input wave gives better outputpeak = max(np.max(wave), abs(np.min(wave)))wave /= peakif denoise:wave_processed = -(mdx_sess.process_wave(-wave, m_threads)) + (mdx_sess.process_wave(wave, m_threads))wave_processed *= 0.5else:wave_processed = mdx_sess.process_wave(wave, m_threads)# return to previous peakwave_processed *= peakstem_name = model.stem_name if suffix is None else suffixmain_filepath = Noneif not exclude_main:main_filepath = os.path.join(output_dir,f"{os.path.basename(os.path.splitext(filename)[0])}_{stem_name}.wav",)sf.write(main_filepath, wave_processed.T, sr)invert_filepath = Noneif not exclude_inversion:diff_stem_name = (stem_naming.get(stem_name)if invert_suffix is Noneelse invert_suffix)stem_name = (f"{stem_name}_diff" if diff_stem_name is None else diff_stem_name)invert_filepath = os.path.join(output_dir,f"{os.path.basename(os.path.splitext(filename)[0])}_{stem_name}.wav",)sf.write(invert_filepath,(-wave_processed.T * model.compensation) + wave.T,sr,)if not keep_orig:os.remove(filename)del mdx_sess, wave_processed, wavegc.collect()torch.cuda.empty_cache()return main_filepath, invert_filepathMDX_DOWNLOAD_LINK = "https://github.com/TRvlvr/model_repo/releases/download/all_public_uvr_models/"UVR_MODELS = ["UVR-MDX-NET-Voc_FT.onnx",72 unmodified linesif only_voiceless:logger.info("Voiceless Track Separation...")process = run_mdx(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "UVR-MDX-NET-Inst_HQ_4.onnx"),5 unmodified linesdevice_base=device_base,)return processlogger.info("Vocal Track Isolation...")vocals_path, instrumentals_path = run_mdx(mdx_model_params,22 unmodified linesdevice_base=device_base,)except Exception as e:backup_vocals_path, main_vocals_path = run_mdx_beta(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "UVR_MDXNET_KARA_2.onnx"),3 unmodified linesdenoise=True,device_base=device_base,)else:backup_vocals_path, main_vocals_path = None, vocals_path14 unmodified linesdevice_base=device_base,)except Exception as e:_, vocals_dereverb_path = run_mdx_beta(mdx_model_params,song_output_dir,os.path.join(mdxnet_models_dir, "Reverb_HQ_By_FoxJoy.onnx"),3 unmodified linesdenoise=True,device_base=device_base,)else:vocals_dereverb_path = main_vocals_path6 unmodified lines)def add_vocal_effects(input_file, output_file, reverb_room_size=0.6, vocal_reverb_dryness=0.8, reverb_damping=0.6, reverb_wet_level=0.35,delay_seconds=0.4, delay_mix=0.25,compressor_threshold_db=-25, compressor_ratio=3.5, compressor_attack_ms=10, compressor_release_ms=60,gain_db=3):effects = [HighpassFilter()]effects.append(Reverb(room_size=reverb_room_size, damping=reverb_damping, wet_level=reverb_wet_level, dry_level=vocal_reverb_dryness))effects.append(Compressor(threshold_db=compressor_threshold_db, ratio=compressor_ratio,attack_ms=compressor_attack_ms, release_ms=compressor_release_ms))if delay_seconds > 0 or delay_mix > 0:effects.append(Delay(delay_seconds=delay_seconds, mix=delay_mix))print("delay applied")# effects.append(Chorus())if gain_db:effects.append(Gain(gain_db=gain_db))print("added gain db")board = Pedalboard(effects)with AudioFile(input_file) as f:with AudioFile(output_file, 'w', f.samplerate, f.num_channels) as o:# Read one second of audio at a time, until the file is empty:while f.tell() < f.frames:chunk = f.read(int(f.samplerate))effected = board(chunk, f.samplerate, reset=False)o.write(effected)def add_instrumental_effects(input_file, output_file, highpass_freq=100, lowpass_freq=12000,reverb_room_size=0.5, reverb_damping=0.5, reverb_wet_level=0.25,compressor_threshold_db=-20, compressor_ratio=2.5, compressor_attack_ms=15, compressor_release_ms=80,gain_db=2):effects = [HighpassFilter(cutoff_frequency_hz=highpass_freq),LowpassFilter(cutoff_frequency_hz=lowpass_freq),]if reverb_room_size > 0 or reverb_damping > 0 or reverb_wet_level > 0:effects.append(Reverb(room_size=reverb_room_size, damping=reverb_damping, wet_level=reverb_wet_level))effects.append(Compressor(threshold_db=compressor_threshold_db, ratio=compressor_ratio,attack_ms=compressor_attack_ms, release_ms=compressor_release_ms))if gain_db:effects.append(Gain(gain_db=gain_db))board = Pedalboard(effects)with AudioFile(input_file) as f:with AudioFile(output_file, 'w', f.samplerate, f.num_channels) as o:# Read one second of audio at a time, until the file is empty:while f.tell() < f.frames:chunk = f.read(int(f.samplerate))effected = board(chunk, f.samplerate, reset=False)o.write(effected)def sound_separate(media_file, stem, main, dereverb, vocal_effects=True, background_effects=True,vocal_reverb_room_size=0.6, vocal_reverb_damping=0.6, vocal_reverb_wet_level=0.35,vocal_delay_seconds=0.4, vocal_delay_mix=0.25,vocal_compressor_threshold_db=-25, vocal_compressor_ratio=3.5, vocal_compressor_attack_ms=10, vocal_compressor_release_ms=60,vocal_gain_db=4,background_highpass_freq=120, background_lowpass_freq=11000,background_reverb_room_size=0.5, background_reverb_damping=0.5, background_reverb_wet_level=0.25,background_compressor_threshold_db=-20, background_compressor_ratio=2.5, background_compressor_attack_ms=15, background_compressor_release_ms=80,background_gain_db=3):if not media_file:raise ValueError("The audio path is missing.")if not stem:raise ValueError("Please select 'vocal' or 'background' stem.")hash_audio = str(get_hash(media_file))media_dir = os.path.dirname(media_file)outputs = []start_time = time.time()if stem == "vocal":try:_, _, _, _, vocal_audio = process_uvr_task(orig_song_path=media_file,song_id=hash_audio + "mdx",main_vocals=main,dereverb=dereverb,remove_files_output_dir=False,)if vocal_effects:suffix = '_effects'file_name, file_extension = os.path.splitext(vocal_audio)out_effects = file_name + suffix + file_extensionout_effects_path = os.path.join(media_dir, out_effects)add_vocal_effects(vocal_audio, out_effects_path,reverb_room_size=vocal_reverb_room_size, reverb_damping=vocal_reverb_damping, reverb_wet_level=vocal_reverb_wet_level,delay_seconds=vocal_delay_seconds, delay_mix=vocal_delay_mix,compressor_threshold_db=vocal_compressor_threshold_db, compressor_ratio=vocal_compressor_ratio, compressor_attack_ms=vocal_compressor_attack_ms, compressor_release_ms=vocal_compressor_release_ms,gain_db=vocal_gain_db)vocal_audio = out_effects_pathoutputs.append(vocal_audio)except Exception as error:logger.error(str(error))traceback.print_exc()if stem == "background":background_audio, _ = process_uvr_task(orig_song_path=media_file,song_id=hash_audio + "voiceless",only_voiceless=True,remove_files_output_dir=False,)if background_effects:suffix = '_effects'file_name, file_extension = os.path.splitext(background_audio)out_effects = file_name + suffix + file_extensionout_effects_path = os.path.join(media_dir, out_effects)add_instrumental_effects(background_audio, out_effects_path,highpass_freq=background_highpass_freq, lowpass_freq=background_lowpass_freq,reverb_room_size=background_reverb_room_size, reverb_damping=background_reverb_damping, reverb_wet_level=background_reverb_wet_level,compressor_threshold_db=background_compressor_threshold_db, compressor_ratio=background_compressor_ratio, compressor_attack_ms=background_compressor_attack_ms, compressor_release_ms=background_compressor_release_ms,gain_db=background_gain_db)background_audio = out_effects_pathoutputs.append(background_audio)end_time = time.time()execution_time = end_time - start_timelogger.info(f"Execution time: {execution_time} seconds")if not outputs:raise Exception("Error in sound separation.")return outputsdef sound_separate(media_file, stem, main, dereverb, vocal_effects=True, background_effects=True,vocal_reverb_room_size=0.6, vocal_reverb_damping=0.6, vocal_reverb_dryness=0.8 ,vocal_reverb_wet_level=0.35,vocal_delay_seconds=0.4, vocal_delay_mix=0.25,vocal_compressor_threshold_db=-25, vocal_compressor_ratio=3.5, vocal_compressor_attack_ms=10, vocal_compressor_release_ms=60,vocal_gain_db=4,background_highpass_freq=120, background_lowpass_freq=11000,background_reverb_room_size=0.5, background_reverb_damping=0.5, background_reverb_wet_level=0.25,background_compressor_threshold_db=-20, background_compressor_ratio=2.5, background_compressor_attack_ms=15, background_compressor_release_ms=80,background_gain_db=3):if not media_file:raise ValueError("The audio path is missing.")if not stem:raise ValueError("Please select 'vocal' or 'background' stem.")hash_audio = str(get_hash(media_file))media_dir = os.path.dirname(media_file)outputs = []start_time = time.time()if stem == "vocal":try:_, _, _, _, vocal_audio = process_uvr_task(orig_song_path=media_file,song_id=hash_audio + "mdx",main_vocals=main,dereverb=dereverb,remove_files_output_dir=False,)if vocal_effects:suffix = '_effects'file_name, file_extension = os.path.splitext(os.path.abspath(vocal_audio))out_effects = file_name + suffix + file_extensionout_effects_path = os.path.join(media_dir, out_effects)add_vocal_effects(vocal_audio, out_effects_path,reverb_room_size=vocal_reverb_room_size, reverb_damping=vocal_reverb_damping, vocal_reverb_dryness=vocal_reverb_dryness, reverb_wet_level=vocal_reverb_wet_level,delay_seconds=vocal_delay_seconds, delay_mix=vocal_delay_mix,compressor_threshold_db=vocal_compressor_threshold_db, compressor_ratio=vocal_compressor_ratio, compressor_attack_ms=vocal_compressor_attack_ms, compressor_release_ms=vocal_compressor_release_ms,gain_db=vocal_gain_db)vocal_audio = out_effects_pathoutputs.append(vocal_audio)except Exception as error:logger.error(str(error))if stem == "background":background_audio, _ = process_uvr_task(orig_song_path=media_file,song_id=hash_audio + "voiceless",only_voiceless=True,remove_files_output_dir=False,)if background_effects:suffix = '_effects'file_name, file_extension = os.path.splitext(os.path.abspath(background_audio))out_effects = file_name + suffix + file_extensionout_effects_path = os.path.join(media_dir, out_effects)print(file_name, file_extension, out_effects, out_effects_path)add_instrumental_effects(background_audio, out_effects_path,highpass_freq=background_highpass_freq, lowpass_freq=background_lowpass_freq,reverb_room_size=background_reverb_room_size, reverb_damping=background_reverb_damping, reverb_wet_level=background_reverb_wet_level,compressor_threshold_db=background_compressor_threshold_db, compressor_ratio=background_compressor_ratio, compressor_attack_ms=background_compressor_attack_ms, compressor_release_ms=background_compressor_release_ms,gain_db=background_gain_db)background_audio = out_effects_pathoutputs.append(background_audio)end_time = time.time()execution_time = end_time - start_timelogger.info(f"Execution time: {execution_time} seconds")if not outputs:raise Exception("Error in sound separation.")return outputs11 unmodified linesreturn gr.Radio(choices=["vocal", "background"],value="vocal",label="Stem",# info="",)15 unmodified lines)def vocal_effects_conf():return gr.Checkbox(False,label="Vocal Effects",# info="",visible=True,)def background_effects_conf():return gr.Checkbox(False,label="Background Effects",# info="",visible=False,)def vocal_reverb_room_size_conf():return gr.Number(0.15,label="Vocal Reverb Room Size",minimum=0.0,maximum=1.0,step=0.05,visible=True,)def vocal_reverb_damping_conf():return gr.Number(0.7,label="Vocal Reverb Damping",minimum=0.0,maximum=1.0,step=0.01,visible=True,)def vocal_reverb_wet_level_conf():return gr.Number(0.2,label="Vocal Reverb Wet Level",minimum=0.0,maximum=1.0,step=0.05,visible=True,)def vocal_reverb_dryness_level_conf():return gr.Number(0.8,label="Vocal Reverb Dryness Level",minimum=0.0,maximum=1.0,step=0.05,visible=True,)def vocal_delay_seconds_conf():return gr.Number(0.,label="Vocal Delay Seconds",minimum=0.0,maximum=1.0,step=0.01,visible=True,)def vocal_delay_mix_conf():return gr.Number(0.,label="Vocal Delay Mix",minimum=0.0,maximum=1.0,step=0.01,visible=True,)def vocal_compressor_threshold_db_conf():return gr.Number(-15,label="Vocal Compressor Threshold (dB)",minimum=-60,maximum=0,step=1,visible=True,)def vocal_compressor_ratio_conf():return gr.Number(4.,label="Vocal Compressor Ratio",minimum=0,maximum=20,step=0.1,visible=True,)def vocal_compressor_attack_ms_conf():return gr.Number(1.0,label="Vocal Compressor Attack (ms)",minimum=0,maximum=1000,step=1,visible=True,)def vocal_compressor_release_ms_conf():return gr.Number(100,label="Vocal Compressor Release (ms)",minimum=0,maximum=3000,step=1,visible=True,)def vocal_gain_db_conf():return gr.Number(0,label="Vocal Gain (dB)",minimum=-40,maximum=40,step=1,visible=True,)def background_highpass_freq_conf():return gr.Number(120,label="Background Highpass Frequency (Hz)",minimum=0,maximum=1000,step=1,visible=True,)def background_lowpass_freq_conf():return gr.Number(11000,label="Background Lowpass Frequency (Hz)",minimum=0,maximum=20000,step=1,visible=True,)def background_reverb_room_size_conf():return gr.Number(0.1,label="Background Reverb Room Size",minimum=0.0,maximum=1.0,step=0.1,visible=True,)def background_reverb_damping_conf():return gr.Number(0.5,label="Background Reverb Damping",minimum=0.0,maximum=1.0,step=0.1,visible=True,)def background_reverb_wet_level_conf():return gr.Number(0.25,label="Background Reverb Wet Level",minimum=0.0,maximum=1.0,step=0.05,visible=True,)def background_compressor_threshold_db_conf():return gr.Number(-15,label="Background Compressor Threshold (dB)",minimum=-60,maximum=0,step=1,visible=True,)def background_compressor_ratio_conf():return gr.Number(4.,label="Background Compressor Ratio",minimum=0,maximum=20,step=0.1,visible=True,)def background_compressor_attack_ms_conf():return gr.Number(15,label="Background Compressor Attack (ms)",minimum=0,maximum=1000,step=1,visible=True,)def background_compressor_release_ms_conf():return gr.Number(60,label="Background Compressor Release (ms)",minimum=0,maximum=3000,step=1,visible=True,)def background_gain_db_conf():return gr.Number(0,label="Background Gain (dB)",minimum=-40,maximum=40,step=1,visible=True,)def button_conf():return gr.Button("Inference",9 unmodified lines)def show_vocal_components(value_name):if value_name == "vocal":return gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=False)else:return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)def get_gui(theme):2 unmodified linesgr.Markdown(description)aud = audio_conf()with gr.Column():with gr.Row():stem_gui = stem_conf()with gr.Column():with gr.Row():main_gui = main_conf()dereverb_gui = dereverb_conf()vocal_effects_gui = vocal_effects_conf()background_effects_gui = background_effects_conf()# with gr.Column():with gr.Accordion("Vocal Effects Parameters", open=False): # with gr.Row():# gr.Label("Vocal Effects Parameters")with gr.Row():vocal_reverb_room_size_gui = vocal_reverb_room_size_conf()vocal_reverb_damping_gui = vocal_reverb_damping_conf()vocal_reverb_dryness_gui = vocal_reverb_dryness_level_conf()vocal_reverb_wet_level_gui = vocal_reverb_wet_level_conf()vocal_delay_seconds_gui = vocal_delay_seconds_conf()vocal_delay_mix_gui = vocal_delay_mix_conf()vocal_compressor_threshold_db_gui = vocal_compressor_threshold_db_conf()vocal_compressor_ratio_gui = vocal_compressor_ratio_conf()vocal_compressor_attack_ms_gui = vocal_compressor_attack_ms_conf()vocal_compressor_release_ms_gui = vocal_compressor_release_ms_conf()vocal_gain_db_gui = vocal_gain_db_conf()with gr.Accordion("Background Effects Parameters", open=False): # with gr.Row():# gr.Label("Background Effects Parameters")with gr.Row():background_highpass_freq_gui = background_highpass_freq_conf()background_lowpass_freq_gui = background_lowpass_freq_conf()background_reverb_room_size_gui = background_reverb_room_size_conf()background_reverb_damping_gui = background_reverb_damping_conf()background_reverb_wet_level_gui = background_reverb_wet_level_conf()background_compressor_threshold_db_gui = background_compressor_threshold_db_conf()background_compressor_ratio_gui = background_compressor_ratio_conf()background_compressor_attack_ms_gui = background_compressor_attack_ms_conf()background_compressor_release_ms_gui = background_compressor_release_ms_conf()background_gain_db_gui = background_gain_db_conf()stem_gui.change(show_vocal_components,[stem_gui],[main_gui, dereverb_gui, vocal_effects_gui, background_effects_gui],)button_base = button_conf()output_base = output_conf()4 unmodified linesstem_gui,main_gui,dereverb_gui,vocal_effects_gui,background_effects_gui,vocal_reverb_room_size_gui, vocal_reverb_damping_gui, vocal_reverb_dryness_gui, vocal_reverb_wet_level_gui,vocal_delay_seconds_gui, vocal_delay_mix_gui, vocal_compressor_threshold_db_gui, vocal_compressor_ratio_gui,vocal_compressor_attack_ms_gui, vocal_compressor_release_ms_gui, vocal_gain_db_gui,background_highpass_freq_gui, background_lowpass_freq_gui, background_reverb_room_size_gui,background_reverb_damping_gui, background_reverb_wet_level_gui, background_compressor_threshold_db_gui,background_compressor_ratio_gui, background_compressor_attack_ms_gui, background_compressor_release_ms_gui,background_gain_db_gui,],outputs=[output_base],)5 unmodified lines"vocal",False,False,False,False,0.15, 0.7, 0.8, 0.2,0., 0., -15, 4., 1, 100, 0,120, 11000, 0.5, 0.1, 0.25, -15, 4., 15, 60, 0,],],fn=sound_separate,2 unmodified linesstem_gui,main_gui,dereverb_gui,vocal_effects_gui,background_effects_gui,vocal_reverb_room_size_gui, vocal_reverb_damping_gui, vocal_reverb_dryness_gui, vocal_reverb_wet_level_gui,vocal_delay_seconds_gui, vocal_delay_mix_gui, vocal_compressor_threshold_db_gui, vocal_compressor_ratio_gui,vocal_compressor_attack_ms_gui, vocal_compressor_release_ms_gui, vocal_gain_db_gui,background_highpass_freq_gui, background_lowpass_freq_gui, background_reverb_room_size_gui,background_reverb_damping_gui, background_reverb_wet_level_gui, background_compressor_threshold_db_gui,background_compressor_ratio_gui, background_compressor_attack_ms_gui, background_compressor_release_ms_gui,background_gain_db_gui,],outputs=[output_base],cache_examples=False,
app.py+615-39