An artificial intelligence that derives the ideal melody from a written text for a successful song? It sounds like science fiction but it's reality and one day it could be routine.
There is a paper published on Arxiv.org entitled "Conditional LSTM-GAN for Melody Generation from Lyrics". In this paper, researchers from the National Institute of Computer Science in Tokyo describe an AI, a machine learning system capable of setting lyrics to music. Pardon, able to generate melodies "according to the lyrics". I speak of music that takes into account the right relationship between syllables, notes and the human ear. Consistent music, songs.

“Generating melodies from lyrics has always been a challenge in. field of both music and AI, because it aims to discover the intimate relationship between beautiful words and the right way to enhance with sounds, " writes one of the authors. "With the development of accurate databases and data analysis systems, the ability to set a song to music with AI has gradually become concrete."
Portrait of the perfect song
As we also read in the paper, the notes have two main attributes: tone and duration. Tone is a property of sound that organizes music on a high or low frequency scale. Duration represents the length of a sound's expression. The most beautiful songs are evidently those that create a perfect alchemy between the characteristics of the. syllables that make up the text and the right musical dosage.
Think of the most beautiful couple who would never have seen the light of day if there was an AI that undermined their partnership: Mogol and Battisti.
A song like "An Adventure," for those who remember it, starts out as a winner from the very beginning. That "It will not be / An adventure" that goes extraordinarily with perfectly cut notes on the sound of the words and the mood suggested by the literal meaning.

Today the computer can do it
The AI developed by the researchers is a classic "adversary generative network", or GAN (for those who do not know what it means here is a very useful article) which trains the system to recognize "fake songs" generated by the computer. As one part of the system learns to recognize them, another part of the system learns to set lyrics to music and thus generate "fakes" that are increasingly refined and close to the real ones.
The researchers started from 25.000 pieces of music from which they drew all the music and 20.000 "typical" sequences of union between syllables and sounds.
Hard to understand? Hear an example of AI "composed" music:
And here's another one:
The second test phase involved humans and concerned the degree of taste with respect to these creations. The results showed that the AI has not only elaborated "respectable" songs (and I think then that they are not these two examples) but homogeneous with those musicians from a human being. A blind evaluation of "natural" and "artificial" pieces showed more or less similar approval.
"The development of this artificial intelligence has two purposes: to perfectly mimic human musical creativity, and also to understand how it works," say the researchers.
The future
I get a thrill to imagine the applications of an AI like this. I try it because I already reluctantly suffer from the effects of autotune on modern music pieces. Imagine writing two nonsense on a sheet of paper, pressing a button and automatically setting music to music, finally jarring in a microphone and also adjusting the voice by pressing another key. Virtually the death of art.
And yet it moves. In July, the Canadian startup Landr raised € 25 million for its own algorithm which analyzes musical styles to obtain automatic settings to be provided to musicians. OpenAI (Elon Musk) and Google are already testing algorithms that develop music from scratch. Sony is working on an AI drummer who can accompany a band worthily.