*computer-generated Baroque music*
Hey look! That loser is listening to Baroque music.
Let's beat him up!
*whacking*
*chaotic beating sound effects while Cary pleads*
Hey guys, good news!
I decided to listen to jazz music, instead of Baroque music.
For...reasons.
But, where am I going to get this jazz music in the first place?
I mean, I could play it myself, but I'm not very good at playing piano.
So, that leaves me with just one option left.
I think you all know where I'm going with this.
Computery!
Can you download me some jazz piano music off the internet?
Wha-what?
Was my computer-generated Baroque music not good enough for you?
Were over, Cary!
*sigh*
No, your Baroque music was actually fine.
It's just that I was bullied at school for listening to it.
*Traumatic flashbacks in the style of a horror movie*
Apparently it's not 'trendy' anymore.
Well, I'm sure it didn't go out of style that long ago.
Like [what], six months.
Maybe a year.
Try three centuries.
[Eecks], maybe the bullies were right after all.
Uh, I don't think bullies are ever-
I'll do it.
You will? Awesome!
Oh wait, there's only three hours of jazz piano online.
*dramatic sound effect*
School is six hours long.
Computery, I know this is a little of a stretch,
but could you maybe compose your own jazz music,
to fill in the gaps, and get me up to six hours?
Can't you just loop the music?
No, too boring.
Okay, I'm generating it now.
pfft
Gee, thanks!
So, it looks like our jazz library consists of fifty percent human-composed jazz,
and fifty percent Computery-generated jazz.
At the expense of sounding like Dora the Explorer,
I'm going to ask you:
Can you guess which three of the six jazz piano samples were created by AI?
Give it a try!
*Cary reading the on-screen text*
*Cary reading the on-screen text*
*Cary reading the on-screen text*
*Cary reading the on-screen text*
*Cary reading the on-screen text*
*Music*
Do you have your answer?
Are you sure?
Because it's time to see if you're right.
Uh, looking back at those six snippets,
finding the AI ones now seems really easy.
So easy, in fact, that I bet you all ACED the test!
Get it?
ACEd it?
Because the correct answer was A, C and E?
Let me play those three samples again, just so you can appreciate their jazziness one more time.
*Music*
But now, I'm curious!
How was Computery able to generate those jazz masterpieces so well and so quickly?
It must have been with the power of neural networks.
By the way, all of the original human-composed midi files came from Doug McKenzie's jazz piano website,
LITD.
We will use this approximately ten hours of music files as training data for all of these upcoming neural nets.
Peering deep into Computery's brain exposes three types of neural networks,
sitting on its hard drive.
The character-based LSTM,
(CBLSTM: Hello!)
HyperGAN,
(HyperGAN: Hello!)
And PixelCNN.
*Morse Code*
Computery definitely used one of them to generate that lovely jazz music.
But, I don't know which!
And I don't want to ask,
because I'm too nervous about offending Senpai!
Now, hmm.
Computery's getting a little fat.
(Computery: Hey!)
And I've been meaning to clear up some file space for a while now.
So, how about each of you neural nets show me what music you've got,
and I'll obliterate the two of you that perform the worst!
CBLSTM: That sounds totally fair and not at all unnecessarily cruel!
OK,
So Character-based LSTM, you're up first.
This little bugger was programmed by Andrej Karpathy, and is really good at replicating patterns and text!
Why?
Because it's sequential.
Meaning it reads text in, like a music box pulling in a moving tape.
Being a recurrent neural network,
it stores memory as it moves along, learning patterns and understanding the concept of cause and effect.
CBLSTM: If I just encountered a Q, there is a high chance I should output a U next!
CBLSTM is great at generating text, like Shakespeare and Linux source code.
Since text is so lightweight in file size, it also trains and performs lightning fast.
Sub-1 loss in under ten minutes!
By the way, loss is a fancy way of measuring how far off a neural network is from the correct answer.
The goal is always to minimise it.
As another bonus, text is pretty crisp, clean and discreet.
A character is either a 'B' or it isn't.
This closely aligns with the way simple pieces of music should be represented.
Either you play a B on the piano, or you don't!
And finally,
once this neural net is set up, it can generate output indefinitely,
like a music box running on tape.
There is no maximum length for the generated music!
That's great and all, but are there any downsides?
Yes.
Music is inherently two-dimensional, there's both pitch and time!
Two notes of different pitches can play at the same time,
and two notes of the same pitch can play at different times.
Being a one-dimensional data type,
text just isn't so good at representing that.
You can check out my Baroque music video to see how I try to encode music as text.
And, while it does work,
it just isn't very elegant.
CBLSTM may waste time and resources just trying to relearn this formatting.
You know what else it has to relearn?
Intervals!
See, the probability of each character showing up is a linearly independent dimension.
Meaning they don't really share information among themselves, or how they relate to each other.
That means that even after CBLSTM learns that D is a perfect fifth above G,
it still doesn't know that E is a perfect fifth above A,
even though we just shifted things up a whole step.
And it has to go through extra training data just to learn that fact over again.
This goes against our intuitive sense of pitches, as a spectrum, that you can freely transpose throughout.
Finally, memory what causes both human brains, and computer brains to go insane.
Does CBLSTM have memory?
Yes, and look at that loss!
Even though the overall goal is to minimise loss,
it exploded into insanity anyway.
Maybe because it encountered traumatic memories along the way?
But actually, it's probably because of unstable exploding gradients.
Here's the final list of all the pros and cons that I could think of.
While that all does sound pretty bad,
we can't really be sure if the cons outweigh the pros, or vice-versa.
Until we actually listen to what music CBLSTM can produce.
It already did a good job with Baroque music.
*Snippet of 'jazz' from the Baroque music video*
But jazz is a little more freeform, and nuanced.
So CBLSTM, what'cha got?
What does CBLSTM got?
Find out after the break!
But yeah, you should really stick around for Part 2,
because not only will we hear
how all three neural networks actually perform,
and see who gets to survive on Computery's hard drive,
But I will also give you three hours of Computery's jazz compositions,
as well as demonstrate to you, the casual viewer,
how you can have your computer generate music of any genre you want,
in just the same way I did!
So stick around, or else you'll frown.
Thanks a billion to Hazel Cricket, who animated that last section for me.
It turned out really nice, and took a load off my shoulders.
Thank you to all my patrons who are supporting me on Patreon,
because you guys really are making it easier for me to make these videos.
Last time, the name reading took way too long,
so this time, I'm going to change the perks a little,
so that just Tantusar is going to read the top tier.
Tantusar: Carykh is supported at the five-dollar level by:
Tantusar: kitkatyj, Nullpersona, Benjamin Gordon,
Tantusar: Trevor, David Pfahler, Dunkel Blau,
Tantusar: Brady Wagner, and Mike Koss.
I gotta figure out what other perks to give, but just give me a little time to decide.
Oh, also, thanks to my Phi Alpha Mu people for beating me up just for this video,
and thanks to fernozzly Michael for getting my GPU to work, and being a cool brother.
Josiah also told me to give a shoutout to Stanford men's gymnastics, so that's pretty cool.
And I'm not trying to brag, but Brandon Lin,
the world's fastest Square-1 solver,
the world's fastest Square-1 solver, 
(Voice: HOLY S-)
and Boyinaband,
the world's longest hair owner,
the world's longest hair owner,
(Voice: OH MY GOD)
watch my videos too.
Hi Brandon and Dave!
Cary in video: Why won't it come off?
Okay, enough shoutouts,
because it's time for me to get out.
Cary in video: Well, it's not real, guys.
*meow*
Stop meowing, cat!
Oh, cat, do you want me to cat meow?
*meow*
Cary: Meow meow meow!
