Skip to content

suniljmanohar/Music-CNN

Repository files navigation

Music-CNN

Convolutional neural network for predicting classical music

This Tensorflow project applies a convolutional neural network to pieces of classical music (currently testing on Bach). MIDI files are used as the source data; each file is converted to a "time-against-pitch" grid of 1s and 0s. The output tensor os the network is a "chord vector" of 128 pitches which is compared to the actual next chord in the piece. A loss function and gradient descent are used to minimise the difference between the predicted chord and actual chord.

NB this is still under development, so whilst the code works, there are for example some written functions which are not yet implemented.

Files:

  1. MIDI_functions. Contains various functions for manipulating MIDI files and converting them to and from grids. Also contains the structure of the network model
  2. MIDI reader. Contains code to convert a batch of test and training MIDI files into arrays of "features" and "labels"
  3. MIDI CNN. Builds and trains the model, and creates a set of prediction chords for each sample
  4. MIDI writer. Used to append the predicted chords to the original samples and convert them to MIDI, to listen to the output
  5. training_files and test_files. MIDI files for use with MIDI reader. Currently contains various works by JS Bach

About

Convolutional neural network for predicting classical music

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages