├── LICENSE ├── README.md └── UVR5_NO_UI.ipynb /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Eddycrack 864 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

🎵 UVR5 NO UI 🎵

2 | 3 |
4 | 5 | [![madewithlove](https://img.shields.io/badge/made_with-%E2%9D%A4-red?style=for-the-badge&labelColor=orange)](https://github.com/Eddycrack864/UVR5-NO-UI) 6 | 7 | ![cutecounter](https://count.nett.moe/get/uvr5_no_ui_colab/img?theme=rule34) 8 | 9 | [![Open In Colab](https://img.shields.io/badge/Colab-F9AB00?style=for-the-badge&logo=googlecolab&color=525252)](https://colab.research.google.com/github/Eddycrack864/UVR5-NO-UI/blob/main/UVR5_NO_UI.ipynb) 10 | [![Open In Kaggle](https://img.shields.io/badge/Kaggle-20BEFF?style=for-the-badge&logo=Kaggle&logoColor=white)](https://www.kaggle.com/code/eddycrack864/uvr5-no-ui) 11 | 12 | Open in Studio 13 | 14 | [![Licence](https://img.shields.io/badge/LICENSE-MIT-green.svg?style=for-the-badge)](https://github.com/Eddycrack864/UVR5-NO-UI/blob/main/LICENSE) 15 | [![Discord](https://img.shields.io/badge/Community-Discord-7289DA?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/aihub) 16 | 17 | This colab is based on [python-audio-separator](https://github.com/karaokenerds/python-audio-separator) (a CLI version of UVR5). This project was originally created for the [AI ​​HUB](https://discord.gg/aihub) community. 18 | 19 |
20 | 21 | ## Features: 22 | * All VR Arch Models 23 | * All MDX-NET Models 24 | * Demucs v4 Models 25 | * MDX23C Models 26 | * BS-Roformer ViperX Models 27 | * VIP Models 28 | * Drumsep (Drum separation based on a Hybrid Demucs model) 29 | * Batch Separation 30 | * Separation of videos/audios by link. Check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) 31 | * Audio Downloader 32 | * Kaggle Support 33 | 34 | ## How To Use 35 | 1. In your Google Drive account create 2 folders. One for the audios you are going to separate and another where the separated files will be saved. 36 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/849a1559-3993-419e-a148-f22d25df6ca7) 37 | 2. Upload all the audios you want to separate into the folder you created. 38 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/65e74764-a40e-41e2-b89a-971e78b0c552) 39 | 3. Run the first cell and give it access permissions to Google Drive. 40 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/4fa0da23-78f5-4369-a7a6-df73c0cba919) 41 | 4. Place the paths to the folders you created in Google Drive or YouTube video/short link, then select the model you want to use and its parameters, then run the cell. 42 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/e9267605-7867-414e-b48b-3b7944fd83d5) 43 | 5. Now you have the separated audios in the output folder! 44 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/4f70b567-bfc6-4bb8-ad23-288fab12a8c4) 45 | **Extra:** 46 | You can download the audio of a YouTube video by entering the link of the video, the path where it will be saved (it is recommended that it be the same where you save the audios that you are going to separate), audio format and the name of the audio (give it the name you want) 47 | ![image](https://github.com/Eddycrack864/UVR5-NO-UI/assets/89285504/67445e12-3962-486a-9e4f-8ce819421fde) 48 | 49 | ## Contributions 50 | If you want to participate and help me with this project feel free to create an [issue](https://github.com/Eddycrack864/UVR5-NO-UI/issues) if something goes wrong or make a [pull request](https://github.com/Eddycrack864/UVR5-NO-UI/pulls) to improve this project. 51 | 52 | Any type of contribution is welcome 💖 53 | 54 | If you liked this Colab you can star this repository. I will appreciate a lot 💖💖💖 55 | 56 | You can donate to the original UVR5 project here: 57 | 58 | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5) 59 | 60 | ## Credits 61 | * python-audio-separator by [beveradb](https://github.com/beveradb) 62 | * Audio Downloader and Improvements by [Blane187](https://huggingface.co/Blane187) 63 | * drumsep by [inagoy](https://github.com/inagoy) 64 | * yt_dlp by [yt_dlp](https://github.com/yt-dlp) 65 | -------------------------------------------------------------------------------- /UVR5_NO_UI.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "view-in-github", 7 | "colab_type": "text" 8 | }, 9 | "source": [ 10 | "\"Open" 11 | ] 12 | }, 13 | { 14 | "cell_type": "markdown", 15 | "metadata": { 16 | "id": "_ju_tDe_EVzb" 17 | }, 18 | "source": [ 19 | "# **🎵 UVR5 NO UI 🎵**" 20 | ] 21 | }, 22 | { 23 | "cell_type": "markdown", 24 | "metadata": { 25 | "id": "NTgrB7juAdWm" 26 | }, 27 | "source": [ 28 | "Colab created by **[Not Eddy (Spanish Mod)](http://discord.com/users/274566299349155851)** in **[AI HUB](https://discord.gg/aihub)** community.\n", 29 | "\n", 30 | "
**This is a CLI type colab created based on the [beveradb's python-audio-separator](https://github.com/karaokenerds/python-audio-separator) repository.
\n", 31 | "If you liked this colab you can star my repo on [GitHub](https://github.com/Eddycrack864/UVR5-NO-UI)**.
\n", 32 | "\n", 33 | "
You can donate to the original UVR5 project here:
\n", 34 | "[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/uvr5)\n", 35 | "\n", 36 | "
**How To Use: https://github.com/Eddycrack864/UVR5-NO-UI#how-to-use**\n", 37 | "\n", 38 | "![](https://count.nett.moe/get/uvr5_no_ui_colab/img?theme=rule34)" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": null, 44 | "metadata": { 45 | "cellView": "form", 46 | "id": "5J3-2r_qH0sO" 47 | }, 48 | "outputs": [], 49 | "source": [ 50 | "#@title # **Installation**\n", 51 | "#@markdown ####This takes around 2 minutes\n", 52 | "from IPython.display import clear_output\n", 53 | "import subprocess\n", 54 | "import os\n", 55 | "\n", 56 | "colab_path = \"/content\"\n", 57 | "kaggle_path = \"/kaggle/working\"\n", 58 | "\n", 59 | "if os.path.exists(colab_path):\n", 60 | " print(\"Welcome to Colab Notebook\")\n", 61 | " from google.colab import drive\n", 62 | " drive.mount('/content/drive', force_remount=True)\n", 63 | " path = \"/content\"\n", 64 | "elif os.path.exists(kaggle_path):\n", 65 | " print(\"Welcome to Kaggle Notebook\")\n", 66 | " path = \"/kaggle/working\"\n", 67 | "\n", 68 | "!pip install \"audio-separator[gpu]==0.36.1\"\n", 69 | "subprocess.run([\"pip\", \"install\", \"demucs\"])\n", 70 | "!pip install aria2\n", 71 | "!pip install yt_dlp\n", 72 | "!mkdir models\n", 73 | "!mkdir temp\n", 74 | "!aria2c https://huggingface.co/Eddycrack864/Drumsep/resolve/main/modelo_final.th -o models/drumsep.th\n", 75 | "!apt-get update\n", 76 | "!apt-get install -y libcudnn8\n", 77 | "\n", 78 | "clear_output()\n", 79 | "print('Installation done !')" 80 | ] 81 | }, 82 | { 83 | "cell_type": "markdown", 84 | "metadata": { 85 | "id": "pdEVrNZPlOBA" 86 | }, 87 | "source": [ 88 | "# **Select Separation method:**" 89 | ] 90 | }, 91 | { 92 | "cell_type": "markdown", 93 | "metadata": { 94 | "id": "mQkQsk_JlPbR" 95 | }, 96 | "source": [ 97 | "### ***BS-Roformer***" 98 | ] 99 | }, 100 | { 101 | "cell_type": "code", 102 | "execution_count": null, 103 | "metadata": { 104 | "cellView": "form", 105 | "id": "gmjUWmz8iecd" 106 | }, 107 | "outputs": [], 108 | "source": [ 109 | "#@markdown #**Separation! BS-Roformer and Mel Band Roformer Only**\n", 110 | "import os\n", 111 | "import glob\n", 112 | "import yt_dlp\n", 113 | "\n", 114 | "def downloader(url):\n", 115 | " ydl_opts = {\n", 116 | " 'format': 'bestaudio/best',\n", 117 | " 'postprocessors': [{\n", 118 | " 'key': 'FFmpegExtractAudio',\n", 119 | " 'preferredcodec': 'wav',\n", 120 | " 'preferredquality': '192',\n", 121 | " }],\n", 122 | " 'outtmpl': os.path.join(f'{path}/temp', '%(title)s.%(ext)s'),\n", 123 | " }\n", 124 | "\n", 125 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 126 | " ydl.download([url])\n", 127 | "\n", 128 | "def checker(url):\n", 129 | " return \"http\" in url\n", 130 | "\n", 131 | "def uvr_cli(audio_input, output_folder, model, output_format, segment_size, overlap, batch_size, override_model_segment_size, use_autocast, extensions):\n", 132 | " found_files = []\n", 133 | "\n", 134 | " dictmodel = {\n", 135 | " 'BS-Roformer-Viperx-1297': 'model_bs_roformer_ep_317_sdr_12.9755.ckpt',\n", 136 | " 'BS-Roformer-Viperx-1296': 'model_bs_roformer_ep_368_sdr_12.9628.ckpt',\n", 137 | " 'BS-Roformer-Viperx-1053': 'model_bs_roformer_ep_937_sdr_10.5309.ckpt',\n", 138 | " 'Mel-Roformer-Viperx-1143': 'model_mel_band_roformer_ep_3005_sdr_11.4360.ckpt',\n", 139 | " 'BS-Roformer-De-Reverb': 'deverb_bs_roformer_8_384dim_10depth.ckpt',\n", 140 | " 'Mel-Roformer-Crowd-Aufr33-Viperx': 'mel_band_roformer_crowd_aufr33_viperx_sdr_8.7144.ckpt',\n", 141 | " 'Mel-Roformer-Denoise-Aufr33': 'denoise_mel_band_roformer_aufr33_sdr_27.9959.ckpt',\n", 142 | " 'Mel-Roformer-Denoise-Aufr33-Aggr' : 'denoise_mel_band_roformer_aufr33_aggr_sdr_27.9768.ckpt',\n", 143 | " 'MelBand Roformer | Denoise-Debleed by Gabox' : 'mel_band_roformer_denoise_debleed_gabox.ckpt',\n", 144 | " 'Mel-Roformer-Karaoke-Aufr33-Viperx': 'mel_band_roformer_karaoke_aufr33_viperx_sdr_10.1956.ckpt',\n", 145 | " 'MelBand Roformer | Karaoke by Gabox' : 'mel_band_roformer_karaoke_gabox.ckpt',\n", 146 | " 'MelBand Roformer | Karaoke V2 by Gabox' : 'mel_band_roformer_karaoke_gabox_v2.ckpt',\n", 147 | " 'MelBand Roformer | Karaoke by becruily' : 'mel_band_roformer_karaoke_becruily.ckpt',\n", 148 | " 'MelBand Roformer | Vocals by Kimberley Jensen' : 'vocals_mel_band_roformer.ckpt',\n", 149 | " 'MelBand Roformer Kim | FT by unwa' : 'mel_band_roformer_kim_ft_unwa.ckpt',\n", 150 | " 'MelBand Roformer Kim | FT 2 by unwa' : 'mel_band_roformer_kim_ft2_unwa.ckpt',\n", 151 | " 'MelBand Roformer Kim | FT 2 Bleedless by unwa' : 'mel_band_roformer_kim_ft2_bleedless_unwa.ckpt',\n", 152 | " 'MelBand Roformer Kim | FT 3 by unwa' : 'mel_band_roformer_kim_ft3_unwa.ckpt',\n", 153 | " 'MelBand Roformer Kim | Inst V1 by Unwa' : 'melband_roformer_inst_v1.ckpt',\n", 154 | " 'MelBand Roformer Kim | Inst V1 Plus by Unwa' : 'melband_roformer_inst_v1_plus.ckpt',\n", 155 | " 'MelBand Roformer Kim | Inst V1 (E) by Unwa' : 'melband_roformer_inst_v1e.ckpt',\n", 156 | " 'MelBand Roformer Kim | Inst V1 (E) Plus by Unwa' : 'melband_roformer_inst_v1e_plus.ckpt',\n", 157 | " 'MelBand Roformer Kim | Inst V2 by Unwa' : 'melband_roformer_inst_v2.ckpt',\n", 158 | " 'MelBand Roformer Kim | InstVoc Duality V1 by Unwa' : 'melband_roformer_instvoc_duality_v1.ckpt',\n", 159 | " 'MelBand Roformer Kim | InstVoc Duality V2 by Unwa' : 'melband_roformer_instvox_duality_v2.ckpt',\n", 160 | " 'MelBand Roformer | Vocals by becruily' : 'mel_band_roformer_vocals_becruily.ckpt',\n", 161 | " 'MelBand Roformer | Instrumental by becruily' : 'mel_band_roformer_instrumental_becruily.ckpt',\n", 162 | " 'MelBand Roformer | Vocals Fullness by Aname' : 'mel_band_roformer_vocal_fullness_aname.ckpt',\n", 163 | " 'BS Roformer | Vocals by Gabox' : 'bs_roformer_vocals_gabox.ckpt',\n", 164 | " 'MelBand Roformer | Vocals by Gabox' : 'mel_band_roformer_vocals_gabox.ckpt',\n", 165 | " 'MelBand Roformer | Vocals V2 by Gabox' : 'mel_band_roformer_vocals_v2_gabox.ckpt',\n", 166 | " 'MelBand Roformer | Vocals FV1 by Gabox' : 'mel_band_roformer_vocals_fv1_gabox.ckpt',\n", 167 | " 'MelBand Roformer | Vocals FV2 by Gabox' : 'mel_band_roformer_vocals_fv2_gabox.ckpt',\n", 168 | " 'MelBand Roformer | Vocals FV3 by Gabox' : 'mel_band_roformer_vocals_fv3_gabox.ckpt',\n", 169 | " 'MelBand Roformer | Vocals FV4 by Gabox' : 'mel_band_roformer_vocals_fv4_gabox.ckpt',\n", 170 | " 'MelBand Roformer | Vocals FV5 by Gabox' : 'mel_band_roformer_vocals_fv5_gabox.ckpt',\n", 171 | " 'MelBand Roformer | Vocals FV6 by Gabox' : 'mel_band_roformer_vocals_fv6_gabox.ckpt',\n", 172 | " 'MelBand Roformer | Instrumental by Gabox' : 'mel_band_roformer_instrumental_gabox.ckpt',\n", 173 | " 'MelBand Roformer | Instrumental 2 by Gabox' : 'mel_band_roformer_instrumental_2_gabox.ckpt',\n", 174 | " 'MelBand Roformer | Instrumental 3 by Gabox' : 'mel_band_roformer_instrumental_3_gabox.ckpt',\n", 175 | " 'MelBand Roformer | Instrumental Bleedless V1 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v1_gabox.ckpt',\n", 176 | " 'MelBand Roformer | Instrumental Bleedless V2 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v2_gabox.ckpt',\n", 177 | " 'MelBand Roformer | Instrumental Bleedless V3 by Gabox' : 'mel_band_roformer_instrumental_bleedless_v3_gabox.ckpt',\n", 178 | " 'MelBand Roformer | Instrumental Fullness V1 by Gabox' : 'mel_band_roformer_instrumental_fullness_v1_gabox.ckpt',\n", 179 | " 'MelBand Roformer | Instrumental Fullness V2 by Gabox' : 'mel_band_roformer_instrumental_fullness_v2_gabox.ckpt',\n", 180 | " 'MelBand Roformer | Instrumental Fullness V3 by Gabox' : 'mel_band_roformer_instrumental_fullness_v3_gabox.ckpt',\n", 181 | " 'MelBand Roformer | Instrumental Fullness Noisy V4 by Gabox' : 'mel_band_roformer_instrumental_fullness_noise_v4_gabox.ckpt',\n", 182 | " 'MelBand Roformer | INSTV5 by Gabox' : 'mel_band_roformer_instrumental_instv5_gabox.ckpt',\n", 183 | " 'MelBand Roformer | INSTV5N by Gabox' : 'mel_band_roformer_instrumental_instv5n_gabox.ckpt',\n", 184 | " 'MelBand Roformer | INSTV6 by Gabox' : 'mel_band_roformer_instrumental_instv6_gabox.ckpt',\n", 185 | " 'MelBand Roformer | INSTV6N by Gabox' : 'mel_band_roformer_instrumental_instv6n_gabox.ckpt',\n", 186 | " 'MelBand Roformer | INSTV7 by Gabox' : 'mel_band_roformer_instrumental_instv7_gabox.ckpt',\n", 187 | " 'MelBand Roformer | INSTV7N by Gabox' : 'mel_band_roformer_instrumental_instv7n_gabox.ckpt',\n", 188 | " 'MelBand Roformer | INSTV8 by Gabox' : 'mel_band_roformer_instrumental_instv8_gabox.ckpt',\n", 189 | " 'MelBand Roformer | INSTV8N by Gabox' : 'mel_band_roformer_instrumental_instv8n_gabox.ckpt',\n", 190 | " 'MelBand Roformer | Instrumental FV7z by Gabox' : 'mel_band_roformer_instrumental_fv7z_gabox.ckpt',\n", 191 | " 'MelBand Roformer | Instrumental FV8 by Gabox' : 'mel_band_roformer_instrumental_fv8_gabox.ckpt',\n", 192 | " 'MelBand Roformer | Instrumental FVX by Gabox' : 'mel_band_roformer_instrumental_fvx_gabox.ckpt',\n", 193 | " 'MelBand Roformer | De-Reverb by anvuew' : 'dereverb_mel_band_roformer_anvuew_sdr_19.1729.ckpt',\n", 194 | " 'MelBand Roformer | De-Reverb Less Aggressive by anvuew' : 'dereverb_mel_band_roformer_less_aggressive_anvuew_sdr_18.8050.ckpt',\n", 195 | " 'MelBand Roformer | De-Reverb Mono by anvuew' : 'dereverb_mel_band_roformer_mono_anvuew.ckpt',\n", 196 | " 'MelBand Roformer | De-Reverb Big by Sucial' : 'dereverb_big_mbr_ep_362.ckpt',\n", 197 | " 'MelBand Roformer | De-Reverb Super Big by Sucial' : 'dereverb_super_big_mbr_ep_346.ckpt',\n", 198 | " 'MelBand Roformer | De-Reverb-Echo by Sucial' : 'dereverb-echo_mel_band_roformer_sdr_10.0169.ckpt',\n", 199 | " 'MelBand Roformer | De-Reverb-Echo V2 by Sucial' : 'dereverb-echo_mel_band_roformer_sdr_13.4843_v2.ckpt',\n", 200 | " 'MelBand Roformer | De-Reverb-Echo Fused by Sucial' : 'dereverb_echo_mbr_fused.ckpt',\n", 201 | " 'MelBand Roformer Kim | SYHFT by SYH99999' : 'MelBandRoformerSYHFT.ckpt',\n", 202 | " 'MelBand Roformer Kim | SYHFT V2 by SYH99999' : 'MelBandRoformerSYHFTV2.ckpt',\n", 203 | " 'MelBand Roformer Kim | SYHFT V2.5 by SYH99999' : 'MelBandRoformerSYHFTV2.5.ckpt',\n", 204 | " 'MelBand Roformer Kim | SYHFT V3 by SYH99999' : 'MelBandRoformerSYHFTV3Epsilon.ckpt',\n", 205 | " 'MelBand Roformer Kim | Big SYHFT V1 by SYH99999' : 'MelBandRoformerBigSYHFTV1.ckpt',\n", 206 | " 'MelBand Roformer Kim | Big Beta 4 FT by unwa' : 'melband_roformer_big_beta4.ckpt',\n", 207 | " 'MelBand Roformer Kim | Big Beta 5e FT by unwa' : 'melband_roformer_big_beta5e.ckpt',\n", 208 | " 'MelBand Roformer | Big Beta 6 by unwa' : 'melband_roformer_big_beta6.ckpt',\n", 209 | " 'MelBand Roformer | Big Beta 6X by unwa' : 'melband_roformer_big_beta6x.ckpt',\n", 210 | " 'BS Roformer | Vocals Revive by Unwa' : 'bs_roformer_vocals_revive_unwa.ckpt',\n", 211 | " 'BS Roformer | Vocals Revive V2 by Unwa' : 'bs_roformer_vocals_revive_v2_unwa.ckpt',\n", 212 | " 'BS Roformer | Vocals Revive V3e by Unwa' : 'bs_roformer_vocals_revive_v3e_unwa.ckpt',\n", 213 | " 'BS Roformer | Chorus Male-Female by Sucial' : 'model_chorus_bs_roformer_ep_267_sdr_24.1275.ckpt',\n", 214 | " 'BS Roformer | Male-Female by aufr33' : 'bs_roformer_male_female_by_aufr33_sdr_7.2889.ckpt',\n", 215 | " 'MelBand Roformer | Aspiration by Sucial' : 'aspiration_mel_band_roformer_sdr_18.9845.ckpt',\n", 216 | " 'MelBand Roformer | Aspiration Less Aggressive by Sucial' : 'aspiration_mel_band_roformer_less_aggr_sdr_18.1201.ckpt',\n", 217 | " 'MelBand Roformer | Bleed Suppressor V1 by unwa-97chris' : 'mel_band_roformer_bleed_suppressor_v1.ckpt',\n", 218 | " 'BS Roformer | Vocals Resurrection by unwa' : 'bs_roformer_vocals_resurrection_unwa.ckpt',\n", 219 | " 'BS Roformer | Instrumental Resurrection by unwa' : 'bs_roformer_instrumental_resurrection_unwa.ckpt'\n", 220 | " }\n", 221 | "\n", 222 | " roformer_model = dictmodel[model]\n", 223 | "\n", 224 | " if checker(audio_input):\n", 225 | " downloader(audio_input)\n", 226 | " audio_input = f\"{path}/temp\"\n", 227 | "\n", 228 | " for audio_files in os.listdir(audio_input):\n", 229 | " if audio_files.endswith(extensions):\n", 230 | " found_files.append(audio_files)\n", 231 | "\n", 232 | " total_files = len(found_files)\n", 233 | "\n", 234 | " if total_files == 0:\n", 235 | " print(\"No valid audio files found.\")\n", 236 | " else:\n", 237 | " print(f\"{total_files} audio files found\")\n", 238 | "\n", 239 | " found_files.sort()\n", 240 | "\n", 241 | " for audio_files in found_files:\n", 242 | " file_path = os.path.join(audio_input, audio_files)\n", 243 | " prompt = f'audio-separator \"{file_path}\" --model_filename {roformer_model} --output_dir={output_folder} --output_format={output_format} --mdxc_segment_size={segment_size} --mdxc_overlap={overlap} --mdxc_batch_size={batch_size} --model_file_dir=./models'\n", 244 | " if override_model_segment_size:\n", 245 | " prompt += \" --mdxc_override_model_segment_size\"\n", 246 | " if use_autocast:\n", 247 | " prompt += \" --use_autocast\"\n", 248 | " !$prompt\n", 249 | "\n", 250 | " if audio_input == f\"{path}/temp\":\n", 251 | " temp_files = glob.glob(f\"{path}/temp/*\")\n", 252 | " for file in temp_files:\n", 253 | " os.remove(file)\n", 254 | "\n", 255 | "#@markdown Input path for audio files or link:\n", 256 | "audio_input = \"Place the path or link here\" #@param {type:\"string\"}\n", 257 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 258 | "\n", 259 | "#@markdown Output path for audio files:\n", 260 | "output_folder = \"/content/drive/MyDrive/Vocales\" #@param {type:\"string\"}\n", 261 | "#@markdown Select the model:\n", 262 | "model = \"BS-Roformer-Viperx-1297\" #@param [\"BS-Roformer-Viperx-1297\", \"BS-Roformer-Viperx-1296\", \"BS-Roformer-Viperx-1053\", \"Mel-Roformer-Viperx-1143\", \"BS-Roformer-De-Reverb\", \"Mel-Roformer-Crowd-Aufr33-Viperx\", \"Mel-Roformer-Denoise-Aufr33\", \"Mel-Roformer-Denoise-Aufr33-Aggr\", \"MelBand Roformer | Denoise-Debleed by Gabox\", \"Mel-Roformer-Karaoke-Aufr33-Viperx\", \"MelBand Roformer | Karaoke by Gabox\", \"MelBand Roformer | Karaoke V2 by Gabox\", \"MelBand Roformer | Karaoke by becruily\", \"MelBand Roformer | Vocals by Kimberley Jensen\", \"MelBand Roformer Kim | FT by unwa\", \"MelBand Roformer Kim | FT 2 by unwa\", \"MelBand Roformer Kim | FT 2 Bleedless by unwa\", \"MelBand Roformer Kim | FT 3 by unwa\", \"MelBand Roformer Kim | Inst V1 by Unwa\", \"MelBand Roformer Kim | Inst V1 Plus by Unwa\", \"MelBand Roformer Kim | Inst V1 (E) by Unwa\", \"MelBand Roformer Kim | Inst V1 (E) Plus by Unwa\", \"MelBand Roformer Kim | Inst V2 by Unwa\", \"MelBand Roformer Kim | InstVoc Duality V1 by Unwa\", \"MelBand Roformer Kim | InstVoc Duality V2 by Unwa\", \"MelBand Roformer | Vocals by becruily\", \"MelBand Roformer | Instrumental by becruily\", \"MelBand Roformer | Vocals Fullness by Aname\", \"BS Roformer | Vocals by Gabox\", \"MelBand Roformer | Vocals by Gabox\", \"MelBand Roformer | Vocals V2 by Gabox\", \"MelBand Roformer | Vocals FV1 by Gabox\", \"MelBand Roformer | Vocals FV2 by Gabox\", \"MelBand Roformer | Vocals FV3 by Gabox\", \"MelBand Roformer | Vocals FV4 by Gabox\", \"MelBand Roformer | Vocals FV5 by Gabox\", \"MelBand Roformer | Vocals FV6 by Gabox\", \"MelBand Roformer | Instrumental by Gabox\", \"MelBand Roformer | Instrumental 2 by Gabox\", \"MelBand Roformer | Instrumental 3 by Gabox\", \"MelBand Roformer | Instrumental Bleedless V1 by Gabox\", \"MelBand Roformer | Instrumental Bleedless V2 by Gabox\", \"MelBand Roformer | Instrumental Bleedless V3 by Gabox\", \"MelBand Roformer | Instrumental Fullness V1 by Gabox\", \"MelBand Roformer | Instrumental Fullness V2 by Gabox\", \"MelBand Roformer | Instrumental Fullness V3 by Gabox\", \"MelBand Roformer | Instrumental Fullness Noisy V4 by Gabox\", \"MelBand Roformer | INSTV5 by Gabox\", \"MelBand Roformer | INSTV5N by Gabox\", \"MelBand Roformer | INSTV6 by Gabox\", \"MelBand Roformer | INSTV6N by Gabox\", \"MelBand Roformer | INSTV7 by Gabox\", \"MelBand Roformer | INSTV7N by Gabox\", \"MelBand Roformer | INSTV8 by Gabox\", \"MelBand Roformer | INSTV8N by Gabox\", \"MelBand Roformer | Instrumental FV7z by Gabox\", \"MelBand Roformer | Instrumental FV8 by Gabox\", \"MelBand Roformer | Instrumental FVX by Gabox\", \"MelBand Roformer | De-Reverb by anvuew\", \"MelBand Roformer | De-Reverb Less Aggressive by anvuew\", \"MelBand Roformer | De-Reverb Mono by anvuew\", \"MelBand Roformer | De-Reverb Big by Sucial\", \"MelBand Roformer | De-Reverb Super Big by Sucial\", \"MelBand Roformer | De-Reverb-Echo by Sucial\", \"MelBand Roformer | De-Reverb-Echo V2 by Sucial\", \"MelBand Roformer | De-Reverb-Echo Fused by Sucial\", \"MelBand Roformer Kim | SYHFT by SYH99999\", \"MelBand Roformer Kim | SYHFT V2 by SYH99999\", \"MelBand Roformer Kim | SYHFT V2.5 by SYH99999\", \"MelBand Roformer Kim | SYHFT V3 by SYH99999\", \"MelBand Roformer Kim | Big SYHFT V1 by SYH99999\", \"MelBand Roformer Kim | Big Beta 4 FT by unwa\", \"MelBand Roformer Kim | Big Beta 5e FT by unwa\", \"MelBand Roformer | Big Beta 6 by unwa\", \"MelBand Roformer | Big Beta 6X by unwa\", \"BS Roformer | Vocals Revive by Unwa\", \"BS Roformer | Vocals Revive V2 by Unwa\", \"BS Roformer | Vocals Revive V3e by Unwa\", \"BS Roformer | Chorus Male-Female by Sucial\", \"BS Roformer | Male-Female by aufr33\", \"MelBand Roformer | Aspiration by Sucial\", \"MelBand Roformer | Aspiration Less Aggressive by Sucial\", \"MelBand Roformer | Bleed Suppressor V1 by unwa-97chris\", \"BS Roformer | Vocals Resurrection by unwa\", \"BS Roformer | Instrumental Resurrection by unwa\"]\n", 263 | "#@markdown Select the output format:\n", 264 | "output_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 265 | "#@markdown Larger consumes more resources, but may give better results.\n", 266 | "segment_size = 256 #@param {type:\"slider\", min:32, max:4000, step:32}\n", 267 | "#@markdown Amount of overlap between prediction windows.\n", 268 | "overlap = 8 #@param {type:\"slider\", min:2, max:10, step:1}\n", 269 | "#@markdown Larger consumes more RAM but may process slightly faster.\n", 270 | "batch_size = 1 #@param {type:\"slider\", min:1, max:16, step:1}\n", 271 | "#@markdown Override model default segment size instead of using the model default value.\n", 272 | "override_model_segment_size = False #@param {type:\"boolean\"}\n", 273 | "#@markdown Flag to use PyTorch autocast for faster inference. Do not use for CPU inference.\n", 274 | "use_autocast = True #@param {type:\"boolean\"}\n", 275 | "extensions = (\".wav\", \".flac\", \".mp3\", \".ogg\", \".opus\", \".m4a\", \".aiff\", \".ac3\")\n", 276 | "\n", 277 | "uvr_cli(audio_input, output_folder, model, output_format, segment_size, overlap, batch_size, override_model_segment_size, use_autocast, extensions)" 278 | ] 279 | }, 280 | { 281 | "cell_type": "markdown", 282 | "metadata": { 283 | "id": "9_M-59vjldCM" 284 | }, 285 | "source": [ 286 | "### ***MDX23C***" 287 | ] 288 | }, 289 | { 290 | "cell_type": "code", 291 | "execution_count": null, 292 | "metadata": { 293 | "cellView": "form", 294 | "id": "PSFkReI1dvLf" 295 | }, 296 | "outputs": [], 297 | "source": [ 298 | "#@markdown #**Separation! MDX23C Only**\n", 299 | "import os\n", 300 | "import glob\n", 301 | "import yt_dlp\n", 302 | "\n", 303 | "def downloader(url):\n", 304 | " ydl_opts = {\n", 305 | " 'format': 'bestaudio/best',\n", 306 | " 'postprocessors': [{\n", 307 | " 'key': 'FFmpegExtractAudio',\n", 308 | " 'preferredcodec': 'wav',\n", 309 | " 'preferredquality': '192',\n", 310 | " }],\n", 311 | " 'outtmpl': os.path.join(f'{path}/temp', '%(title)s.%(ext)s'),\n", 312 | " }\n", 313 | "\n", 314 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 315 | " ydl.download([url])\n", 316 | "\n", 317 | "def checker(url):\n", 318 | " return \"http\" in url\n", 319 | "\n", 320 | "def uvr_cli(audio_input, output_folder, model, output_format, segment_size, overlap, batch_size, override_model_segment_size, use_autocast, extensions):\n", 321 | " found_files = []\n", 322 | "\n", 323 | " if checker(audio_input):\n", 324 | " downloader(audio_input)\n", 325 | " audio_input = f\"{path}/temp\"\n", 326 | "\n", 327 | " for audio_files in os.listdir(audio_input):\n", 328 | " if audio_files.endswith(extensions):\n", 329 | " found_files.append(audio_files)\n", 330 | "\n", 331 | " total_files = len(found_files)\n", 332 | "\n", 333 | " if total_files == 0:\n", 334 | " print(\"No valid audio files found.\")\n", 335 | " else:\n", 336 | " print(f\"{total_files} audio files found\")\n", 337 | "\n", 338 | " found_files.sort()\n", 339 | "\n", 340 | " for audio_files in found_files:\n", 341 | " file_path = os.path.join(audio_input, audio_files)\n", 342 | " prompt = f'audio-separator \"{file_path}\" --model_filename {model} --output_dir={output_folder} --output_format={output_format} --mdxc_segment_size={segment_size} --mdxc_overlap={overlap} --mdxc_batch_size={batch_size} --model_file_dir=./models'\n", 343 | " if override_model_segment_size:\n", 344 | " prompt += \" --mdxc_override_model_segment_size\"\n", 345 | " if use_autocast:\n", 346 | " prompt += \" --use_autocast\"\n", 347 | " !$prompt\n", 348 | "\n", 349 | " if audio_input == f\"{path}/temp\":\n", 350 | " temp_files = glob.glob(f\"{path}/temp/*\")\n", 351 | " for file in temp_files:\n", 352 | " os.remove(file)\n", 353 | "\n", 354 | "#@markdown Input path for audio files or link:\n", 355 | "audio_input = \"Place the path or link here\" #@param {type:\"string\"}\n", 356 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 357 | "\n", 358 | "#@markdown Output path for audio files:\n", 359 | "output_folder = \"/content/drive/MyDrive/Vocales\" #@param {type:\"string\"}\n", 360 | "#@markdown Select the model:\n", 361 | "model = \"MDX23C-8KFFT-InstVoc_HQ_2.ckpt\" #@param [\"MDX23C_D1581.ckpt\", \"MDX23C-8KFFT-InstVoc_HQ.ckpt\", \"MDX23C-8KFFT-InstVoc_HQ_2.ckpt\", \"MDX23C-De-Reverb-aufr33-jarredou.ckpt\", \"MDX23C-DrumSep-aufr33-jarredou.ckpt\"]\n", 362 | "#@markdown Select the output format:\n", 363 | "output_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 364 | "#@markdown Larger consumes more resources, but may give better results.\n", 365 | "segment_size = 256 #@param {type:\"slider\", min:32, max:4000, step:32}\n", 366 | "#@markdown Amount of overlap between prediction windows.\n", 367 | "overlap = 8 #@param {type:\"slider\", min:2, max:50, step:1}\n", 368 | "#@markdown Larger consumes more RAM but may process slightly faster.\n", 369 | "batch_size = 1 #@param {type:\"slider\", min:1, max:16, step:1}\n", 370 | "#@markdown Override model default segment size instead of using the model default value.\n", 371 | "override_model_segment_size = False #@param {type:\"boolean\"}\n", 372 | "#@markdown Flag to use PyTorch autocast for faster inference. Do not use for CPU inference.\n", 373 | "use_autocast = True #@param {type:\"boolean\"}\n", 374 | "extensions = (\".wav\", \".flac\", \".mp3\", \".ogg\", \".opus\", \".m4a\", \".aiff\", \".ac3\")\n", 375 | "\n", 376 | "uvr_cli(audio_input, output_folder, model, output_format, segment_size, overlap, batch_size, override_model_segment_size, use_autocast, extensions)" 377 | ] 378 | }, 379 | { 380 | "cell_type": "markdown", 381 | "metadata": { 382 | "id": "giSk8me-lfIB" 383 | }, 384 | "source": [ 385 | "### ***MDX-NET***" 386 | ] 387 | }, 388 | { 389 | "cell_type": "code", 390 | "execution_count": null, 391 | "metadata": { 392 | "cellView": "form", 393 | "id": "IPHGUkIv4I69" 394 | }, 395 | "outputs": [], 396 | "source": [ 397 | "#@markdown #**Separation! MDX-NET Only**\n", 398 | "import os\n", 399 | "import glob\n", 400 | "import yt_dlp\n", 401 | "\n", 402 | "def downloader(url):\n", 403 | " ydl_opts = {\n", 404 | " 'format': 'bestaudio/best',\n", 405 | " 'postprocessors': [{\n", 406 | " 'key': 'FFmpegExtractAudio',\n", 407 | " 'preferredcodec': 'wav',\n", 408 | " 'preferredquality': '192',\n", 409 | " }],\n", 410 | " 'outtmpl': os.path.join(f'{path}/temp', '%(title)s.%(ext)s'),\n", 411 | " }\n", 412 | "\n", 413 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 414 | " ydl.download([url])\n", 415 | "\n", 416 | "def checker(url):\n", 417 | " return \"http\" in url\n", 418 | "\n", 419 | "def uvr_cli(audio_input, output_folder, extensions, output_format, model, hop_length, segment_size, denoise, overlap, batch_size, use_autocast):\n", 420 | " found_files = []\n", 421 | "\n", 422 | " if checker(audio_input):\n", 423 | " downloader(audio_input)\n", 424 | " audio_input = f\"{path}/temp\"\n", 425 | "\n", 426 | " for audio_files in os.listdir(audio_input):\n", 427 | " if audio_files.endswith(extensions):\n", 428 | " found_files.append(audio_files)\n", 429 | "\n", 430 | " total_files = len(found_files)\n", 431 | "\n", 432 | " if total_files == 0:\n", 433 | " print(\"No valid audio files found.\")\n", 434 | " else:\n", 435 | " print(f\"{total_files} audio files found\")\n", 436 | "\n", 437 | " found_files.sort()\n", 438 | "\n", 439 | " for audio_files in found_files:\n", 440 | " file_path = os.path.join(audio_input, audio_files)\n", 441 | " prompt = f'audio-separator \"{file_path}\" --model_filename {model} --output_dir={output_folder} --output_format={output_format} --mdx_hop_length={hop_length} --mdx_segment_size={segment_size} --mdx_overlap={overlap} --mdx_batch_size={batch_size} --model_file_dir=./models'\n", 442 | " if denoise:\n", 443 | " prompt += \" --mdx_enable_denoise\"\n", 444 | " if use_autocast:\n", 445 | " prompt += \" --use_autocast\"\n", 446 | " !$prompt\n", 447 | "\n", 448 | " if audio_input == f\"{path}/temp\":\n", 449 | " temp_files = glob.glob(f\"{path}/temp/*\")\n", 450 | " for file in temp_files:\n", 451 | " os.remove(file)\n", 452 | "\n", 453 | "#@markdown Input path for audio files or link:\n", 454 | "audio_input = \"Place the path or link here\" #@param {type:\"string\"}\n", 455 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 456 | "\n", 457 | "#@markdown Output path for audio files:\n", 458 | "output_folder = \"/content/drive/MyDrive/Vocales\" #@param {type:\"string\"}\n", 459 | "#@markdown Select the model:\n", 460 | "model = \"UVR-MDX-NET-Inst_HQ_5.onnx\" #@param [\"UVR-MDX-NET-Inst_full_292.onnx\", \"UVR-MDX-NET_Inst_187_beta.onnx\", \"UVR-MDX-NET_Inst_82_beta.onnx\", \"UVR-MDX-NET_Inst_90_beta.onnx\", \"UVR-MDX-NET_Main_340.onnx\", \"UVR-MDX-NET_Main_390.onnx\", \"UVR-MDX-NET_Main_406.onnx\", \"UVR-MDX-NET_Main_427.onnx\", \"UVR-MDX-NET_Main_438.onnx\", \"UVR-MDX-NET-Inst_HQ_1.onnx\", \"UVR-MDX-NET-Inst_HQ_2.onnx\", \"UVR-MDX-NET-Inst_HQ_3.onnx\", \"UVR-MDX-NET-Inst_HQ_4.onnx\", \"UVR-MDX-NET-Inst_HQ_5.onnx\", \"UVR_MDXNET_Main.onnx\", \"UVR-MDX-NET-Inst_Main.onnx\", \"UVR_MDXNET_1_9703.onnx\", \"UVR_MDXNET_2_9682.onnx\", \"UVR_MDXNET_3_9662.onnx\", \"UVR-MDX-NET-Inst_1.onnx\", \"UVR-MDX-NET-Inst_2.onnx\", \"UVR-MDX-NET-Inst_3.onnx\", \"UVR_MDXNET_KARA.onnx\", \"UVR_MDXNET_KARA_2.onnx\", \"UVR_MDXNET_9482.onnx\", \"UVR-MDX-NET-Voc_FT.onnx\", \"Kim_Vocal_1.onnx\", \"Kim_Vocal_2.onnx\", \"Kim_Inst.onnx\", \"Reverb_HQ_By_FoxJoy.onnx\", \"UVR-MDX-NET_Crowd_HQ_1.onnx\", \"kuielab_a_vocals.onnx\", \"kuielab_a_other.onnx\", \"kuielab_a_bass.onnx\", \"kuielab_a_drums.onnx\", \"kuielab_b_vocals.onnx\", \"kuielab_b_other.onnx\", \"kuielab_b_bass.onnx\", \"kuielab_b_drums.onnx\"]\n", 461 | "#@markdown Select the output format:\n", 462 | "output_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 463 | "#@markdown Usually called stride in neural networks; only change if you know what you're doing.\n", 464 | "hop_length = 1024 #@param {type:\"slider\", min:32, max:2048, step:32}\n", 465 | "#@markdown Larger consumes more resources, but may give better results.\n", 466 | "segment_size = 256 #@param {type:\"slider\", min:32, max:4000, step:32}\n", 467 | "#@markdown Amount of overlap between prediction windows.\n", 468 | "overlap = \"0.25\" #@param [\"0.25\", \"0.5\", \"0.75\", \"0.99\"]\n", 469 | "#@markdown Larger consumes more RAM but may process slightly faster.\n", 470 | "batch_size = 1 #@param {type:\"slider\", min:1, max:16, step:1}\n", 471 | "#@markdown Enable denoising during separation.\n", 472 | "denoise = True #@param {type:\"boolean\"}\n", 473 | "#@markdown Flag to use PyTorch autocast for faster inference. Do not use for CPU inference.\n", 474 | "use_autocast = True #@param {type:\"boolean\"}\n", 475 | "extensions = (\".wav\", \".flac\", \".mp3\", \".ogg\", \".opus\", \".m4a\", \".aiff\", \".ac3\")\n", 476 | "\n", 477 | "uvr_cli(audio_input, output_folder, extensions, output_format, model, hop_length, segment_size, denoise, overlap, batch_size, use_autocast)" 478 | ] 479 | }, 480 | { 481 | "cell_type": "markdown", 482 | "metadata": { 483 | "id": "X9-v4bEoljnZ" 484 | }, 485 | "source": [ 486 | "### ***VR ARCH***" 487 | ] 488 | }, 489 | { 490 | "cell_type": "code", 491 | "execution_count": null, 492 | "metadata": { 493 | "cellView": "form", 494 | "id": "pGMu6wONTZe5" 495 | }, 496 | "outputs": [], 497 | "source": [ 498 | "#@markdown #**Separation! VR ARCH Only**\n", 499 | "import os\n", 500 | "import glob\n", 501 | "import yt_dlp\n", 502 | "\n", 503 | "def downloader(url):\n", 504 | " ydl_opts = {\n", 505 | " 'format': 'bestaudio/best',\n", 506 | " 'postprocessors': [{\n", 507 | " 'key': 'FFmpegExtractAudio',\n", 508 | " 'preferredcodec': 'wav',\n", 509 | " 'preferredquality': '192',\n", 510 | " }],\n", 511 | " 'outtmpl': os.path.join(f'{path}/temp', '%(title)s.%(ext)s'),\n", 512 | " }\n", 513 | "\n", 514 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 515 | " ydl.download([url])\n", 516 | "\n", 517 | "def checker(url):\n", 518 | " return \"http\" in url\n", 519 | "\n", 520 | "def uvr_cli(audio_input, output_folder, extensions, output_format, model, window_size, aggression, tta , high_end_process, batch_size, use_autocast):\n", 521 | " found_files = []\n", 522 | "\n", 523 | " if checker(audio_input):\n", 524 | " downloader(audio_input)\n", 525 | " audio_input = f\"{path}/temp\"\n", 526 | "\n", 527 | " for audio_files in os.listdir(audio_input):\n", 528 | " if audio_files.endswith(extensions):\n", 529 | " found_files.append(audio_files)\n", 530 | "\n", 531 | " total_files = len(found_files)\n", 532 | "\n", 533 | " if total_files == 0:\n", 534 | " print(\"No valid audio files found.\")\n", 535 | " else:\n", 536 | " print(f\"{total_files} audio files found\")\n", 537 | "\n", 538 | " found_files.sort()\n", 539 | "\n", 540 | " for audio_files in found_files:\n", 541 | " file_path = os.path.join(audio_input, audio_files)\n", 542 | " prompt = f'audio-separator \"{file_path}\" --model_filename {model} --output_dir={output_folder} --output_format={output_format} --vr_window_size={window_size} --vr_aggression={aggression} --vr_batch_size={batch_size} --model_file_dir=./models'\n", 543 | " if tta:\n", 544 | " prompt += \" --vr_enable_tta\"\n", 545 | " if high_end_process:\n", 546 | " prompt += \" --vr_high_end_process\"\n", 547 | " if use_autocast:\n", 548 | " prompt += \" --use_autocast\"\n", 549 | " !$prompt\n", 550 | "\n", 551 | " if audio_input == f\"{path}/temp\":\n", 552 | " temp_files = glob.glob(f\"{path}/temp/*\")\n", 553 | " for file in temp_files:\n", 554 | " os.remove(file)\n", 555 | "\n", 556 | "#@markdown Input path for audio files or link:\n", 557 | "audio_input = \"Place the path or link here\" #@param {type:\"string\"}\n", 558 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 559 | "\n", 560 | "#@markdown Output path for audio files:\n", 561 | "output_folder = \"/content/drive/MyDrive/Vocales\" #@param {type:\"string\"}\n", 562 | "#@markdown Select the model:\n", 563 | "model = \"UVR-DeEcho-DeReverb.pth\" #@param [\"1_HP-UVR.pth\", \"2_HP-UVR.pth\", \"3_HP-Vocal-UVR.pth\", \"4_HP-Vocal-UVR.pth\", \"5_HP-Karaoke-UVR.pth\", \"6_HP-Karaoke-UVR.pth\", \"7_HP2-UVR.pth\", \"8_HP2-UVR.pth\", \"9_HP2-UVR.pth\", \"10_SP-UVR-2B-32000-1.pth\", \"11_SP-UVR-2B-32000-2.pth\", \"12_SP-UVR-3B-44100.pth\", \"13_SP-UVR-4B-44100-1.pth\", \"14_SP-UVR-4B-44100-2.pth\", \"15_SP-UVR-MID-44100-1.pth\", \"16_SP-UVR-MID-44100-2.pth\", \"17_HP-Wind_Inst-UVR.pth\", \"UVR-De-Echo-Aggressive.pth\", \"UVR-De-Echo-Normal.pth\", \"UVR-DeEcho-DeReverb.pth\", \"UVR-De-Reverb-aufr33-jarredou.pth\", \"UVR-DeNoise-Lite.pth\", \"UVR-DeNoise.pth\", \"UVR-BVE-4B_SN-44100-1.pth\", \"UVR-BVE-4B_SN-44100-2.pth\", \"MGM_HIGHEND_v4.pth\", \"MGM_LOWEND_A_v4.pth\", \"MGM_LOWEND_B_v4.pth\", \"MGM_MAIN_v4.pth\"]\n", 564 | "#@markdown Select the output format:\n", 565 | "output_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 566 | "#@markdown Lower window size yield a higher output quality, but will take longer to process.\n", 567 | "window_size = 512 #@param {type:\"slider\", min:320, max:1024, step:32}\n", 568 | "#@markdown Intensity of primary stem extraction.\n", 569 | "aggression = 5 #@param {type:\"slider\", min:1, max:50, step:1}\n", 570 | "#@markdown Larger consumes more RAM but may process slightly faster.\n", 571 | "batch_size = 1 #@param {type:\"slider\", min:1, max:16, step:1}\n", 572 | "#@markdown Enable Test-Time-Augmentation; slow but improves quality.\n", 573 | "tta = True #@param {type:\"boolean\"}\n", 574 | "#@markdown Mirror the missing frequency range of the output.\n", 575 | "high_end_process = False #@param {type:\"boolean\"}\n", 576 | "#@markdown Flag to use PyTorch autocast for faster inference. Do not use for CPU inference.\n", 577 | "use_autocast = True #@param {type:\"boolean\"}\n", 578 | "extensions = (\".wav\", \".flac\", \".mp3\", \".ogg\", \".opus\", \".m4a\", \".aiff\", \".ac3\")\n", 579 | "\n", 580 | "uvr_cli(audio_input, output_folder, extensions, output_format, model, window_size, aggression, tta , high_end_process, batch_size, use_autocast)" 581 | ] 582 | }, 583 | { 584 | "cell_type": "markdown", 585 | "metadata": { 586 | "id": "hhTzzzCLlqtq" 587 | }, 588 | "source": [ 589 | "### ***Demucs***" 590 | ] 591 | }, 592 | { 593 | "cell_type": "code", 594 | "execution_count": null, 595 | "metadata": { 596 | "cellView": "form", 597 | "id": "p7KBCHk9ZOYj" 598 | }, 599 | "outputs": [], 600 | "source": [ 601 | "#@markdown #**Separation! Demucs Only**\n", 602 | "import os\n", 603 | "import glob\n", 604 | "import yt_dlp\n", 605 | "\n", 606 | "def downloader(url):\n", 607 | " ydl_opts = {\n", 608 | " 'format': 'bestaudio/best',\n", 609 | " 'postprocessors': [{\n", 610 | " 'key': 'FFmpegExtractAudio',\n", 611 | " 'preferredcodec': 'wav',\n", 612 | " 'preferredquality': '192',\n", 613 | " }],\n", 614 | " 'outtmpl': os.path.join(f'{path}/temp', '%(title)s.%(ext)s'),\n", 615 | " }\n", 616 | "\n", 617 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 618 | " ydl.download([url])\n", 619 | "\n", 620 | "def checker(url):\n", 621 | " return \"http\" in url\n", 622 | "\n", 623 | "def uvr_cli(audio_input, output_folder, extensions, output_format, model, shifts, segment_size, overlap, use_autocast):\n", 624 | " found_files = []\n", 625 | "\n", 626 | " if checker(audio_input):\n", 627 | " downloader(audio_input)\n", 628 | " audio_input = f\"{path}/temp\"\n", 629 | "\n", 630 | " for audio_files in os.listdir(audio_input):\n", 631 | " if audio_files.endswith(extensions):\n", 632 | " found_files.append(audio_files)\n", 633 | "\n", 634 | " total_files = len(found_files)\n", 635 | "\n", 636 | " if total_files == 0:\n", 637 | " print(\"No valid audio files found.\")\n", 638 | " else:\n", 639 | " print(f\"{total_files} audio files found\")\n", 640 | "\n", 641 | " found_files.sort()\n", 642 | "\n", 643 | " for audio_files in found_files:\n", 644 | " file_path = os.path.join(audio_input, audio_files)\n", 645 | " if model == \"drumsep\":\n", 646 | " print(f\"Processing file: {audio_files}\")\n", 647 | " prompt = f'demucs --repo {path}/models --shifts={shifts} --overlap={overlap} -o {output_folder} -n drumsep \"{file_path}\"'\n", 648 | " !$prompt\n", 649 | " print(f\"File: {audio_files} processed!\")\n", 650 | " else:\n", 651 | " prompt = f'audio-separator \"{file_path}\" --model_filename {model} --output_dir={output_folder} --output_format={output_format} --demucs_shifts={shifts} --demucs_overlap={overlap} --demucs_segment_size={segment_size} --model_file_dir=./models'\n", 652 | " if use_autocast:\n", 653 | " prompt += \" --use_autocast\"\n", 654 | " !$prompt\n", 655 | "\n", 656 | " if audio_input == f\"{path}/temp\":\n", 657 | " temp_files = glob.glob(f\"{path}/temp/*\")\n", 658 | " for file in temp_files:\n", 659 | " os.remove(file)\n", 660 | "\n", 661 | "#@markdown Input path for audio files or link:\n", 662 | "audio_input = \"Place the path or link here\" #@param {type:\"string\"}\n", 663 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 664 | "\n", 665 | "#@markdown Output path for audio files:\n", 666 | "output_folder = \"/content/drive/MyDrive/Vocales\" #@param {type:\"string\"}\n", 667 | "#@markdown Select the model:\n", 668 | "model = \"htdemucs_ft.yaml\" #@param [\"drumsep\", \"htdemucs_ft.yaml\", \"htdemucs.yaml\", \"hdemucs_mmi.yaml\", \"htdemucs_6s.yaml\"]\n", 669 | "#@markdown Select the output format:\n", 670 | "output_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 671 | "#@markdown Number of predictions with random shifts, higher = slower but better quality.\n", 672 | "shifts = 2 #@param {type:\"slider\", min:1, max:20, step:1}\n", 673 | "#@markdown Amount of overlap between prediction windows.\n", 674 | "overlap = 0.025 #@param {type:\"slider\", min:0.001, max:0.999, step:0.001}\n", 675 | "#@markdown Larger consumes more resources, but may give better results.\n", 676 | "segment_size = 40 #@param {type:\"slider\", min:1, max:100, step:1}\n", 677 | "#@markdown Flag to use PyTorch autocast for faster inference. Do not use for CPU inference.\n", 678 | "use_autocast = True #@param {type:\"boolean\"}\n", 679 | "extensions = (\".wav\", \".flac\", \".mp3\", \".ogg\", \".opus\", \".m4a\", \".aiff\", \".ac3\")\n", 680 | "\n", 681 | "uvr_cli(audio_input, output_folder, extensions, output_format, model, shifts, segment_size, overlap, use_autocast)" 682 | ] 683 | }, 684 | { 685 | "cell_type": "markdown", 686 | "metadata": { 687 | "id": "eH6luhAlmbIj" 688 | }, 689 | "source": [ 690 | "# **Extra**\n", 691 | "Base code by [Blane187](https://github.com/Blane187)" 692 | ] 693 | }, 694 | { 695 | "cell_type": "code", 696 | "execution_count": null, 697 | "metadata": { 698 | "cellView": "form", 699 | "id": "ZlKpT54iqpsE" 700 | }, 701 | "outputs": [], 702 | "source": [ 703 | "#@markdown #**Audio Downloader for Separation**\n", 704 | "import os\n", 705 | "import yt_dlp\n", 706 | "\n", 707 | "#@markdown Link:\n", 708 | "video_url = \"https://youtu.be/L3P0LgwuPPo?si=8uQWCX9kiXgMxYdE\" #@param {type:\"string\"}\n", 709 | "#@markdown You can paste the link to the video/audio from many sites, check the complete list [here](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md)\n", 710 | "\n", 711 | "#@markdown Audio name:\n", 712 | "audio_name = \"Harenchi\" #@param {type:\"string\"}\n", 713 | "#@markdown Output path for downloaded audio file:\n", 714 | "save_folder = \"/content/drive/MyDrive/Separar\" #@param {type:\"string\"}\n", 715 | "#@markdown Select the output format:\n", 716 | "audio_format = \"wav\" #@param [\"wav\", \"flac\", \"mp3\", \"ogg\", \"opus\", \"m4a\", \"aiff\", \"ac3\"]\n", 717 | "\n", 718 | "def downloader(url, save_path, audio_format, audio_name):\n", 719 | " ydl_opts = {\n", 720 | " 'format': 'bestaudio/best',\n", 721 | " 'postprocessors': [{\n", 722 | " 'key': 'FFmpegExtractAudio',\n", 723 | " 'preferredcodec': audio_format,\n", 724 | " 'preferredquality': '192',\n", 725 | " }],\n", 726 | " 'outtmpl': save_path,\n", 727 | " }\n", 728 | "\n", 729 | " with yt_dlp.YoutubeDL(ydl_opts) as ydl:\n", 730 | " ydl.download([url])\n", 731 | "\n", 732 | "save_path = os.path.join(save_folder, audio_name)\n", 733 | "downloader(video_url, save_path, audio_format, audio_name)\n", 734 | "print(\"Download Complete!\")" 735 | ] 736 | } 737 | ], 738 | "metadata": { 739 | "accelerator": "GPU", 740 | "colab": { 741 | "gpuType": "T4", 742 | "private_outputs": true, 743 | "provenance": [], 744 | "include_colab_link": true 745 | }, 746 | "kernelspec": { 747 | "display_name": "Python 3", 748 | "name": "python3" 749 | }, 750 | "language_info": { 751 | "name": "python" 752 | } 753 | }, 754 | "nbformat": 4, 755 | "nbformat_minor": 0 756 | } --------------------------------------------------------------------------------