How to make music with AI piano duet

How to use AI in your song writing process.

How to make music with AI piano duet

Last Updated on

Computational music is a rapidly developing field. With open-source tools and musical neural networks like MusicLM from Google, artificial intelligence is bringing new innovations to the music and entertainment industries. One such tool is the AI duet piano art project by ex-Google Creative Lab technologist Yotam Mann. Yotam’s magenta project puts machine learning inside your computer’s keyboard, inspiring new musical experiences through AI. So, how do we make use of it? Here’s how to make music with AI piano duet.

How does AI duet piano work?

AI piano duet is a browser-based tool for generating musical ideas. The neural net takes your own organic melodies as an input, and generates new rhythmic patterns based on that. That is to say, based on the rhythm and key you’re already playing in, AI piano duet will use neural network technology to play along with you.

You can use the center row of the keyboard as a MIDI keyboard. This means that the keys of your computer keyboard act as an input, and you can play them as if they were the keys of a piano.

How it does this is, at its core, a lesson in machine learning technology. The front-end client takes an input from your computer keyboard, and converts it into a MIDI input using the WebMIDI library from the Web MIDI API. Then, in the back-end, a Flask server uses TensorFlow, Tone.js and Google’s open-source tools from the Magenta project platform to return new musical concepts overlapping with the player’s input.

Essential AI Tools

Editor’s pick
EXCLUSIVE DEAL 10,000 free bonus credits

Jasper AI

On-brand AI content wherever you create. 100,000+ customers creating real content with Jasper. One AI tool, all the best models.
Editor’s pick

Experience the full power of an AI content generator that delivers premium results in seconds. 8 million users enjoy writing blogs 10x faster, effortlessly creating higher converting social media posts or writing more engaging emails. Sign up for a free trial.
Editor’s pick
Only $0.00015 per word!

Winston AI detector

Winston AI: The most trusted AI detector. Winston AI is the industry leading AI content detection tool to help check AI content generated with ChatGPT, GPT-4, Bard, Bing Chat, Claude, and many more LLMs.
Only $0.01 per 100 words

Originality AI detector

Originality.AI Is The Most Accurate AI Detection.Across a testing data set of 1200 data samples it achieved an accuracy of 96% while its closest competitor achieved only 35%. Useful Chrome extension. Detects across emails, Google Docs, and websites.


10x Your Content Output With AI. Key features – No duplicate content, full control, in built AI content checker. Free trial available.
*Prices are subject to change. PC Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission. Learn more

How do you play duet on piano?

A piano duet is the act of two pianists playing simultaneous parts of the same piece. Some tunes have two many notes happening at the same time for just tow hands to manage. In other cases, many pieces of classical music are composed intentionally for the duet form; the term piano duet is not simply a practical necessity or afterthought.

Playing a duet on piano, then, requires a partner. You wont always have access to another human performer, particularly not at the very beginning of the process. When fishing for inspiration, having a free, artificially intelligent duet partner is a very economical alternative.

How to make music with AI piano duet

To make music with AI piano duet, follow these simple steps:

  • Visit the AI piano duet page from AI Experiments with Google.
  • Click “Launch the experiment” (or “Get code” for advanced users)
  • Play the “How it works” video to get up to speed.
  • Play the AI keyboard itself. You can do so by either clicking/dragging along the on-screen keys or by using the center row of the keyboard you’re currently typing on. You can also connect an actual MIDI keyboard, if you’re familiar with playing piano.
  • Listen to the AI piano feedback, and draw inspiration from that! There is no output for the notes to feed into your music production software or digital audio workstation (DAW). However, as the project is built on Google’s open-source code from Magenta, software-savvy users can add that feature in themselves!
AI piano duet
AI piano duet in action.

Yotam Mann, a prolific musical software engineer, maintains an official website of creative ideas and computer programs, in addition to Google’s other musical experiments on the website.

Fun creative projects such as a drum machine, Chrome Music Lab,, and Magenta Studio allow professionals and hobbyists alike to experiment with computational music.