SchlagerAI — How We Built an AI System that Generates Schlager Lyrics

Timothy Smith
Motius.de
Published in
6 min readMar 4, 2020

Where do the craziest tech ideas come true? At Motius! And the most random ones get created during our regular Discovery sessions. Discovery is the Motius way of self-development and gives us the chance to explore the newest technologies in internal projects.

Discovery is also the reason why my team and I developed SchlagerAI — an AI system that generates schlager lyrics based on an input seed of words. In this blogpost, I’ll tell you all about this unusual experience and lessons learned during the project.

How it started: the deep lyrics of schlager songs

Have you ever wondered how popular schlager music is? To give you a hint, here’s a stat from Germany:

in 2018, schlager music made up 4,2% of revenue share among all music genres.

Taking into account that in 2018 the German music industry generated €1,582 billion revenue, that accounts for approximately €67 million! Sounds impressive, right? But it’s even more impressive if you look at the lyrical profoundness of the songs.

Let’s have a look at some schlager lyrics. Here is a famous passage from “Johnny Däpp” by Lorenz Büffel:

Lorenz Büffel Johnny Däpp Lyrics

So… extraordinary deep and very poetic… Do they really make money off of such lyrical genius?

Art meets technology

Having this question in our heads, I found out about the topic of our latest Discovery session at Motius: “Art meets technology”. Lucky me— finally, I had the perfect playground to dive deeper.

Why was this the perfect playground? During Discovery, we focus on our own internal projects and develop our craziest tech ideas.

As a passionate musician, I wanted my project to combine music and the power of machine learning. So, I challenged myself:

What if an algorithm could generate lyrics that are in no way inferior to those by Lorenz Büffel?

The goal

Luckily, there are enough people at Motius who like crazy ideas too. So Mohammed, Daniel, and I teamed up to generate schlager lyrics using AI.

Because it was a part of Discovery, where we intentionally cut off 10% of our working time to invest in self-development, our goal was not only to automate lyrics generation itself. We also wanted to try out new tools, and understand what servers, frameworks, and drivers we may need for similar future projects.

As time during Discovery is limited, we wanted to get started as quickly as possible. That’s why we structured our project in the following three phases:

phases of the SchlagerAI ELU project

Step 1: Building our own dataset

Gathering and cleaning data for machine learning models usually take a large percentage of the overall work. “Garbage in — garbage out” summarizes the importance of this step quite well. Luckily, Spotify already offered suitable playlists with promising titles, such as “Johnny Däpp” or “Atemlos”.

We constructed a script that would scrape Spotify for schlager song titles and then query Genius for the respective lyrics, allowing us to create a huge dataset.

However, as we not only included the playlist songs but also related songs and artists, our first dataset consisted of songs in many different languages. Of course, we needed a huge dataset, but this was too big. Why?

Unfortunately, it would be quite hard for a proof-of-concept AI to generate meaningful lyrics in multiple languages (imagine the song by Lorenz Büffel with some Korean words!). So, we agreed on going only for the German schlager.

Overall, we scraped the lyrics for more than 400 schlager songs. In the following post-processing, we added text markers for different verses, choruses, and song structures, hoping that the model would also learn how to structure the lyrics.

Step 2: Training and tracking

When analyzing song lyrics, humans must remember several words in order to understand the song text. For this, they keep these words in their thoughts and thus persist information over time. This is a task that a normal feedforward neural network cannot perform.

For this type of exercise, we use Recurrent Neural Networks (RNN) because they are specifically designed to handle sequence dependence. They have an internal state which allows them to persist information across inputs.

We experimented with a lot of different architectures and decided to go for Long Short-Term Memory networks (LSTMs) in the end.

Machine Learning Pipeline
Machine Learning Pipeline

We trained our models using Tensorflow and Keras — two popular state-of-the-art frameworks for deep learning.

Additionally, our goal was to test and evaluate new experiment tracking tools. The two we looked into were Weights & Biases, an experiment tracking tool for deep learning, and Polyaxon, a tool built for managing the development cycle of ML, from training over experiment tracking to deployment.

Our experiences? Both tools made it easy to track the results of each experiment and compare the corresponding hyperparameters, so we decided to integrate them into future projects.

As always, training ML models is time-consuming. For this dataset, it took us a few hours to train a single model. As we had to fiddle a lot with hyperparameters until we found an optimal solution, pure training time was at least one or two days.

Step 3: Friendly interface for non-tech users

As we reached the last project phase, our goal was to make the AI accessible for non-technical users. But easy interaction with ML models is a challenge — especially for a proof-of-concept AI.

What did we do? We set out to build a web-app with an easy and intuitive user interface where people could see the outcome of our ML model. You can see the result in the picture below.

Final SchlagerAI App user interface
The final SchlagerAI App user interface

All in all, it took us roughly one week in total to reach the final proof of concept.

What we learned

During the project, again and again, we realized that we are using the same modules for a bunch of our other projects. So, we asked ourselves a question: is there a way to somehow save time on these tasks?

Yes, and the answer is Algorithm as a Service (AaaS). AaaS offers a native and fast mechanism for authoring, publishing and operationalizing algorithms.
It is an easy way to adapt a project to different ML models and different problems — be it an image classification or RNN as in this case, where we analyze sequential text or song lyrics.

How is this going to influence our future projects? Based on our components, we built a general template for future projects which we can use to kickstart them at this stage of development.

Join Motius Job Teaser

Why SchlagerAI?

You may ask: why would we spend our time on such an unusual innovation? Well, the answer is simple.

Having the opportunity to spend time on the interface of tech and art while evaluating new tools to integrate with future projects is a great way of improving our overall project quality and at the same time developing our expertise in the newest technologies. Makes sense, right?

Want to join?

At Motius, we invest 10% of our working time in experimenting with new technologies. Wanna develop your own crazy ideas at work as well? Check out our job offers and join us for the next round.

Motius Tech-Dosis Subscription

--

--

Timothy Smith
Motius.de

I work for Motius as a Technical Executive in AI, CV and IoT. As an R&D company, we develop products and prototypes based on latest technologies.