The Emotion-Based Music Harmonizer is a Python-based tool that allows users to mix multiple audio tracks (melody, harmony, bass, and percussion) based on a chosen emotion — calm, sad, or energetic. Using pydub
for audio processing and tkinter
for a GUI, this harmonizer adjusts elements in each track to evoke the desired emotional tone and exports the final mixed audio in WAV format.
The project consists of two main files:
- Emotion_Based_Music_Harmonizer.py: Contains the core audio processing functions and handles the mixing logic.
- GUI_Integration_Using_Tkinter.py: Provides a graphical interface for selecting music tracks and emotion options, and allows exporting the final mixed audio.
- Emotion-Based Mixing: Choose from calm, sad, or energetic moods, each applying unique audio effects.
- Track Customization: Each emotion uses specific processing effects, such as volume adjustments, speed changes, and frequency filtering.
- Audio Export: Save the mixed output as a WAV file with an emotion-specific filename.
- Python 3.x
- pydub for audio processing
- tkinter (pre-installed with Python)
To install pydub
, run:
pip install pydub
Ensure ffmpeg
or libav
is installed for pydub
to handle WAV file formats.
- Run
Emotion_Based_Music_Harmonizer.py
:python Emotion_Based_Music_Harmonizer.py
- Provide paths to
melody
,harmony
,bass
, andpercussion
WAV files. - Enter an emotion (
calm
,sad
, orenergetic
). - The script mixes the tracks and saves the output as
mixed_audio.wav
.
- Run
GUI_Integration_Using_Tkinter.py
to open the graphical interface:python GUI_Integration_Using_Tkinter.py
- Use the "Browse" buttons to load WAV files for each track.
- Select an emotion from the dropdown.
- Click Mix and Export to create and save the mixed audio file.
Each emotion applies unique adjustments to create the desired soundscape:
- Calm: Reduces percussion volume, adds low-pass filters to bass and harmony for a soothing effect.
- Sad: Lowers high frequencies, reduces volume, and adds a reverb-like effect to bass for a melancholic tone.
- Energetic: Increases tempo, emphasizes percussion, and overlays all tracks for a high-energy mix.
load_tracks()
: Loads WAV files aspydub
audio segments.mix_calm()
,mix_sad()
,mix_energetic()
: Adjusts audio based on chosen emotion.export_mixed_audio()
: Exports the mixed audio as a WAV file.
- File Browsing: Load WAV files for each track using "Browse" buttons.
- Emotion Selection: Choose an emotion from a dropdown menu.
- Mix and Export: Generates and saves the mixed audio file based on the selected emotion.
To create a calm mix:
- Load
melody.wav
,harmony.wav
,bass.wav
, andpercussion.wav
. - Select "Calm" in the dropdown.
- Click Mix and Export.
- The output file
calm_mixed.wav
is saved in the directory.
Contributions are welcome! Feel free to submit pull requests to add new features or report any issues.