Artificial intelligence has already revolutionized many fields by making it possible to use data to predict complex phenomena.

Statista estimated the global AI market at US$327.5 billion in 2022 (, in a context of continuous growth. 

While some areas of application of artificial intelligence are already well known, there are others that are less well known but where development prospects are very important. This is the case in the field of music. Sound is a particular data that does not have the classical structure of painting, it is a waveform. The use of sounds as input data for a machine learning model therefore requires treatments and waveform measurements that have developed a lot recently, especially thanks to the Librosa library in Python. 

The field of music enjoys many opportunities thanks to artificial intelligence with the possibilities of automatic classifications of styles or automatic generations of music from examples. The generation of music by artificial intelligence poses the problem of being able to take into account events in time. Conventional machine learning models such as feedforward neural networks are not suitable for this. As shown in the diagram below, such a model whose role would be to generate a note following an existing melody would make exactly the same prediction if given Do-Ré-Mi-Fa-Sol input or if given Sol-Fa-Mi-Ré-Do, because the notes are the same and this model does not consider the order in which they appear. But obviously, for a musician, these are two different melodies and the possibilities that come to the ear to continue them are of course not the same.

Diagram of a «classical» neural network

For artificial intelligence to adapt to this situation and consider things as a musician would take into account the set of notes as a time series. This immediately eliminates most of the classic machine learning models and imposes more sophisticated models such as recurring neural networks or LSTM (Long Short Term Memory) networks which have both short-term and long-term memory capacity and can therefore take into account the order of notes of a long melody in the prediction of the next note. ( Here is an example of how a recurring network works and receives an input melody with a note on each neuron in the input layer. Unlike the classical network, there is here a consideration of the order in which the notes appear which allows him to consider the melody as a musician would.

Recurring neural network diagram

Such a model imposes more complexity for the data-scientist but is theoretically capable of finishing a work from its beginning or generating music in the style of examples on which he has learned. For example, it would be possible to train a model with all of Mozart’s piano sonatas and use it to generate piano music in Mozart’s style. A well-trained model could perhaps give the ear the impression of having done “as well” that Mozart himself, but it is necessary to relativize the artistic interest of such an approach because this model would never be anything but a imitator of Mozart since by definition he learned through the music written by the composer. It would then be very risky to try to put at the same level a genius and a imitator of this genius. To be able to claim that an artificial intelligence has really done «as well» that Mozart should create a model that can generate music of the same quality and as innovative as that of the composer by having not used any Mozart music for his learning. This model should even have learned only with music strictly prior to 1756 (Mozart was born on January 27, 1756 and he began music almost immediately!). It must be recognized that current machine learning techniques do not offer this possibility. But if really «all thought results from a calculation» there must be a way to mathematically reconstruct the thought that a genius has when he creates something completely new.