Can Python generate music ?

Sanidhya Mangal (~sanidhya)


Traditionally, music was treated as an analogue signal and was generated manually. In recent years, music is conspicuous to technology which can generate a suite of music automatically without any human intervention. A generative model can be used to generate musical notes using Recurrent Neural Networks (RNN), principally Long Short-Term Memory (LSTM) networks. A designed model can be given input into a form of Musical Instrument Digital Interface (MIDI) file format, and output can also be obtained in the same format. This talk would mainly focus on building a two layers LSTM model on Keras along with various operations that can be performed on the designed model. At the end of this talk, attendees would get answers to the following questions:

  • What are LSTM's?
  • What are MIDI files?
  • How to preprocess MIDI files?
  • How to make a Keras Model?
  • What are different components of a Deep Learning Model?
  • How to visualize the trained model on TensorBoard?

Basic Outline of the talk

  1. Introduction to music [1-2 minutes].
  2. What are MIDI files? [4 - 5 minutes].
  3. LSTM and Sequence learning [3 - 4 minutes].
  4. How to build a Deep Learning Model in keras [8 - 10 minutes].
    • Pre-processing of MIDI files using mido module.
    • Preparing a 2 layered LSTM model for training and inferencing in keras.
    • generate_music function to generate and predict new music using a trained model.
  5. Using callbacks for visualizing model performance in Tensorboard [2 - 3 minutes].
  6. Q&A session [3-5 minutes].


In order to get most out of these talk, attendees must have some knowledge about the following terms in Python:

  • Conditional Statements (if statement)
  • Loop Statements (for loops)
  • Slicing
  • Import modules

Knowledge of Deep Learning technologies such as TensorFlow, Keras and some information about sequence learning would be cheery on top.

Speaker Info:

Sanidhya Mangal is an open source developer working towards the furtherance of this of community, he is serving as Microsoft Student Partner from last 3 years sharing his deep knowledge and passion in the emerging tech with fellow students. Recently he was selected as Google Machine Learning Facilitator, enlightening students and professionals in the field of Machine Learning, Deep Learning and TensorFlow. This year he is also selected Alexa Student Influencer, first Batch from India. Sanidhya's Tech stack contains Python, TensorFlow, Keras, Scikit-learn and Angular 4+.

Speaker Links:





Id: 1084
Section: Data Science, Machine Learning and AI
Type: Talks
Target Audience: Intermediate
Last Updated: