Skip to content

yatri1609/Music-Generation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Generation with Machine Learning: Exploring the Intersection of Creativity and Artificial Intelligence

In the realm of artistic expression, music has long been a medium that captivates the human soul, eliciting emotions and transcending boundaries. Throughout history, composers have pushed the boundaries of creativity, crafting melodies and harmonies that resonate with listeners on a profound level. However, in the era of artificial intelligence (AI) and machine learning, a fascinating question arises: Can machines, too, learn to compose music that evokes similar sentiments?

This project delves into the intriguing intersection of music and machine learning, exploring the potential of neural networks to generate novel musical compositions. Leveraging the power of Python and cutting-edge deep learning libraries such as Keras and TensorFlow, the project aims to train models on existing musical data and harness their ability to learn patterns, sequences, and structures inherent in the training corpus.

At the heart of the project lies a meticulously curated dataset comprising MIDI files of classical piano compositions. MIDI, or Musical Instrument Digital Interface, is a widely adopted standard for representing musical notes, rhythms, and instruments in a digital format. By preprocessing and encoding these MIDI files, the project transforms the raw musical data into a format suitable for training neural networks.

The project employs two distinct approaches to music generation, each offering unique advantages and insights. The first approach utilizes Recurrent Neural Networks (RNNs), a type of neural network architecture particularly adept at modeling sequential data. Music, by its very nature, is a sequence of notes unfolding over time, making RNNs well-suited for capturing the temporal patterns and dependencies that define musical compositions.

The second approach explores the use of Convolutional Neural Networks (CNNs), which have traditionally excelled in tasks such as image recognition and computer vision. However, recent advancements in deep learning have demonstrated the potential of CNNs in capturing local patterns and features in sequential data, including music. By employing CNNs, the project aims to uncover the intricate relationships between notes and chords, ultimately generating music that respects the nuances of musical structures.

The project's Jupyter Notebook serves as an interactive and comprehensive guide, walking users through each step of the process. From data preprocessing and preparation to model architecture design, training, and evaluation, the notebook provides a detailed exploration of the techniques and methodologies employed.

During the data preprocessing phase, the project meticulously cleans and transforms the MIDI files, ensuring that the training data is free from inconsistencies and noise. This involves techniques such as note quantization, tempo normalization, and encoding of musical features like pitch, duration, and velocity into numerical representations suitable for neural network training.

Once the data is prepared, the project dives into the construction of the neural network models. For the RNN approach, architectures such as Long Short-Term Memory (LSTM) and Gated Recurrent Units (GRU) are explored, leveraging their ability to capture long-range dependencies and mitigate the vanishing gradient problem that often plagues traditional RNNs.

In the CNN approach, the project experiments with various convolutional and pooling layer configurations, aiming to capture local patterns and features that contribute to the richness and complexity of musical compositions. Techniques such as dilated convolutions and residual connections are explored to enhance the model's ability to learn hierarchical representations of the music data.

Throughout the training process, the project employs diverse optimization techniques, including gradient descent algorithms and regularization methods, to ensure efficient convergence and prevent overfitting. Techniques like dropout and early stopping are employed to enhance the generalization capabilities of the models, enabling them to generate music that extends beyond the confines of the training data.

Upon successful training, the models are tasked with generating new musical compositions. This process involves a delicate balance between leveraging the learned patterns from the training data and introducing novel elements that showcase the models' creative potential. The generated music can take various forms, including note-by-note sequences, piano rolls (visual representations of music), or complete MIDI files that can be played back and appreciated.

One of the remarkable aspects of this project is its ability to foster a deeper understanding of the intricate relationship between music and machine learning. By examining the generated compositions and analyzing the models' decisions, researchers and music enthusiasts alike can gain insights into the strengths and limitations of neural networks in capturing the essence of musical creativity.

Moreover, the project serves as a valuable educational resource, providing a comprehensive introduction to the application of deep learning techniques in the domain of music generation. Students and researchers can leverage the project's codebase and accompanying documentation to explore various model architectures, fine-tune hyperparameters, and experiment with different datasets, fostering a hands-on learning experience.

While the generated music may not immediately rival the masterpieces of human composers, the project represents a significant step forward in the exploration of AI's creative potential. As the field of machine learning continues to evolve, and as models become more sophisticated and capable of capturing the nuances of human creativity, the possibilities for AI-generated music become increasingly intriguing.

Imagine a future where AI-powered music generation systems collaborate seamlessly with human composers, providing novel ideas and inspiration for new melodies and harmonies. Envision a world where AI-generated music accompanies immersive virtual reality experiences, adapting and responding to the user's emotions and preferences in real-time.

The implications of this project extend beyond the realm of music, as the techniques and methodologies employed can be applied to other creative domains, such as visual art, literature, and even architectural design. By pushing the boundaries of what is possible with machine learning, researchers can unlock new avenues for human-machine collaboration, fostering a symbiotic relationship between artificial and human intelligence.

In conclusion, the Music Generation with Machine Learning project represents a captivating exploration of the intersection between creativity and artificial intelligence. By harnessing the power of neural networks and leveraging cutting-edge deep learning techniques, the project aims to generate novel musical compositions that not only showcase the capabilities of machine learning but also inspire a deeper appreciation for the art of music itself. Whether serving as a educational resource, a platform for experimentation, or a glimpse into the future of AI-augmented creativity, this project stands as a testament to the boundless potential of artificial intelligence in redefining the boundaries of human expression.

Basic structure

  • LSTM folder has all the files required for the LSTM model generation, lstm.py trains the model while predict.py predicts or generates the output.
  • GAN folder has all the files for generation of music using GAN.
  • Data folder has all the data sets for the project.
  • Final_Output folder has the output midi files and mp3 files along with the .ipynb to generate the output graphs for the midi files.
  • The Reports and Presentation folder has a presentation video and report for the project.
  • Scrapping has the scraping files to download the dataset.
  • Download the LSTM model weights from this link (https://drive.google.com/open?id=1C8M95GKPkFWG3mFJuYu-cOXkZc0uTqe9) and add it to LSTM/weights.

You can listen to the output at : https://soundcloud.com/yatri-patel-793078277/sets/lstm-gan-neural-network

About

Generating Music using LSTM and GAN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published