Thursday’s animated Google Doodle shows the composer playing an organ in celebration of his March 21 1685 birthday under the old Julian calendar.
It encourages users to compose their own two-measure melody.
Google said the Doodle uses machine learning to “harmonise the custom melody into Bach’s signature music style”.
Bach’s chorales were known for having four voices carrying their own melodic line.
To develop the AI Doodle, Google teams created a machine-learning model that was trained on 306 of Bach’s chorale harmonisations.
Another team worked to allow machine learning to occur within the web browser instead of on its servers.
The Doodle will prompt users who are unsure of how to interact with the animated graphic.