Paris (AFP) - Machines are already taking our jobs, will they soon be writing our music too?

Swiss researchers said Thursday they have developed a computer algorithm that can generate brand-new tunes in different musical genres.

The deep artificial composer, or DAC, "can produce complete melodies, with a beginning and an end, that are completely original," said co-developer Florian Colombo of the EPFL research university in Lausanne, Switzerland.

And the melodies are "quite agreeable to listen to," he told AFP.

The DAC programme uses a form of artificial intelligence known as "deep learning" that works in a similar way to the human brain in memorising experiences and learning from them.

It is a fast-growing field, with more and more possibilities opening up as computers grow stronger and databases larger.

The DAC system is trained to "listen" to existing tunes to learn what works and what does not.

It teaches itself to predict the pitch and duration of every note following another.

Once it is accurate at predicting 50 percent of note pitches and 80 percent of note durations in existing songs, the machine's training is complete.

Then starts the creation.

"The deep artificial composer builds a string of notes from beginning to end, including the very first note," said an EPFL statement.

It picks a follow-up note for each note played, based on the range of probabilities it memorised.

But the programme is taught not to pick the single-most probable note -- rather one of the many between least and most probable.

- Cannot fool them -

"An algorithm that always opts for most probable note will just keep repeating the same thing," said Colombo.

Instead, the programme was designed to produce "an infinity of different tunes".

It may be versatile, but the DAC is no Mozart.

Experts asked to listen to DAC- and human-composed melodies can still tell the difference.

"It will be a while before an algorithm will fool connoisseurs of Irish folk music," said Colombo.

Story continues

The researchers tested their programme on Irish and Ashkenazi Jewish folk music. The DAC was able to identify the genre, and avoid mixing the two.

Any musical style can be used, said the team.

For the moment, the DAC is limited to single-instrument compositions. Eventually, its developers hope it will create a full orchestra score.

The goal, however, is not to replace flesh-and-blood human composers.

"It is more a tool that can be used to stimulate creativity, to aid the process of composing" in periods of writer's block, said Colombo.

He cited Mozart, who is rumoured to have thrown dice to pick notes.

DAC-composed music may eventually be used for jingles, but probably never as "serious music," said Colombo.

"A good composer, with innovative ideas, will never be supplanted by an algorithm," he said.

"A composer puts something of himself in what he creates, and that a machine cannot do."

Several companies, including Google, Sony and IBM are working on similar projects.

A video of the project can be seen here: https://www.youtube.com/watch?v=GlqGEZbW5kM&feature=youtu.be