An advanced AI-powered music generation system that uses deep learning techniques to compose original music. This tool utilizes Long Short-Term Memory (LSTM) neural networks to generate music sequences from MIDI files, with a user-friendly graphical interface.
- MIDI File Processing: Easily process MIDI files to extract musical notes and chords.
- Sequence Generation: Generate sequences of notes using LSTM-based neural networks.
- Prompt-Based Music Composition: Input musical prompts to guide the AI in generating specific music patterns.
- Real-time Music Generation: Compose and save original music compositions on the fly.
- User-Friendly GUI: Intuitive graphical interface for easy interaction with the AI music generator.
- Python 3.8 or higher
- TensorFlow 2.x
- Music21
- NumPy
- Tkinter (for GUI)
-
Clone the repository:
git clone https://github.com/yourusername/ai-music-generator.git cd ai-music-generator
-
Install the required Python packages:
pip install tensorflow music21 numpy
-
(Optional) Set up a virtual environment for the project:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Download some MIDI files and place them in the
midi_files
directory within the project folder.
To run the program, use the following command:
python main.py
- Load MIDI Files: Click on "Load MIDI Files" to process the MIDI files in the specified directory.
- Generate Music: Input a musical prompt (e.g.,
C4 E4 G4
) to guide the AI in generating a sequence. - Save and Listen: The generated music can be saved as a MIDI file and played back using any MIDI player.
C4 E4 G4
- A basic C major chord.G4 B4 D5
- A basic G major chord.A3 C4 E4
- A basic A minor chord.
The system processes MIDI files to extract musical notes, chords, and rests. This information is used to train the LSTM model.
The LSTM model takes the preprocessed notes and generates sequences of musical notes. The sequences are used to compose original music.
The graphical user interface is built using Tkinter, providing an easy way to interact with the AI model, load MIDI files, input musical prompts, and generate new compositions.
If you encounter any issues or have ideas for improvements, please feel free to open an issue or contribute to the project by submitting a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.