Skip to content

`MusicTools` is a Python class that provides tools for working with music files. It includes functionality for finding the BPM (Beats Per Minute), detecting the key of a song, and extracting vocals and beats.

License

HayatiYrtgl/MusicTools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation


MusicTools

Introduction

MusicTools is a Python class that provides tools for working with music files. It includes functionality for finding the BPM (Beats Per Minute), detecting the key of a song, and extracting vocals and beats.

Installation

To use the MusicTools class, you need to have the following Python libraries installed:

You can install these libraries using the following command:

pip install librosa numpy soundfile

Usage

To use the MusicTools class, follow these steps:

  1. Import the class:
from music_tools import MusicTools
  1. Create an instance of the MusicTools class, providing the file path of the music file as an argument:
music_tools = MusicTools(filepath="path/to/your/music/file.mp3")
  1. Access the tools provided by the class, such as BPM detection, key finding, and vocal-beat extraction:
bpm = music_tools.bpm_detector()
print(f"The BPM of the song is: {bpm}")

key = music_tools.key_finder()
print(f"The key of the song is: {key}")

music_tools.vocal_beat_extractor()
print("Vocal and beat files extracted successfully.")

Class Methods

__init__(self, filepath=None)

  • Initializes the MusicTools class with an optional filepath.

load_file(self) -> bool

  • Loads the music file specified by filepath and sets the y (audio signal) and sr (sampling rate) attributes.

bpm_detector(self) -> str

  • Finds the BPM (Beats Per Minute) of the loaded music file and returns it as a formatted string.

key_finder(self) -> str

  • Calculates the chroma features of the loaded music file and determines the key of the song.

vocal_beat_extractor(self)

  • Separates the vocal and beat components of the loaded music file and saves them as separate audio files on the desktop.

Example

For a complete example of using the MusicTools class, refer to the provided script example_usage.py.


Feel free to customize the README according to your needs, and if you have additional features or considerations, you can include them in the documentation.

About

`MusicTools` is a Python class that provides tools for working with music files. It includes functionality for finding the BPM (Beats Per Minute), detecting the key of a song, and extracting vocals and beats.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages