When researchers recently unveiled the first pop song composed by an artificial intelligence (AI) system, some creative types may have been nervous about the idea of robots taking over their jobs. But how exactly was AI used to write a song?

A team from the Sony CSL Research Lab used a system called Flow Machines to compose the new record, titled "Daddy's Car."

The song sounds like a lost Beatles track from the late 1960s, or perhaps a composition by Brian Wilson of the Beach Boys. François Pachet, the project's lead researcher, told Live Science that the song wasn't created by an AI entirely from scratch, so composers can breathe easy — at least for now. [Super-Intelligent Machines: 7 Robotic Futures]

The song's lyrics, surreal as they sound, were written by a human, French composer Benoît Carré. The team also put together a second track, called "Mr. Shadow," designed to incorporate the styles of Irving Berlin, Duke Ellington, George Gershwin and Cole Porter.

The parts that were written by the computer are known as the "lead sheet," which defines the song's melody, part of the orchestration and part of the mix (which ordinarily audio engineers would then complete). The user, in this case Carré, first chose a style of orchestration. A piece of software called Flow Composer used a database of 13,000 lead sheets to map the style to the lead sheet — that is, take the melody and make it fit the style of music.

"The user has to select the orchestration style from a palette of styles — actually styles here, are human recordings of existing single songs. For instance, a Brazilian guitarist has recorded 'Girl from Ipanema,' [and] we can select this recording, and it is mapped onto the lead sheet," Pachet told Live Science in an email.

The software can then fit the style of the base song — for example, an old Beatles track — to the melody. "If there are chords in the lead sheets that were not played in the audio, the system can still use chord substitutions and audio transformations so that it still 'fits,'" Pachet said. What this means is the artificial intelligence can substitute in music if the specific chords weren't in the song used as a base — the Beatles in this example

Final choices are still left up to the user — for example if the user doesn't like the accompaniments that the AI came up with — but Pachet said in the future, these decisions could be automated as the researchers build a bigger database of which accompaniments "work" better with certain types of melodies. The machines could be taught this, via a kind of reinforcement learning; greater weights would be assigned to the "right" kinds of answers, and eventually an AI could learn what choices sound better to human ears.

Still, there are things that the system does not do well, Pachet said. "The hard part is now high-level 'structure,' or what I call "sense of direction" — i.e., the capacity to establish long-term correlations between elements of the piece (sequence). That is the thing we (and others) are working on currently," he said.

Teaching an AI the "global timbre" of a song is also difficult, Pachet said. A human can say "this song sounds like X," but computers are not good at that kind of holistic thinking, he said.

Lyrics, as it happens, could be written by machine, he added, but the technology isn't yet integrated into Flow Machine.

That said, the individual pieces that will give AI the ability to compose might come together in the future, he added. "Basically, all the basic ingredients are out there, and the trick is to put the pieces together," Pachet said.

Original article on Live Science.