[Cary]: Hey Computer!
[Computer]: Hi Cary!
[Cary]: Make me music!
[Computer]: You are in luck! I have a wide range of musical masterpieces available,
ranging from Rick Astley's Never Gonna Give You Up to Darude - Sandstorm.
[Cary]: No, no no, that won't do it!
I'm a special snowflake, so I want music that only I get to hear.
[Computer]: You want me to create new music from scratch?
But I don't even know what music is!
[Cary]: Yeah. Like, you're a computer, you're smart!
You should know how to do that.
[Computer]: Well, I'll give it a try.
[sick beatz]
[Computer]: Did I do a good job?
[Cary]: No!
Here, maybe I should give you some examples to learn from, like pieces by Bach.
[Computer]: Ooh! Let me look at this!
Now I know exactly what to do!
[more sick beatz]
[Cary]: *sigh* Clearly computer school is not working.
[Computer]: Computers don't have school.
[Cary]: Because you didn't even learn the concept of learning!
Maybe you should just take a look at Andrej Karpathy's article.
[Computer]: Woah! Recurrent neural networks!
I'll be sure to remember this unless it passes through a "forget gate".
[transition music]
[even more sick beatz]
Ok, enough of that bizarre skit thing.
Computery, you're free to go!
Yay! Time to become SkyNet!
As you can probably tell by now,
The goal of this project is to get a program to replicate pieces of Bach
as closely as possible.
To do this, I first downloaded as many MIDI files of Bach pieces as I could.
I restricted it to keyboard only pieces to keep it simple.
This website is so old, some of the links are older than me!
And any file over 30 kb is labeled to warn it to you of its large size.
The next step was to convert these MIDI files into text files using MIDI CSV.
Now, they're slightly easier to deal with, but not by much.
We still have a lot of wasted characters just saying,
"Note on", "Note off", "Note on", "Note off".
In a custom Processing script, I stripped away these unnecesary characters,
and converted the 88 pitches of the piano into 88 different ASCII characters.
To allow for multiple notes to be played at the same time,
I entered in spaces, to show where each unit of time ticks by.
This shrinks the file's size by about 6 times.
Which makes it much easier to input it onto the next step!
Which is...
Andrej Karpathy's magical LSTM!
Seriously though, his blog post of this LSTM learning and replicating complex patterns of text is pretty much famous now.
It seems like every machine-learning article links to it somewhere,
even Google!
But anyway, since this LSTM takes in text as input, we can just feed our reformated Bach text,
And bam!
It'll start training!
After a few hours or days...
We can stop the training and let the LSTM output its own text.
Hopefully, this text imitates our original training data as close as possible!
Actually, we don't want the outputed text to exactly replicate the training data.
We just hope that it takes upon the same patterns, but it's still technically original.
Before we go on..
I want to point out that just by coincidence,
I found the words 'Yaeh Yaeh Yaeh Yaeh'.
They look like lyrics, but no.
It's representing the pitches of
89, 97, 101, and 104.
So, a major chord in first inversion, actually!
Now what?
Well, we can just go through all the conversion processes in reverse now.
We go from the reformatted text,
back into the unnecessarily long text using a custom Processing script.
from the unnecessarily long text back into MIDI
using CSV MIDI,
and then finally from MIDI back into WAV
or something :/
by just using windows media player and recording the output.
So that's what you heard computery-
[Computery]: That's me!
[Cary]: -output.
But, if I recall correctly,
You've only heard 7 minutes of training!
That's not very long!
Let's see what happens if we train it for longer!
Sorry for cutting that masterpiece off short
but I'm gonna give some final thoughts
So, first of all, about cutting things off short,
Well, I tried to find a place that felt like it had closure to end it
but one thing about these neural networks is that
It never ends!
Like, the stream of notes just keeps going and going and going
So wherever I cut it off it's gonna feel like
it's incomplete
The second thing is, what is the ultimate goal of this project?
If we want to replicate Bach and Mozart pieces as close as possible,
Wouldn't the perfect neural network just
clone those pieces and spit them out verbatim?
This process of just memorizing and regurgitating the training data
is called overfitting
and we don't want that
because we'd like to listen to original sounding music!
To anyone who accuses this LSTM of overfitting,
just listen to any more than 5 seconds of it
and you'll realize it sounds too wonky
for something to actually appear in Bach or Mozart.
So, I think that is enough proof that I'm not overfitting
though I could do actual analysis of that
But i feel like that takes a lot of work
The third thought on my mind is
I could imagine a lot of people downplaying this LSTM's music, saying
"Oh, it's nowhere near as good as a human! What's the point of all this? It sounds like garbage!"
And I could understand that
It's clearly nowhere near as good as a human could do,
But one advantage that computers have over humans
well, two, I guess
is speed and effort.
Because if you were to ask a human to create 10 hours of original music for you,
that might take them their entire lifetime.
But, if I want to use this LSTM I can just let it run overnight.
And when I'm sleeping, It'll happen.
So on the quality VS quantity spectrum, you can see we're really, really excelling on the quantity side.
By the way, if any of you YouTubers want to use this music in the background of your videos, you can.
but, like, it's not very good music so why would you want to?
but, it's, like copyright free and all that so you don't need to worry.
just credit
uuuuuuuuuuuuuuuuuuuuuuuuuum
computery
okay?
but imagine if a human composer wants to speed up the rate at which they can produce music,
it will take a lot of
training and practice just to
make music, maybe, 10% faster.
But say, if I want to make music on my LSTM 10x faster,
well, I just need to buy 10 computers!
Which sound like a lot, but really It's just
a small expense and now
everything runs 10x faster and you get 10x more music per second
that's pretty crazy
But speaking of speeding things up, as I said earlier
I need to get a GPU.
Well, I have a gpu in my computer, but It's like AMD
which is kind of unusable for tensor flow
but
yeah, like
it will speed things up by orders of magnitude
and in addition, i only trained the biggest, most intensive model
of this video
for a day.
so if I trained it for longer, like a week,
with a more powerful GPU,
or maybe multiple,
then
It's very possible for me to train essentially 100x longer. Which is kind of crazy!
In addition, I'll try to find more pieces by other composers to reduce the chance of overfitting
but, I'm just really excited!
Because if this is what we get after just one day of training on a pretty crappy processor
Just imagine what else is possible if I actually try harder
oh, by the way, I forgot to mention
I'm clearly not the first person to try something like this
nor are my results the best so far.
not by a long shot. I've heard a lot of better AI-generated music.
But this was just me trying something out
and now I know a lot more about what's happening behind the scenes
and plus, I can now tweak it however I want!
anyway, thanks to all of you for watching this far into the video
actually I should give all my thanks to Andrej Karpathy because
I didn't really program any of the internal mechanisms, he was the one who did it.
By the way, Andrej, my fastest competition official Rubik's cube solve is faster than yours
So, like, no biggie but I'm beating you there.
BYE