Skip to content

A simple cli tool to strip out vocals written in python

License

Notifications You must be signed in to change notification settings

Kelztergit/Karaokify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Karaokify

A simple CLI tool written in Python to strip out vocals from audio tracks, effectively creating a karaoke version of your favorite songs.

How It Works

Karaokify uses a technique called phase inversion to remove vocals from stereo audio tracks. It works by:

  1. Splitting the audio into left and right channels.
  2. Inverting the phase of the left channel.
  3. Recombining the channels into a mono track, where the vocals (usually centered) are significantly attenuated.

This results in that cheap old karaoke effect you've probably heard all too many times before.

Why It Works

This method is effective because it exploits the fact that vocals are typically centered in the stereo mix, while instruments are often panned to the left or right. By inverting the phase of one channel and combining it with the other, the central vocals cancel out due to phase interference, leaving behind the instrumental tracks.

When It Doesn’t Work

This technique may not be effective in the following scenarios:

  • Non-Centered Vocals: If the vocals are panned to one side, they will not be adequately removed.
  • Mono Tracks: If the audio is mono or does not have distinct left and right channels, phase inversion cannot be applied.
  • Instrumental Centering: If instrumental parts are also centered, they will be attenuated along with the vocals.
  • Uneven Mixing: Variations in how the original audio is mixed can impact the effectiveness of this method.

Getting started

To check for and install prerequisites before using the program for the first time run the setup.py script

i.e. python setup.py

This script will Install necessary Python packages (pydub, numpy) if they are not already installed. Check for the presence of ffmpeg and prompt you to install it if it's not found.

Usage

To process an audiofile and create a 'karaoke version', use the following command python karaokify.py InputFile.mp3

This will process the file and add the _karaoked suffix to the output file's name InputFile_karaoked.mp3.

If the Input file is located in a different location use the full location within quotation marks python karaokify.py "C:\MusicLocation\InputFile.mp3" It will output the song next to it.

If you wish to specify a different name for the output file you can use the --output option

e.g. python karaokify.py InputFile.mp3 --output CustomName

Which would then output CustomName.mp3

If you wish to specify a different output format than mp3, which is the default, you can do this using the --format option Which would let you pick, according to the pydub documentations, "anything ffmpeg supports" but most importantly, formats like wav, flac, ogg and mp3 are all supported. E.g. python karaokify.py InputFile.mp3 --format ogg would output InputFile_karaoked.ogg

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

About

A simple cli tool to strip out vocals written in python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages