Skip to content

This repository contains code for generating new music using Generative Adversarial Networks (GANs). GANs are a type of deep learning model that can learn to generate new data that resembles the training data. In this case, we use GANs to generate music sequences based on existing MIDI files.

License

Notifications You must be signed in to change notification settings

masanbasa3k/Generate_Your_Own_Music

Repository files navigation

Music Generation with GANs

This repository contains code for generating new music using Generative Adversarial Networks (GANs). GANs are a type of deep learning model that can learn to generate new data that resembles the training data. In this case, we use GANs to generate music sequences based on existing MIDI files.

Files in the Repository

  • create_generator_model.py: This script contains the implementation of a GAN for generating music. It defines the generator and discriminator models, trains the GAN, and saves the trained models.
  • discriminator_model.h5: This file contains the saved weights of the trained discriminator model.
  • gan_final.mid: A MIDI file containing music generated by the trained GAN.
  • generator_model.h5: This file contains the saved weights of the trained generator model.
  • play_midi.py: A script to play the generated MIDI file and hear the music.

How to Use

  1. Training the GAN: If you want to train the GAN on your own MIDI dataset, run the create_generator_model.py script. This script will parse the MIDI files in the archive folder, preprocess the data, and train the GAN to generate new music. After training, the generator and discriminator models will be saved in generator_model.h5 and discriminator_model.h5, respectively.

  2. Generate New Music: To generate new music using the trained generator model, run the generate_music.py script. This script loads the generator model, generates random noise as input, and generates a new music sequence. The resulting music sequence will be saved as gan_final.mid.

  3. Play the Generated Music: To listen to the generated music, run the play_midi.py script. This script will play the gan_final.mid file and allow you to hear the music.

Dependencies

The code in this repository uses Python and the following libraries:

  • TensorFlow
  • Keras
  • music21

You can install the required dependencies using pip:

pip install tensorflow keras music21

Contribution

Feel free to contribute to this project by opening issues or submitting pull requests. If you have ideas for improvements or new features, we'd love to hear from you!

License

This repository is licensed under the MIT License. See the LICENSE file for more details.

About

This repository contains code for generating new music using Generative Adversarial Networks (GANs). GANs are a type of deep learning model that can learn to generate new data that resembles the training data. In this case, we use GANs to generate music sequences based on existing MIDI files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages