[Music]
hello everybody good evening I don't see
you I don't see you I don't I I see
myself I look over at this monitor over
here I didn't check my sound the advance
which I usually try to do makes me so
happy
it's so nice to be back on YouTube with
you the viewing audience here on the
coding train I am here with my special
invisible cloaking device semi clothing
advice shirt my space invisible space
melon not very good I went to this store
which shall not be named and this is
what expensive these little melon pops
that they have not a sponsor usually
it's quite delicious maybe it was just
sitting out all day I don't know melon
keeps me going here on the coding tray
which is a weird very weird thing to say
somehow I said it anyway I'm not sure
what to do about this shirt issue so I
and Daniel Rodriguez says greetings from
Colombia and I am going to do something
on the coding train today
which is a visualization of a number
sequence called the Rick Amon sequence
maybe somebody help me with the
pronunciation there is a sequence
invented by I believe a Colombian
mathematician so I want to look up the
actual information to make sure I say it
correctly but that's that's one it's a
main topic that I prepared for today Oh
Bruno says we missed you so much I
missed you
interestingly enough though I was
releasing with you it's just about
everyday cuz I recorded so much before I
went away so I was on a little vacation
I was in the place called Cape Cod and I
was also in the wonderful city of
Toronto and a little up north into
Ontario in the Muskoka Lakes region
which was quite beautiful and had a
lovely time like New York City just fine
but that was nice I will be away again
for quite a bit of time in August so the
summer is a little bit I'm trying to
keep up with things and make enough
content to it so that I don't feel
guilty and pause the patreon last summer
I bought the patron for three months
with the broken elbow this summer I
think I did do five live streams in it's
July now in June and I won't be gonna
get at least 3 in July and 3 in August
and then kind of make up for it later
oh welcome new sponsor rhythmic Dragons
Guk I'm sure I'm so sorry Prizm ik I'm
sure I completely and of course the
camera goes right oh I have so many
plans to like upgrade my equipment and
do better and oh did I just post
something here oh so I'm going to the
slack Channel the friendliest yeah so I
don't know what to do about this shirt
thing so this you know I don't but you
know the coding training as as you know
is brought to you by water-clear
usually thirst-quenching I do actually
sometimes have some other sponsors and
there are often YouTube ads but I know
what I was gonna talk about my shirt but
it's you know I got this shirt from one
of these online stylist things that like
advertise on a lot of podcasts and stuff
and I really like it it has a little
flamingo here it's like I never buy new
clothes but the fitment but I didn't I
thought oh I'm gonna wear this on Friday
I'm gonna be back at the code grades my
nice new
shirt I didn't think it's blue shouldn't
be a problem
this is green back here see look that's
green oh wait this is actually not this
is me actually removing the background
and put it green there so this isn't
actually the wall I had a view of
there's a way that I can show you the
actual wall which I really shouldn't do
right now because I should be doing
coding but you know anyway really I mean
you should know by now that it's not
gonna be any coding for like at least
another 30 minutes
a green settings no no where do I go for
this filters I just temporarily turned
the filter off well I could actually
play with it here maybe I could get my
shirt to be less transparent so how do I
just want to disable the chroma key
there we go okay so I disabled the
chroma key this is what look I feel like
this is a very different color I'm
wearing a blue shirt this is a green
wall and yet somehow there's just a
little bit too much there disable the
filter okay um so let me put the filter
back on so there's so here's the thing
normally I would have just gone and
you're like okay well I always I you
know I'm the kind of person I don't know
what kind of person you are but the kind
of person who wears a t-shirt under the
shirt I mean sighs like just wear a
t-shirt I wear a t-shirt under the
t-shirt yeah maybe I've all done that
before I've worn a t-shirt over a
long-sleeve t-shirt
anyway I'm the kind of person who wears
a t-shirt under this shirt so no
problems excuse me for the microphone
here that I'm just gonna have to move
don't worry I'm not this robing so I
have this other shirt on but I can't
wear this other shirt for a number of
reasons number one is I didn't even pay
attention oh sure I was grabbing number
one is this is a shirt is like kind of a
copyright violation so I'm not gonna
show you the whole shirt it also has a
green stripe in it so that is really let
me put up like a web browser I'm sure
this is really fascinating all of you
really this is what you tune did for I'm
sure you can see here look that has a
little like strike there
so that that option is out hold on me
button this back up try to put this back
on somewhere here so I don't know I'm
fine with being somewhat translucent but
then I think okay when I release the
video and I release the edited videos
and the coding challenges every single
comments it's gonna be your friends
loosing your translucent your trans as I
can see three I mean there's this one
there's one I did one coding challenge
wearing if I can find it
I had these like rainbow headband and
sweat bands there's the rainbow headband
yeah yes I have this rainbow headband
and if I put that on you can see that
like it separates the top of my head so
I need somebody somebody needs to get me
I would really love to have like a some
I don't know why I'm like headbands I'm
gonna I never said that sentence before
in my entire life before right now but
it came out of my mouth I think it might
be true but I need one that doesn't have
green in it all right
I have my ukulele still but I it's been
sitting here I've been playing it for a
month
alka in the chat is saying just go over
to makeup and wardrobe and get a new
outfit wouldn't that be nice I do
actually have a couple hoodies here oh
wait what is this oh no that's a plastic
bag so I have this unicorn hoodie which
I believe is just from hold on I don't
know where I forgot where I got this my
wife bought it for me I think but I
forgot it was like it was just from like
some target it's from Target
I think not a sponsor Kotick train is
brought to you by h2o is it 2h + 1 hour
is a 2o + 1 H and if it was I pretty
sure it's 2 agent 1 Oh but if I get that
wrong
hmm thank you okay now and then I have
this coding training hoodie actually
probably downstairs I have also my ITP
camp on it anyway I don't know what to
do
anybody have any suggestions unicorn
hoodie go you're missing an if-statement
you want to get a shirt with a big
circle people are you know I also I like
the eye light I really like this unicorn
horny but then I feel like if I wear the
unicorn hoodie then I don't know then
all people do is talk about the unicorn
hoodie and really I'm you as it's quite
evident and obvious this she's a live
stream about coating it is educational
it is to be taken very seriously and you
will words is there green in it hmm
alright so now it's also like this is
way too hot it's like summer oh I can
tune the filter alright alright sorry
I'm messing I'm like probably making
horrible sounds no matter what it's like
nonsense I do hear somebody's always
asked in the chat how come you don't you
see sharks in unity well alright so
there's the unicorn hoodie I need to do
some stretching let's see if I could
just briefly briefly tune the filter
because I would like to wear my new
shirt my new shirt from my personal
stylist who knows me really well on the
internet sends me clothes once a month a
box
if I keep all that might get a discount
all right uh all right so help walk me
through this everybody okay so I'm going
to green a Canon filters all right
I'm now going to chroma key and now I
see I see key color type green
similarity between 1 and 1000 smoothness
and these are settings and open
broadcast studios really smoothness
between 1 and 1000 so similarities said
400 smoothness is set at 80 key color
spill reduction is set to 100 Oh anyone
could possibly sponsor this content
right now is beyond me but thank you
John Petrelli
by the way what's wonderful about you
should wait a little longer let me see
if my kids got home yet because the
lights anybody who's thinking about
sponsoring the lights in my apartment I
just move to a new apartment I got all
these philips hue lights they blink
whenever somebody sponsors I couldn't
get that set up here at NYU because of
all the security yes I think they are
let's see they oh not yet they are a
couple blocks away so if anybody's
thinking of sponsoring right now just
wait like 15 minutes I just you know
because it'll be fun for them they'll
see all the lights
blinky blink oh I was I was talking
about something important ah yes okay so
now hmm key opacity 100 contrast zero
just wiggle the sliders it'll be great
okay what this is definitely gonna work
I'm gonna wiggle the sliders you're
gonna tell me when it looks good now
we're gonna work cuz you're at a
different time than me but I'm gonna I'm
just gonna mess around her second let's
just remember 480 100 114 no just you
remember is 480 100 blue this is what
happens when I make it blue King
can you see okay what is this did this
actually update your view I'm waiting to
see if the chat okay so the chatted so
this is definitely updating it magenta
oh okay that's good custom Oh custom so
how do I take a little change so the one
thing I could do is it's that green and
I can like mess around with this so like
you know I am now my I have no longer
translucent but there's more of a shadow
behind me so splitting the difference
here that's a little bit better yeah
that works
the similarities smoothness also key
spill color reduction whoa I like that
hold on whoa what was that at 40
oh my god did I make it better
I don't think I'm translucent anymore I
have a weird shadow behind pizza because
of my poor life eh I don't know I make
it better did I make it worse I should
talk to you you're the person watching
to get the dirt you can always add more
key effects to get the darker airs
specifically alright but if I stay up
pretty close here actually I think it
looks pretty good alright now here's the
real question
I usually like to keep this laptop so
that it doesn't block the view looks
pretty good there's something here oh
this is my melon I'm a little afraid of
eating this melon now it's just very
like soft you know what I think the
melon the melon shtick is done for today
yeah just put this to the side
I don't know hair just put it somewhere
out of the way over here maybe alright
hello welcome
it's the coding train on Friday and I am
going to do some coding my name is
Daniel sheath mon and i am in the habit
at least hopefully once a week although
in the summer i'm missing some time here
and there of coming on this platform
called YouTube and live-streaming with
some equipment and typing on my computer
and doing tutorials or trying to code
various things I
I I and I'm just sort of curious here
I'm gonna go to Twitter / Schiffman for
a second and oh what am i logged in as a
let me vote
I'll just vote for this all right so
these are okay so there are a bunch of
things that I'm thinking about doing and
I also I need to look up over here I
kind of believe that I might have also
written out some other ideas and view on
watch page in the description possible
topics workflow is the only thing really
missing from here recommend sequence
mobile net convolutional layers workflow
okay so one other thing here so here's
the thing let me get myself a little
organized here so one thing that I would
like to do the thing that I'm going to
start with probably is the recommends
sequence and if anyone could help me
with some pronunciation there be
appreciated because I I you know I like
to try to as often as possible have
standalone coding challenge videos that
produce some mildly interesting visual
result that people can remix those are
certainly the most viewed videos on the
channel um it's it's quite remarkable
how many more views they get relative to
the things that are like my twelve point
part tutorial series on building a
classifier with fence or float yes but
I'm not so sure if views is the metric
that I should be using to measure you
know the value or worth of a video you
know so maybe some of these longer
tutorial sequences in the long term are
better for the world then a video that
gets a lot of views cuz it's Tim as long
and makes a pretty picture
I don't know so but I do if you keep
these channels going it just hopefully
do those coding challenges they tend to
get a bit more traction so that's what
I'm gonna work on today this is the
second time now also that I will be
taking inspiration from the number
file I did this sandpile coding
challenge based on a number file video
this will be based on a recent
numberphile video on this number number
sequence okay now so that's number one
number two is I kind of feel like I
might as well do it like a
coding challenge at some point like it's
a thing that I know and it produces
interesting results I think I could
build it in one video I should do that
so that's there on the list it's been on
the list for a while in terms of my
machine learning long term project to
try to like step through and by the time
I get anywhere I'm sure everything I'll
have done will be out of date but
nonetheless if I go to the channel page
and scroll down a bit and go here too by
the way somebody in the chat earlier was
asking oh don't you have any beginner
tutorials this is where I would start if
you're a total beginner to programming
actually in the fall I'm going to be
remaking a bunch of these videos because
the stuff has come out of dates in the
fall coming soon some sessions for total
beginners this is my machine learning
set of playlists and the last thing I
did was tensorflow das classification so
I built a classification model attention
for address the next thing that I want
to do is build an image classifier with
tensorflow chess using the Google
quick-draw data set so I'm going to not
write a convolutional neural network
from scratch I'm gonna build one using
tension flips yes but I wanted to make a
couple videos about how the elements of
a convolutional layer work and I might
just use processing for that to show the
different image processing pieces it
bothered me this noise over here is
bothering me so much I have an idea
this light is pointed in like a weird
direction will that help mildly better
oh wait no yes mildly better okay yeah
people someone is asking in the chat
John sizing can you redo your processing
tutorials yeah those are really old and
the quality of them terms of the
production quality Pro X quality is that
great right now
that's clearly evidenced by be trying to
tune the green screen live but those
really could use a refresh I'm not so
sure what to do about that often think
about that I would like to do that it's
just sort of limited time here and
things that I can do they do the reason
why I'm les
les has changed I mean in terms of the
syntax so they do still apply the IDE
looks totally different in the video so
I have much less gray hair but alright
so so that's the other thing here ml5
the project is coming I want to do a
whole tutorial series about different
aspects of this ml5 machine learning
library which is a beginner friendly
library built on top of tensorflow
Digest I don't I'm not really ready for
that but I thought I should at least
like I could do like a coding challenge
where we get image labels from the we
classify images coming in through the
webcam according to the mobile net model
so I might try to do that and so those
are the things I have on beach I also
would really like to update my workflow
and look at kind of improved sort of
console terminal features and you look
at using I term I I get a lot of
recommendations to take a look at Visual
Studio code and some features that it
has that might be useful in terms of
running a live server and having a
preview pane so I know those things can
also probably be done with Adam so
that's those are all the things on my
list for today but you know it's been a
half an hour so I got to go no I'm just
kidding Sammy Haas for better melon I'm
pretty sure that also flashes the lights
the super chat so we'll see I'm going to
see if I get yeah oh boy there's aw oh
yeah there's an interesting discussion
going on in the slack channel here for
sorry let me just let me just see
okay
I'm Austan in the chat is reminding me
to mention which I I mean it's not
reminding me to mention I've is
mentioning and I've reminded to mention
fun fun function mpj has been doing a
set of let's look at videos here
yeah part one part looks like there's
three parts out so far I would
definitely recommend these I believe mpj
mentions that some of the inspiration
for this came from some of my early
perceptron videos and so this is another
and by the way if you want to this is
the comment I get all the time why don't
you just do stuff with plain JavaScript
you always use frameworks and libraries
you know just like I'm the kind of guy
who wears a t-shirt under the shirt you
know added protection I'm also the kind
of guy who the kind of person who uses
Josh Rick Aman sequence
so let's first there's like that website
that's the number sequence website like
so online it's like encyclopedia of
integer sequences this is like this is
like the greatest thing ever you know
from from a person who whose favorite
book is a book called a million random
digits you gotta love the online
encyclopedia there is a bit of a dark
shadow in the top right oh yeah that's
not good all right let me I got a time
sorry
tweak the settings a little bit that
this is this over here you can't see it
this over here is going to be a problem
filters I'm going to back out of can't
tell what's gonna make it better let's
just make this hold on
I'm gonna put this back
okay hold on I am going to be doing some
tweaking here so I'm translucent again
okay you can sponsor I mean if equity
was waiting there hope to see the lights
flashing all right so that makes me less
translucent but it's more noise I wonder
if other thing I could do is what if I
do select color oh look at this can I
not just click in the window and get a
color if I make it darker no that's bad
let's go for 375 I'm still translucent
in 375 65 that looks better so 65 I
think it's just enough to like not get
my shirt okay oh look at that
I could crop that out but then I have
less room to move over here I could crop
that out I'm really wasting a lot I'm
never on that side very much hmm good
point
let's see green cannon walk man oh no
that's making you smaller how do you
crop instead of shrinking
for president is asking how long until I
get slack channel access for subscribers
shouldn't it be instant unfortunately it
is not instant it's a manual process and
even worse than that I don't it's if you
subscribe to her patreon I actually like
get your email instantly but if you
subscribe through YouTube I don't get
your email I just see your user name on
a list so if you go to the community tab
there's a sponsor's only post you can
see that has a link to a Google form
where you can enter in your email and
then I'll send you a slack invites sorry
I don't have a better system than that
if anybody who I don't know if anybody
who's in the chat actually has
permissions to add somebody right now
but you could there's a system you can
work out I'm happy for that to be worked
out oh yeah Bruno makes a great
suggestion I have two extra screen with
a live webcam at home we hold on I'm
trying to crop do I have a soft light to
direct at that edge of your background
hold the Mac equivalent of alt then I
can drag the edge okay
the Mac equivalent of alt is that oh
that's option I think there we go crop I
[Music]
don't know I'm really getting into too
much monkey business today but this is
good better better this needs to go down
a little bit okay do I have a soft light
I also do I don't know a soft
I have a clip light with no bulb I have
oh you don't have I do actually maybe I
have these like light things which I
think I should wear this is probably
like some sort of good exercise to
balance I can do this but I do have
let's see
I have this which is like this like led
like very not so powerful LED light
thing anyway I don't I think I should
give up on trying to make this better
right now
and actually make some content what is
this so much weird stuff in here this is
like a bulb that's burnt out I guess by
the way anybody recognized this in the
olden days of this channel I had a
button that I would press to change
cameras now I have something called a
keyboard with numbers on it okay a clip
without a bold is pretty soft alright
okay alright ah okay
online encyclopedia of integer sequences
let's look for recommend a here we go
okay so we're here and then we should
reference the numberphile video and the
[Music]
and the look this 589 people watching
live now and let's see what is that
recommend mathematician I forgot the
full-name Bernardo Bernardo recommen
whoops I spelled that wrong here we go
let us not translate this page let us
put this here so this I think is
everything that I need to reference
then I also need to get a project going
we will not be using any new workflow
right now and let's run a little server
and let's minimize this say background
the zero let's have a console open and
let's make this a little wider all right
I think this is going to do and we don't
need the libraries folder anymore what
version of p5 am i using zero point six
point one seems like that's probably the
most recent all right I think I am ready
okay all right
cycle the cameras
alright let's see it's only been 35
minutes now the thing is do I want to
have a visual to start with so one thing
that I might do with this here is I
might record an introduction to the
coding challenge after I finish the
coding challenge so I know for the live
viewers that can be a little but so what
should i what am I gonna say in the
introduction but I think I want to
explain it so yeah so alright
I think it's that's fine I'll figure
this out I'm gonna go as if I'm not
going to and then I'm probably going to
anyway alright so yeah I'm going to
though so I'm just gonna say let's begin
but I'll talk about the fact that this
is a coding challenge when I do an
introduction to it later alright and
does anyone can anyone all right
before I begin Tim s you've done
anything productive yet nope don't worry
nothing productive be evasive but
anything productive happens but how
electronic all right
Bernardo recommen Santos for an American
how is that in terms of pronunciation
I will just sit your weight all right
Lewis writes movie n which I probably
completely mispronounced alright alright
I'm gonna do my best
this goes over here I'm gonna not look
at the chat I'm not gonna look at the
monitor too much I'm going to just over
here now
we have told me to get coffee guess what
I confused myself by this wanting to do
the introduction after the fact I don't
know okay alright so the idea for this
coding challenge originates from this
wonderful numberphile video about this
thing called the recommendations is a
numeric sequence a sequence of numbers
really like I keep a book that does lots
of million random numbers in it around
it sooo this me if soothe the soothed is
me it soothes me at nighttime but I'm
feeling stressed or anxious just to read
some random numbers and so this
particular number sequence is a
fascinating one is invented by a
Colombian mathematician named Bernardo
recommence Antos and you can find out
more about it at the guess what there's
a website which is actually the online
encyclopedia of integer sequences and I
think now possibly for the rest of my
life I'm just going to be at home
browsing this website know about this
till now so here's the thing I'm not
going to go too much into the background
of this numeric sequence or number
sequences I definitely recommend that
you also check out the numberphile video
I'm really just gonna try to code it and
visualize it that's what I'm gonna do in
this video I'm gonna do it in JavaScript
and if I'm feeling a little saucy
afterwards I might I might do a video
where we try to make something musical
out of the number sequence so anyway
okay so what how does that let me first
try to get my system to work let me
first attempt to just describe to you
what the number sequence is now for a
number sequence is just exactly that a
sequence of numbers like 1 2 3 4 5 6 7 8
9 that's a integer sequence counting up
by one
there's the Fibonacci sequence 1 1 2 3 5
8 right where you add the two numbers
before and get the next so
maybe you want to pause this video right
now and invent your own number sequence
this particular this recommen a numbered
sequence is particularly beautiful and
interesting as a kind of this strange
balance between order and chaos
so you know anything that has a nice
this dialectic quality of having both
order and chaos is always fascinating to
visualize well mostly all these I think
all right so let's say we have a number
line and I'm really just regurgitating
here a bit of the explanation that is in
the numberphile video in my own words
probably not nearly as well 0 1 2 3 4 5
6 7 8 9 10 and this could in theory go
on to infinity oh boy pause there's like
a giant a glare right there it's
actually not so bad is that a problem I
think that's actually fine I moved a
light to try to get rid of that I think
I'm just gonna I think I'm gonna leave
it alright apologies there's a little
glare there but I think everything's
gonna be fine
alright now let's say I have a counter
and that counter is gonna start at 1 the
idea here and it's going to go up 2 3 4
5 6 now for every number in the counter
I'm going to try to go backwards but I
thought if I I'm going to start so I'm
going to start right here and I'm going
to attempt to go backwards if I can go
backwards by this number of spaces and
land somewhere that hasn't been landed
on before great I'm gonna go there if
not I'm gonna go forward this seems
weird and I don't know if that
explanation made sense but it's going to
make sense to you if you keep watching I
hope I think all right so one I'm gonna
try to go backwards there's no spot
there's no negative numbers in the
sequence so I can't go backwards
I'm gonna go forwards I'm gonna go to
here so my sequence is now 0 1 now I'm
going to go I'm gonna try to go
backwards by 2 1
- uh nope I can't so I need to go
forwards by two so I'm gonna go here
three now I'm gonna try to go backwards
by 3 1 2 3 up no that spot is take it
that spots taken I can't go there I'm
going to go 1 2 3 4 now I'm gonna try to
go back four one two three guess what
guess what this spot is open so I can go
backwards for it now in the
visualisation of it I'm going to want to
draw the moving backwards below in and
this is an arbitrary decision it's sort
of the common way to visualize this
sequence it's certainly what's done in
the numberphile video the point of these
showing this choose to code it but you
might invent your own way of visualizing
this but I can go back for now by the
way I forgot to keep updating this 0 1 3
6 2 and then now I'm gonna go forward 5
no I'm gonna try to go backwards 5 I
can't there's nothing there so go
forwards 5 1 2 3 4 5 so now I go here so
we can see how this goes and this is now
now it's just double check so so on and
so forth so I could you know I could
keep doing this it's gonna be a bit
easier for me to write a computer
program to do this then for me to do
this manually on the board first of all
I really really hope that I didn't botch
this so I'm gonna go check though it's
like a PDA and see if this sequence
matches what's there oh boy oh boy oh
boy oh boy
I have a good feeling about this oh wait
here we go zero one three six two seven
zero one three six two seven okay we're
good I think we can write some code now
all right pause I'm gonna pause for a
second here I'm just looking at the chat
to see if anything is if anybody saying
anything really important I don't think
so
so I'm gonna move on in code
okay I need to turn off the
notifications on my watch all right all
good yes there must be a disk I see that
K week monitors wrote in the chat I
don't think it has any applications the
joy of pure math should be enough now I
don't know what the question was but I
can imagine what the question was
yeah this is that's a this is a an idea
for an algorithm that produces a
sequence of numbers and there's I think
we can ask this question are there any
applications of this does that sequence
have meaning I mean you could say the
same of the Fibonacci sequence what why
why why should I care about that
sequence well that's a sequence that
actually appears quite often in nature
in in different patterns found in nature
so I think you know the interest
equations there's so many different
number sequences and thank you to NJ a
slow for cyclopædia of integer sequences
all right all right so let's begin and
write some code that's going
[Music]
all right so let's begin it and write
some actual code now so here I am in a
JavaScript program with the p5.js
library loaded I what do I need so I
need to keep track of if I go back to
this I need to keep track of the number
sequence will be nice to keep track on I
want to keep track of the counter like
what spot of my own I need to keep track
of which spots have been landed on or
not so I am going to
so I have a problem I don't know why it
happens oh you know why it happens I
don't know why it happens they just not
anywhere near the buttons to play the
sound effects all right so I'm going to
say let numbers this will be an array
that's going to basically have a value
in it you know something like this for
every spot that's been landed on that's
kind of my idea so I'm gonna have that
then I'm going to what else do I did I
say I need that I needed a counter
that's gonna start the counter is going
to start at 1 and I guess this could
like have true in it to start because
the zero spot by definition is what's
been landed on at the beginning let's
see how is that and then let me just say
what is the sequence this will be the
sequence
so let's write let's let's write let's
use the fact that p5 Luc's automatically
with the draw loop but let's write a
function called step so oh and I need to
keep track of where I am so I get
something to call that index because I'm
think of it as the index into this array
and so actually what I'm gonna do is at
the beginning I'm just going to say
numbers index equals true because that's
where I am and every time I want to step
the first thing I'm gonna do is I'm
going to say num index minus or I'm
going to say I'm gonna say next equals
index minus count this is me attempting
to go backwards right and then I will
say numbers oh I will say if numbers
next if it's been landed on or if next
is less than 0 if next is less than 0 or
if it's already been landed on then that
is no good next needs to equal index
plus count and
then I can simply say numbers next
equals true because that's now a spot
that I've landed on and the sequence I
can add to it the value next and then I
can say index equals next so let's do
this for and actually let me forget
about draw for a second let's see if
this algorithm works let's say for let a
equals 0 I is less than 10 I plus plus
step let's just do this 10 times and
then say console dot log I'm sure I've
made a mistake the sequence so this is
my idea for the algorithm we try to go
backwards if that is a negative number
it's no good or if it's a place that's
already been landed on then I need to go
forwards I need to set the forward spot
to be true I need to add that to the
sequence and now that's my new my next
spot and so I suppose in addition to
saying numbers index it is zero
technically the first number that's the
question
zero is the first number so I also want
to say a sequence dot push index in
setup so let's run this code and see is
this the sequence no no no no no no no
that is definitely wrong oh I could see
in the chat Sora's ink count didn't
increment so I forgot a really crucial
step right the whole point of this is I
go forward once then I tried then and
twice then three times then four times
trying to go backwards I was always an
increment counter so it's just going you
know trying to go backwards once each
time it's never going to work all right
okay good mistake are good mistake to
have so I am now going to say when do I
want to do that I guess right at the end
I just say count plus plus right I just
want to the next time I want two steps
that's probably count I don't know if is
the right variable name for this could
be like number of steps but all right
now let's try this again and let's see 0
1 3 6 2 7 13 2012 21 11
0 1 3 6 2 7 13 2012 21 11 the next one
should be 22 let's just double-check
this a little bit more and see if I've
got 22 all right woohoo I feel so much
confident that at least programmed an
algorithm to generate that number
sequence so now we are ready to
visualize it okay this is the fun part
or that's all the fun part for yeah any
of its the fun part for you alright so
let's think about this so one thing I'm
gonna do is I'm gonna take this out of
setup and I'm gonna put the step
function in draw and let's just say
console dot log index so we can see if
this is kind of doing what I expect it
to do yes so this is the sequence now
this is the rickum on sequence just
going and going and going you see the
numbers are getting bigger and bigger
and bigger over time because that count
value is always increasing all right
whoops I didn't mean to close that I
don't know what's in that history
although this is only use this browser
for making these tutorials that's all
right all right here we are all right
okay so I'm gonna take out this console
log refresh now what do I want to do now
each time I need to draw right what I
want to do is draw an ellipse right so
let's say I'm trying to draw an arc
actually let's say I'm trying to draw
this one here between 3 & 6
well I know that the I could use the
ellipse function the ellipse function
and I need an X or Y in the diameter so
the X the Y is gonna just be a fixed is
I'm gonna do this plot this on basically
a horizontal number line the X is going
to be the 4.5 these start plus the end /
- right the center and the diameter of
this circle again this is just a way to
visualize it maybe you want to do it it
totally
the R will be an ellipse with diameter
of 6-3 the end the next - the start so
if we think about this what I'm what I
what's important here if I'm going to do
the drawing right here the diameter is
next
- index the x-value is sorry the x-value
is what did I say next plus index / -
this is assuming there's one pixel per
one pixel per number and then I could
draw an ellipse I'm just gonna draw a
full ellipse now at X the Y is I'm just
at the Y at 0 and with this diameter
what did it what key command did i time
out for a second what key command did I
hit that's like got this weird thing at
the bottom now like I have something in
the view panes yeah what does that
always been there I just only noticed it
now
where is that
Oh interesting Simon is giving me a good
comment in the chat about different ways
to visualize it just though technically
though the numberphile video am I
correct that the numberphile video goes
above for forward and then below for
backwards or does it actually just oh it
alternates each time I'm wrong about
this
ah alright but that's fine I can fix
that that's fine oh so the numberphile
video actually does that it doesn't I
don't know why I was thinking it goes
above okay thank you
that is a very good point command+
no oh it's gone now right all right all
right
command + . command + comma oh there we
go
okay I think I am back tell me if you
see me I'm gonna try to get my computer
screen back yeah and then get the chat
back open up Chrome and say history here
we go oops
um okay great thank you I can see I'm
just gonna put the chat over here so I
can see it close this close this okay so
I assume it froze while I was whoops
trying to figure out this command period
thing to get that this bottom thing
appeared right so I'm actually good in
terms of continuing the live stream like
I didn't lose any of the actual coding
of the recommence
all right hopefully that's correct
correct okay okay so I need to keep
going here all right not rested I'm
seeing more people I'm still it's still
working right people are saying it froze
again let me look at least look here
yeah it says primary stream bad we are
not receiving video data at a fast
enough rate your viewers may experience
buffering ensure your connection is fast
enough or consider using a lower bitrate
so I am going to I'm gonna just keep
going because I think it's just a little
wonky right now but it is not crashed so
alright okay
okay so let's see what happens let me
add a stroke of 255 no fill and let me
just see if what happens if these
ellipses start appearing and the other
thing that I should probably do is right
oh I should just make the Y the middle
of the window okay so and actually you
know what I'm gonna do well that's fine
this is fine this is fine okay we hit
refresh and we can see okay circles are
appearing so this I think this is
already somewhat interesting that you
can see this pattern that's emerging
just from visualizing the the recommend
sequence on a number line between 0 and
600 and eventually we won't see anything
anymore because the numbers are getting
way too big but let's try to make this a
little bit more interesting and so I
actually misspoke earlier I had watched
the numberphile video earlier today and
in some reason in my head I was thinking
if I'm going forward I'm gonna go on the
top if I'm going backwards I'm gonna go
along the bottom and I think actually
what what the comp that standard
visualization or the one that's in that
video is just alternating so I go
forward I go forward I go look sorry I
go okay I go forward above then if I'm
going forward I go forward below then if
I'm going backwards so it's always this
it's more of a continuous loop so let me
try to implement that so one thing first
of all is what if I just want to draw
the top of the circle the arc above the
number line or below the number line
well this is actually easy thing for me
to do I can just change to using the arc
function instead of ellipse I'm going to
have to specify both the width and the
height but now at the end of this I get
to have a start and an end angle so if I
say between zero and 2pi that's between
zero and 360 degrees that's the entire
circle so this this should look exactly
the same but now if I were to say just
go from zero to pi we can see here look
I'm always getting just the bottom now
if I were to go from PI down to zero I
am getting the
so what I can do is I can say if count
modulus 2 equals zero do it one way
otherwise do it the other way and
there's probably more it might be like a
more elegant way of doing this but this
should be fine so let's I think I want
to start the first one count is 1 and so
that should be going I think I want to
do it this way I want the first one to
be over the top so now we can see there
we go so this I believe should match
precisely the circle starts with down up
someone's telling me okay so let's try I
mean let's try with count up once again
this should be precisely the algorithm
of a visualization that you find in that
numberphile video if I got something
wrong I'm sure I'll hear about it in the
comments please let me know now let's
see there's so much more to do with this
going so far
I don't need the index I could just use
the array length that's a good point
alright alright
sorry alright so this probably should be
the end of the video and I should be now
giving you some exercises but I couldn't
so you should pause right now and try
something if you're following along
couch what if like right now this I'm
only seeing the results here because I'm
layering each ellipse over and over
again but what if I want to animate or
change the scale like what if I want to
sort of shrink the space as I'm drawing
more and more circles I'm gonna need to
store all of these arcs in some sort of
data structure so I'm actually gonna do
that right now just to add a little bit
more to this video and then I'll give
you some other ideas of things you could
try to do at the end so what I want to
add to this is I want to create another
array I'm just going to call it arcs and
I'm actually going to create an arc
class I'm gonna use a little
object-oriented programming so what
makes up a particular arc well it has it
has a start and it has an end and it has
a direction so I'm gonna say this dot
start equals start this dot end equals
end and this dot direction equals
direction so then all this drawing thing
or I could take all of this drawing
stuff and put it in a function in the
object called show and the difference
would be this would be saying this dot
and minus this dot start oh you know
what I should be doing the end can be
this is a little bit this kind of worked
by accident but this should really be
absolute value right because the end
could be before the start this would be
a negative number I think p5 doesn't
really care it's like negative diameter
is the same as a positive diameter but
that's probably better for me to put
this in here and then I'm just gonna say
if Direction equals zero I have the
direction be zero or one X is also this
dot and I shoot
this dot n Plus this dot start / - and
so this should be good now and so what I
want to do here is create a arc between
index and next with the direction that
is what did I say count modulus - okay
so this is what I want to create I want
to say arcs push a and then in draw I
can now set the background in draw and
I'm just going to say for let um all the
arcs I'll just call it a of arcs a dot
show so this your beat I did this kind
of quickly but basically if what I did
is I just took the drawing code that I
was doing kind of like live as the
algorithm was going and I encapsulated
the idea of drawing one of these arcs in
an object and then I build up a big
array of them so now I have this big
array and every time through draw I want
to draw everything in that array and
this is going to allow probably you if
okay direction is not defined this has
to be a forgot the vista obviously
alright so this should be exactly what
we had before but here's the thing now
this is actually an animation so let me
try something what I have this idea
which is I want to actually scale scale
the visualization according to how far I
am in the sequence so for example what
I'm going to do now is I'm actually I
think it might help to draw the arc
everything centered around the left side
of the screen so I'm going to draw the
arc at 0 in draw I'm going to say I'm
going to say translate 0 height divided
by 2 and then I'm going to use scale so
the scale function for example if I were
to say scale like 5 that's gonna draw
everything at five times the size at
five hundred percent so you can see it's
already like
thicker and bigger at the start if I
were to say scale 0.1 you can see
everything is really really tiny now
it's being drawn at 10% so what I want
the scale to be right I have a window
that is 600 pixels wide and so that each
pixel is one number in the number
sequence
I want the whole number line if I've
done five numbers I want that to be the
width so I think I can actually just say
scale with / count that should do it
whoops yeah so now you can see it is
like live adjusting itself to how how
many numbers I've done so far and let us
let me give myself there's really no
reason let me give myself the full is
this how I do this in p5 the full window
width and height and let me actually
also say style body
oh boy I do not know CSS margin zero
it's not going to do it I just don't
want to have any padding is it is it
padding is it a margin no no padding is
this how CSS works no somebody tell me
how CSS works
no on the CSS comma oh no I need these
padding:0 semicolons yeah pick say
pixels is this does this call and go
here no : no : there we go no : so and
let me make the I feel like the let me
let me say the stroke wait let's try I
mean I shouldn't try to get into
anything that's to do with the visuals
well let me just make the stroke weight
a little thinner because maybe it'll be
interesting to see some space between
them and let me get rid of here and let
me save refresh and now we can see this
is chi mean this to me is sort of
interesting
to see this sequence now here's the
thing this is actually what I would like
to see what I would like to see is
instead of right now I'm just stamping
the entire arc but I think it might be
really beautiful to watch if I actually
animate each arc you would also be much
slower like right right now to slow it
down just as sort of like a bit of a
kind of hacky solution I could say
something like frame rate five it'll
look very stuttery we can see you know
each one is being applied one at a time
but what if I were to actually see that
full arc kind of animate itself I think
that would be kind of nice so if you
watch the numberphile video you'll see
people have made like coloring pages out
of this and done all sorts of
visualizations I mean to me like
animating it thinking about color it
could this be polygons that have fills
to it
could you put this into like 3d space
where the Z is changing over time you
know maybe you want to draw something
that's not just an ellipse or an arc or
maybe all the arcs are lower I think
there's probably a lot of possibilities
there here's what I want to do I want to
do so I hopefully you'll do something
hashtag coding recommen share with me
your gifts and animations and
screenshots on Twitter and in the
comments here and through the website
contribution system I'm gonna do one
more coding challenger and do this again
but instead of doing something visual I
am going to play each one of these
numbers in the sequence as a musical
note and this is not my own idea this is
also an idea that is talked about in the
numberphile video and produces the kind
of spooky quality to it okay thanks and
I'll see you in coding challenges
recommend sequence part 2 music edition
all right it's very slow right now by
the way all right um
questions show it fullscreen yeah I
probably should do that all right so let
me do this let me record an intro let me
actually do it much slower
hello you were about to watch a coding
challenge to create this pattern think
be slow frame way it was kind of
pointless and let me just say what's
like I think if count is greater than
window with just say no loop let's try
this just hello welcome you are about to
watch a coding challenge to produce this
pattern which is a visualization of
something called the recommend sequence
so this is the end result I'm this is a
little experiment showing what happy end
of this video and now watch the video is
that too short uh it was like I rushing
through it let me let me do another one
just case hello you're about to watch oh
I feel like I just needs the train
whistle or the melon or the the headband
don't tell me it's like seven o'clock
already and all I'm gonna do today is
just this one coding challenge but might
that might actually be the case I'm not
gonna do more I just don't know what
happened to the train whistle do you
think someone came
oh no it's hiding over here add colors
yeah I think I won't I guess I could add
colors I I had some complaints I'm not
gonna add colors
hello welcome to a coding challenge the
recommend sequence I just completed this
coding challenge it will start in a
moment the project that I attempted to
do is a visualize a numeric sequence
called the recommend sequence I'm going
to explain it to you this is based on a
number file video that I will link to in
this video's description as well as lots
of other information and there will also
be a part two of this that you can watch
after you watch this one if you want
alright so this is the end result I
think that you after you watch this
could make many more beautiful versions
of this with creative ideas that I
couldn't possibly imagine so I hope that
you do and share it with me on Twitter
hashtag coding recommen see ya after
this intro please scale it down to the
biggest number of this series not the
counter oh shoot
that is so a such a good point so how do
I let biggest equal zero yeah
Oh index yeah so here if shoot this I
really should be doing in the video
if index is greater than biggest biggest
equals index and then the scale should
be biggest divided by count let's try
this what did I get wrong there bitrate
is dead make a tiny full video oh is
that gonna kill the bitrate what did I
do wrong there
Oh with / biggest what I that was just I
don't know what I wrote there yes this
is what I meant
shoot so let's see yeah okay so first of
all is this gonna survive bitrate wise
well this is much better processing
would be weighted do this in processing
I just wanted to do this because I was
gonna use the p5 alright hold on hold on
everybody so we're gonna have to deal
with this
okay guess what guess what this video is
not over yet I realize in the chat I got
the comment which is I can't believe I
didn't think of myself which I actually
I can because I never think of these
things well I really shouldn't be
scaling to the to the where the in where
the count is I should be scaling to
what's the biggest number that's been
been part of the sequence so far what is
the end of one of these circles I'm not
actually seeing the full sequence right
now so if I go back into my code and I
add something which I just did if I have
a variable called biggest equals zero
then what I can do is each time through
step I can check it's basically if index
is greater than the biggest number then
I want biggest to be that new index and
then here I want to scale not by the
count but by the biggest number so let
me add that in hit refresh and you can
see now I know I max this is what I
meant to show you this is now I believe
the visualization that you will find in
the numberphile video so what can you do
I hope you will make your own creative
twist on this you can think about
different ways of visualizing this
besides just arcs you could think about
using color you can think about putting
this in 3d space I mean what would the
z-axis mean in terms of visualizing this
I would love to see it animate right now
it is currently just you know this stamp
of each ellipse one at a time
what if you drew animate the full of its
arc one at a time what if you animate
that arc so ship make those exciting
different versions of them to share them
with me on Twitter hashtag coding
recommen and there's also if you look at
the coding train dot the Cody Trent comm
webpage that's in this video's
description there's a place with
instructions of how you can submit your
own version of this there as well okay
so I hope you enjoyed this coding
challenge I am going to come back in a
moment
and I'm going to do one more version of
this but instead of visualizing it I'm
going to play it as musical notes and
those musical notes are will sounds like
something I forgot what I was talking
about and this is
so something that's in the numberphile
video and I thought it'd be worth
exploring the p5 sound library as well
alright see you soon
[Music]
yeah I should lurk yes I should be
lurking yes I should be lurking I should
be lurking I'll add that I'm not going
to put that in I'm gonna make a variable
called scale I'm gonna say scale equals
lerp scale with / biggest 0.1 or
something like this and then I'm gonna
say scale by scale here we go that's so
much better
okay I'll leave it as an exercise yeah
all right but it's gonna be for the full
screen now here's the thing I'm going to
redo the intro does this is this gonna
be okay bitrate wise
yeah I could calculate yeah all right so
I'm sort of looking at the chats why
stop talking all right all right I'm
gonna record the intro to the intro
hello in this video you're gonna see me
do a coding challenge where I make this
visualization this is a visualization of
the recommen sequence I'll talk about
what that number sequence is how it
works and then write the code to draw
this using javascript in the p5 library
this is all thanks to and inspired by a
number file video which I will also
reference and you can find links to in
the video's description so I know
apparently it's spooky all right so that
was is it still going oh it's actually
still going that's crazy I really want
to do this in processing actually
because I could generate a much larger
yeah all right I am recording yes but
then when I upload it to YouTube it's
just going to recompress it anyway so
alright alright so I am pretty happy
with this coding challenge video now now
what I want to do so first of all let's
go here I think there's like a button
here where you can listen to it right
where is that
ah right am I crazy I thought there was
like a button where you can listen to
the number sequence listen
oh listen right here oh okay hold on
let's see if you hear this do you hear
this I don't hear it I'm not hearing it
hold on let me let me see if I can make
sure I hear it
sound oh it's downloading something play
as MIDI okay sorry so what's this kind
of open with QuickTime Player will that
actually work
cannot open played MIDI I'm now googling
play a MIDI file GarageBand I'm not
gonna open up GarageBand just to play a
MIDI file alright fine I I will break my
own program to play online upload mini
file oh boy this is bad this is bad I
don't like the looks of that website I'm
gonna have to write my own audacity will
play a MIDI file let's see about density
will
what ancient software is this downloads
bad bird is a MIDI file not an audio
file Oh file import MIDI file import
MIDI play play play today I see it I see
the notes selection start and VLC yeah
there's some party going on in the
hallway I don't know what it is there's
like summer camps and different things
going on here
VLC VLC you gonna play it
no suitable decoder can I export this
file export export MIDI - oh my goodness
alright yeah I can write my own MIDI
player I could open up GarageBand
alright I'll open up garage I don't even
know if I've GarageBand installed on
this computer but let's let's just try
that I actually kind of know wait I
don't have GarageBand on this computer
yeah I do not have GarageBand on this
computer there's YouTube videos with
recommend sequence audio yeah MIDI
upload MIDI file player let's try this
that's what
I like this website
[Music]
online sequencer net import all right
upload mini file
all right and the whole point is I was
gonna do this myself anyway so forget
about it I don't need to I mean
somewhere in this video oh yeah it's the
beginning
[Music]
okay this is good hold on hold on
I gotta get it so you can hear this I
got two sorry I'm confused here multi
output device think this is piping the
audio out through
hola hola okay all right here we go
so I want to make sure I um let's make a
second one let's call this viz let's
call this a music and let's go to here
and okay all right
oh I still have I have this awful it's
over here
oh this is where such a doofus I was
like changing the wrong light there we
go
better I think that's good now okay okay
I'm gonna do this or I can't do the oh I
think I you guys definitely hurt myself
there all right okay we're ready for
this p5.js reference we need an
oscillator with p5 sound there we go
oscillator an envelope this is what we
need yep and then we need okay all right
all right
oh this video is pretty good too alright
recommends sequence
whoops sorry hold on youtube.com watch
this is a really ridiculous way that I
am getting to this video but it shall
work
like this all right here we go everybody
let's cycle these cameras
all right people telling me not to dance
you know what I'm gonna dance
well Jeff we heard something there okay
hello I back for another coding
challenge about the recommen number
sequence inspired by this numberphile
video hola to the wonderful let me try
that again the only reason it sounds
spooky is because of the arbitrary
choices using a chromatic scale that's a
very important there's a very
interesting comment point three replies
boy they have like okay hmm
what's the alright hello I'm back in
this video I'm do another video about
the recommends in the previous video
what I did was visualize it and you can
see here this is me vision this is not
me but this is the p5 code I wrote to
visualize the recommend number sequence
as a continuous series of arcs it looks
like they're circles but they're
actually connected arcs you can watch
the previous video where I go and build
this whole code but one of the things
that people that you can do also with
number sequences besides visualize them
is create an audio version of them and
in fact if you go back to mine your
favorite website entirely in the entire
world the online encyclopedia of integer
sequences you know if I'm here on the
recommendation and it will give me a
MIDI file MIDI being a system for
encoding music as numbers so if I can
encode music as numbers and I have a
number sequence then I can make that
number sequence MIDI and then I can play
it as music so this is what I want to
try to do and I'm going to attempt to do
it with the p5.js sound library making
use probably and this I don't really
know that well so we're doing a lot of
looking up in the reference while I do
this learn to do it with an oscillator
to generate a sound and the envelope an
envelope to kind of craft that sound
essentially creating my own synthesizer
should also mention that um this video
was pointed out to me from Dale Gert
Amon
which is also visualizing the sequence
and a completely different way with
colors and also making it into audio so
I hope after watching both of these we
will see a world full of I mean I don't
know do we want this world I think why
not let's see a world full of
visualizations and audio versions of
numeric sequences okay so let's start
coding again I'm gonna close these
windows I'm gonna go here and let's
think about this
so do I want to I'm going to keep the
visualization going and basically so I
could start from this code I'm gonna add
to it and what I want to do is I want to
play a note so let's see if I how to
best to do this so the first thing that
I know that I need to do is I need to
create an oscillator an oscillator is an
object that will generate a tone and
there are different kinds of oscillators
right I it's basically a pure sound wave
and I can have a sine wave or a triangle
wave and I believe I have a video about
p5 oscillators that will go into that
perhaps a bit more but I thought what
I'm gonna do is I'm just going to take
this code exactly as is and I'm gonna
paste it in to set up your coding
challenge copy paste from examples and
then I'm going to create make that a
global variable and I'm going to
discover what interesting error I will
have now so p5 oscillator is not a
constructor why do I have why did this
come up why do I have this because I
don't actually use the sound library
that often and I didn't include it here
I should use it more often so I'm going
to go and add reference in my HTML file
to the p5 sound library so hopefully
that's gonna clear that error up great
it's going do I hear anything mm-hmm
so let's go to the sketch and why do I
not hear anything because I set the
amplitudes to zero let's set the
amplitude to one do you hear that
that is the oscillator the sign
oscillator playing the note playing a
note the frequency so now let's think
about this would I stop we have to get
back so what I want to do here is I want
to basically take the number and and
assign it to a frequency so this would
be kind of crazy but what I could
actually do is just to get started with
this is in the step function I could set
the frequency whoops not in setup in
step I could set the frequency to the
next number the index so that's gonna I
mean this is not gonna be that logical
but I could actually just use the
current value of the sequence as the
frequency I in setup I want to just set
the framerate to like 1 so it's just
changing it less often let's do this and
see what happens but instantly like I
heard something for a second and then I
don't hear anything anymore
so why do I not hear anything maybe I
will eventually oh is it really loud
oh boy okay I better go rerecord that
[Music]
apologies so I better go rerecord that
so there's a couple things I could do
why let me see here let me do this yeah
I'm sorry let me just tell me if this is
better warning headphone warning I'm
gonna have to go back and redo some of
this tutorial so I mean we could
probably fix the audio in post but I
it's probably better for me just to redo
it hold on is this okay
right yes Austin that's the point that I
want to make is this ok I just wanna I
want to know if this is a reasonable
volume and when I hit back does that
make out like a piercing horrible
crackle or anything too quiet okay what
was too loud before all right all right
all right right
I'm splitting the difference here
because people are telling me it was
fine before I was too quiet
it was fine before too quiet
alright I'm gonna look at the slack
channel which I've just to
piano key frequencies thank you
[Music]
that's good okay
all right I'm gonna leave it at this
okay oops I'm in the wrong place all
right so hold on let me go back let me
back up a little bit I'm gonna just back
up to where I set the amplitude to 1
okay so I don't know how this is gonna
add it together but Matt - we'll figure
it out I'm gonna set the amplitude to 1
at 100% volume and now we can hear that
sine wave
[Music]
okay very relaxing very soothing we
could try different waves like a square
and option I'm waiting for the
livestream to catch up to that
horrifying to that horrifying moment
sorry everybody
we won't use the square wave harsh okay
I want to try triangle okay
just warning you let me set the
amplitude to zero point two okay here
I'm about to try triangle
I think sign is gonna be the nicest
let me try this one more time everybody
all right all right all right let me try
this again
then I go home and have dinner I was
gonna do this from five to seven when we
had 20 minutes left I'm only getting
that nice list I made of all these
things I want to do I'm just doing this
but all right all right all right here
we go okay I'm gonna change the
amplitude to 1 and which is 100% volume
I'm hit refresh
so now you hear the sine-wave now
so what's what do I want to do here so I
have this and I'm gonna click back here
to stop the sound for a second I have
this number sequence that's going up we
can look at those numbers there 0 1 3 6
2 7 13 20 so what if I just took each
number and assigned it and took the
number in the sequence and made it a
frequency so for example as I'm stepping
through I could say oscillator frequency
index right index is actually the number
of that that's currently part of the
sequence so if I do this and go back to
here and click on this I don't hear
anything
do you hear something you might have to
have headphones have it turned up
eventually I think I'm gonna start
hearing something so here's the thing
there is a range of frequencies
frequency as being a measurement of how
many cycles of a wave per second we can
start to hear it I kind of like that
alright but maybe what I want to do so
it's an audible range of frequencies if
I search for this we can see like this
is generally you know this is we can
find out some more information about
frequencies but really what I want our
piano key frequencies like I want to
know what are the frequencies or MIDI
note frequencies is another way I could
think about it and we can see here oh
these are MIDI note numbers and these
are their frequencies and there is
actually a formula for doing this I'm
gonna pause for a second
ah soak a week - saying F underscore
zero frequency times two to the N
divided by 12th power ret reference
frequency meaning like middle C 432 all
right what should I use people MIDI to
freak index that's what I was going to I
go to the Wikipedia alright okay so
let's go back to this people are not
cheering for me by the way if you can
hear that let's go back to this page
food so following equation gives the
frequency F of the nth key as shown in
the table so this is real it's just time
out for a second this is way too
distracting um how how audible is this
cheering
so aunt ki this is the frequency the
square root of 2 the 12th root of 2 to
the N minus forty ninth power times 440
is that the which could be written like
this okay oh yeah this is what I want to
do so okay all right
it's very audible all right let me go
back a little bit to where I ended off
just sort of clicking out of this
[Music]
okay so for a while we didn't hear any
notes and then all of a sudden we
started to hear stuff so this is much
too arbitrary to just put the looks
elsewhere Oh No
ah I'm so distracted by the cheering
it's making me crazy okay so for a while
we didn't hear any notes and then almost
when we started to hear something so
here's I think it's much too arbitrary
to just set the number from zero to
whatever as the frequency there is a
specific audible range or frequencies
that we can hear and so and there also
are formulas for converting from MIDI
notes to frequency and back and forth
I'm sorry about this applause there's
nothing to do with me clearly there's
nothing going on in the hallway there's
nothing I could do about it right now
it's gonna be in this video forever but
um and so I pretty sure that p5 has a
like MIDI to frequency or two note or
something function somewhere but I'm
actually I'm not gonna use that I'm
gonna go to this Wikipedia page which I
have loaded up here called piano key
frequencies and if you look at this this
formula here I want to use this
basically if we number all the keys on
the piano from the very bottom key to
the top key I can't remember how many
keys are on a piano eighty-eight Keys
standard 108 key extended we can
actually find the frequency of any key n
through this formula sure we could think
about this in interesting ways but I'm
just gonna go and use this formula so
look at this I'm going to say so if the
if the recommen
all these numbers and I'm just gonna do
from zero to 88 like I'm not gonna let
it go forever if I consider each one
needs to be a key on the piano then we
should be able to play the music so this
is very distracting all right
okay so I want to say the the frequency
is and go back to this formula 2 to the
n - 49
okay so power 2 and n which is index -
49 divided by divided by 12 times and I
believe it was 440 it's for 440 I wonder
for 40 is like middle C or the note a I
think it's the tune to a 440 so a is
like the 440 is a Hertz is the is the
note a so so now if I were to say this
and let's console.log index and the
frequency just to hear it and I also
want to just go to setup and I'm gonna
if I already had set the frame rate down
to 5 and anticipation of this but I'm
actually set it to 1 to make it even
slower all right let's take a listen
do you guys hear those very low notes
I use index mod 88 that makes sense so
it's kind of loud
alright
[Music]
so I can't seem to get those really low
notes to play let's increase the frame
rate so first of all I will need to add
an envelope to this the whole point of
this I wanted to sound somewhat nice so
what is an envelope so in addition to
the oscillator there is this thing
called an envelope and an envelope has
four elements to it they're actually
described right here and I have a video
all about this which is attack decay
sustain release so you're thinking about
playing a note like when you hit a note
on the piano there's the sort of attack
there's the notes for fading out there's
the sustain there's the release all
those four things there's various
parameters I'm just gonna kind of use a
default setting and I'm gonna go to this
example p v dot envelope and it sort of
looks so let's let's grab thank you well
that's a crab putting because I have
fake applause sound effect and then
there's people applaud answers so I'm
gonna grab all of this stuff these
settings for that envelope I am going to
create an envelope I hope to rerecord
this video sometime I'm going to create
that envelope right here and then I'm
gonna make the envelope sorry before I
make the oscillator so I basically want
to use the envelope in the sense as a
wrapper around the oscillator the
oscillator is going to give me the
quality of the sound and the frequency
is what kind of wave it is and the
envelope is gonna allow me to make it
feel like I'm almost playing a key on a
synthesizer and so now if we go and look
here we can see envelope dot play so now
so the amplitude gets tied to the
envelope so instead of saying amplitude
of one I'm gonna say awesome amplitude
envelope and then I'm just gonna say
envelope dot play let's try this and
I need to start any frequency on
envelope top play okay so then I want to
then I want to also comment this out
right now and just we should just hear
one note you hear that so what I'm going
to do now is I should be able to then
say I should be able to set the
frequency and play the envelope again so
here I'm going to set the frequency and
I'm going to play the envelope again I
am going to not set the frequency here
or play the envelope here and let's see
what we get these okay that is loud I
don't know if I just totally destroyed
your ears one thing that I can do here
that would be kind of nice would be to
make this actually index mod 88 so that
if the index goes higher than the last
key on the keyboard it will then wrap
back down to the bottom one and I almost
feel like what I want to do is use a
smaller range but let's try this I'm
going to turn the volume down a little
bit how's the volume as you can
[Music]
I'm terrible at doing stuff with music
and sounds please work hopefully you can
come up with something maybe make it
sound beautiful you know perhaps we have
achieved something spooky I don't even
know if I'm doing this correctly but
anyway I said I was gonna make this
video and I made this video all right so
thanks okay all right hold on this video
is not over yet getting a suggestion
from the chat from K week mom saying you
will get more musical results by
restricting the range a bit I'd say two
octaves top so what I should be doing
here is basically two octaves right
would be how many notes total 24 C C
sharp D d sharp e F f-sharp G g-sharp a
a sharp B that's 12 then I have C so
that's 12 notes total so if I so I want
like range of two octaves would be
twenty-four notes but maybe I would
allow the last note so I would have
twenty-five notes so I would maybe I
want to say something like the the N is
index plus I don't start up somewhere
like plus 48 modulus 25 is that like
crazy Oh 14 and minus forty-nine that's
interesting okay
so is this does this make any sense at
all
[Music]
let's try a little bit higher like 24 48
96 what Oh cuz I'm I'm module no no no I
want to modulus the 25 plus 48 this
better so anyway now you see that I have
no addition having no visual Talent I
also have no musical talent I don't know
that much about music but I played the
violin and I attempt to play a very out
of tune ukulele the -49 is no longer
needed that kind of makes sense right I
could just take out the that's an
interesting way of thinking about it
[Music]
if the modulus whoa whoops is the
modulus is the modulus 25 writer should
be 24 oh boy all right let's pretend
that didn't happen we're gonna edit back
sweat and got the ukulele the ukulele oh
those are weird edit or something there
as I went off the deep end anyway all
right so this is the end of my video
I've said that so many times share with
me your musical compositions based off
of this number sequence or other number
sequences and ways that you discover and
I look forward to seeing you in future
coding challenges okay goodbye
boom I'm gonna dance my way out of this
[Music]
so one thing do it at 60 frames per
second
[Music]
it's like flight of the bumblebee but
the I need the envelope to be quite
different I think okay all right I I'm
gonna let people figure this out
themselves okay all right this so forth
so I guess I guess this live stream was
all about the recommends it's 7 o'clock
is there something in my list that I
made that I could possibly do I okay I
definitely don't want to talk about
convolutions right now the flocking
coding challenge is too long Charlie
it's 7 o'clock I think I might just
leave it at this for today there's
something else in there om l5 let's try
doing let's do this ok we're gonna do
the ml5 thing let's do the ml5 thing
just as like just to try so let's let me
just see if I have any messages here who
I have a message I don't know if Chris
if you are still watching but I just saw
your message from an hour and 40 minutes
ago which is pretty awesome
okay so I have all these text messages
let me make sure that everything is okay
pizza delivery is on the way babysitter
at home everything's fine let me talk
about my plans for the summer no no no
let me just go and do this ml5 stuff
okay okay what I need to do is
[Music]
just bear with me for a second
what branch is this in so what I'm doing
right now is so here's the thing I kind
of want to do this ml5 video today just
to kind of do something with ml5 but
there's a new release of it coming out
next week that hasn't been published yet
there's some kind of key API changes so
I want to I want to kind of use the
updated version that's not officially
published yet and by the time this video
comes out it'll match so let me see if I
can grab this so I'm just grabbing the
full ml five examples repositories of
repository go back to the slack channel
here and why did that not okay I don't
know why that happened
so I'm now grabbing this repo okay here
we go now I am going to go into that
repo I want to just make sure I have
everything boy okay I do and then I want
to say get checkout I want to look at
pull request this pull request 1/5 I
want to go I want to deal with this
branch ok so I want to do this ok and
then I want to look at the files there
should be thought in this branch there
was like a temporary time so let me just
look here I might have to like build it
or is it did I just not notice it I'm
looking for the pre-built where do I
browse files here well hold on let me
just look did I just miss it that's
weird I guess it's not committed in the
repo so but it was merged ok let me
think about this
let's go one step further and let's
actually go and grab the actual library
is there a did we commit oh we do have a
that's interesting that's from 11 days
ago was this merged maybe it wasn't you
know this is the
where is the what I'm looking for is
yeah this one was this one merged looks
like it was a day ago so but this
distribution is from 11 days ago that's
weird
well let's try to build the library so
I'm gonna clone the full ml5 library I'm
looking if somebody maybe in the I'm
gonna so I'm gonna clone the full
library then I am going to look at these
instructions for developing where are
those contributing I think they're in
this okay so now so this is by the way
what I'm doing right now is something
that the whole idea of ml 5 is to make
doing some machine learning tasks in the
browser friendly and simple but I'm kind
of doing some library development itself
now which is not what you would need to
do to use ml 5 I'm just doing this for
my own just to try to prove sort of
compatibility issues but so I'm gonna go
into that I'm gonna hit npm install so
here we're gonna install all the node
packages
and then I don't want to do this I want
to build yep then I'm gonna do NPM run
build which should give me the most
recent built version of the library I'll
have to wait for this to finish hey once
again
the chat is talking about what
programming language it's really so uh
okay great we should all run our own
sanity check
- failing left and right now I'm gonna
try this run build so let me just open
this up for a second
704 p.m. so I'm going to just delete
these files and I'm gonna say NPM run
build
so everyone's asking about this song
here's the thing this song it's Adam
plow who is a friend of mine from
college he is that television and film
music composer amongst other things I'm
sure and he like he does the music for
the tf-x show you're the worst I think
anyway he composed the coding train
theme song which is the thing that you
see in this thing over here but I once I
was emailing with him and I was like oh
I'm like thinking about getting sort of
like stock music he's like oh I have
this thing I made you can use that and
he sent it to me that's what it is I
don't think it's anywhere on the
internet but here but you can tweet at
Adam Lau on Twitter and ask him more
about it okay so it looks like it looks
like I have successfully built a new
version of the ml5 library so I can now
go into and I can say p5 G - B image I'm
gonna say image classification and then
I'm gonna go into that I'm going to open
that up I'm going to go here I'm gonna
paste ml5 in I'm gonna delete this and
I'm going to add here ml v dot Minjae s
okay and now we are going to go here and
then actually I know I have other
terminal windows open yep
terminate and
on a server okay let me look now at let
me just review so what I want to
actually create is I'm going to I'm
going to look at the code and then kind
of like build it as a coding challenge
I'm gonna go into ml five examples p5.js
image classification video just open
this oh I don't know why I just went
here I mean the weirdest place ever but
that's fine create capture mobile net
via model ready and then predict got
result err results okay great
okay great and if I want to do it with a
video an image okay okay all right
I think I am ready oh yeah all right
people are there's some guessing going
on as to what version of node I'm
running hey that's not so bad
that's not so bad that's like you know
what's you know it could be much older
than current version of node I guess
I'll just go tonight only this yeah big
deal
look I I take this very seriously I have
a person who falls under the category of
most users I am NOT a person who falls
under the category of clang I have most
users so I am at eight point nine only a
couple versions behind what's
recommended for most group for most
users okay
node update new NPM update computer
computer Alexa no ok Google update node
none of these things are working for me
I don't know why food I don't know if I
could do this all right
mobile net
image nets boy slow internet okay
just looking is there like a JSON file
in here that just says all of the labels
like what's a label in like if I search
I should really sign in here this is
making me crazy
sorry looking at my foot let's I I
forgot what I was doing I gotta get my
two factor authentication going okay
somewhere in this repo I believe is can
I search right in this repository no I
thought there's like a JSON file that
has all the labels that are in mobile
net I've seen this before
oh I forgot about that I'm like setting
off people's al exa s sorry about that
I'm looking for all the labels is it
here
maybe I should just look for mobile net
classes
no it's funny because I've used this
before where is it
I don't know what's going on out there
does anybody know where I could find out
basically like what the 1000 lei Buhl's
are I feel like this is well is it could
I actually just find it on the imagenet
website this looks different than what I
remember imagenet being
visual images bounding boxes features
right these these are all the labels but
there's more mobile net just has a
thousand so that's a subset of this
google image net labels ya know
as I know all right hold on here's a way
of doing this I don't know why so this
has to be in there somewhere
so I should be able to search this repo
so there's no file all right
I've seen this there's actually just a
paper that there's like a total Twitter
discussion about what's in there it's
literally the first link Oh API Docs
Python on somebody's what's the first
link on which page somebody just
somebody just posted it API Docs Python
tear okay model from JSON mobile net
Python Kara's models model from JSON
here we go
[Music]
Google Image net labels this doesn't
seem to be what I'm looking for imagenet
labels ah here we go
it's literally the first link thank you
[Laughter]
all right tabby cat all right here we go
whoo where did this come from all right
well I will use this great thank you
yeah
okay
[Music]
okay all right folks I'm running out of
steam here but let's see if I can get a
little further give me a second
I know I need
[Music]
bear with me everybody I am going to
where where where where is and all five
examples on this computer what was the
name of that branch I just want to have
that code for reference updates
[Music]
okay all right just about ready here
everybody thank you for your patience
leave this open another reference
[Music]
something else for lunch rest from me oh
so now I just need a few images
[Music]
all right just thinking about this for a
second okay all right everybody I am now
actually going to do something this will
be my last bit for today and thank you
for tuning in my elbow against this
filing cabinet here and I have very very
sensitive elbow so this is the elbow
that I broke last summer you can see I
have like a huge scar on it and I have a
lot of titanium and this arm it's really
pretty much fine and I could do just
about everything it's a little bit weak
weaker than this arm but it's very
sensitive by peg it's okay all right
I don't know about this but I'm gonna do
this anyway welcome to the last thing
that I'm going to make I'm going to give
myself a little reference over here I'm
just going to check something okay okay
everyone
hello
this strangely is a coding challenge so
let me try to explain this to you what
I'm thinking about I'm going to in this
video make a webpage I'm gonna start
over I'm gonna start over because I'm
actually just gonna let's first make
sure this works on this computer okay
hello greetings from lab coat bolo tie
me person thing so this is a coding
challenge I'm gonna make exactly this
what you are seeing here is a web page
that is taking a live video free from my
webcam and attempting to classify what
it sees
it's with some text on that page so
let's see let me see what's the chance
that it knows this no it doesn't know
what this is oh let's try this bottle
water bottle tripod what about okay
let's try oh I got one I got one for you
got one for you yeah okay alright hold
on we are starting over now I don't need
to refresh this I'm the widest at that
hello it is me you're a friendly
neighborhood oxygen mask tennis ball lab
coat person thing alright so this is a
coding challenge it's the first time on
this YouTube channel called the coding
train that I may use a new JavaScript
library that I've been working on with a
lot of people here at ITP new york
university - school of the arts called
ml5 and i'm going to recreate this
particular ml5 example which is taking a
live video image from the web camera and
attempting to classify it now what i
want to do this for is i want to have a
talk what
talk about machine learning and I want
us to I want to have the discussion
about why it's not magic what where it
works where it fails and sort of
thinking about data and models and I
want to make a lot of videos about this
and eventually those videos are going to
be part of a tutorial sequence about ml5
and the basics of machine learning I'm
not really ready to do that yet
so I'm just dipping my toe in there by
just doing a coding challenge to try to
recreate this example now here's the
thing why is this what where's this
stuff coming from why is it think I'm a
lab coat I mean that's not such a bad
guess for me frankly well let me just
come over here and grab this particular
ukulele that I happen to have it's very
out of tune I'm not gonna play it for
you right now and I'm gonna put it here
and we're gonna see that it recognizes
that as an acoustic guitar acoustic
guitar so with a violin or fiddle it's
got a very high confidence that's
amazing
didn't recognize that as an acoustic
guitar and yet here I am
hey lab coat so what's going on so this
particular example is running using
something called mobile net mobile net
you can go to this link here and read
this very a depth in-depth academic
paper called mobile Nets efficient
convolutional neural networks for mobile
vision application what I'm showing you
is how to use a pre trained machine
learning model meaning somebody already
took the time to train a model saying
hey look model machine learning model
here are all these images and this is
what's in those images learn from this
so that you can then look at new images
and try to guess what's in them based on
what you've learned well anytime you do
this you've you've got a problem because
what what images were used to train
train that's model what was there an
image of somebody with a beard and
glasses and a nice lake blue shirt with
a flamingo on it and it could just say
person with like blue shirt and flamingo
know this in fact this particular mobile
net model these are all of the labels or
things that it knows how to recognize
prairie chicken African Grey macaw
sulphur crested cockatoo go it's very
good at all like these obscure
strange obstacles somewhat in here
acoustic guitar but nowhere in here
ukelele right I can't find ukelele in
this list well I didn't get for the code
just bear with me this is so important
machine learning is not magic it only
will recognize what it's been trained
and so while this image this this
particular model pre-trained model
called mobile net was trained on a
database of images called image net you
can go to the image net website and read
more about it but this is the thing this
database of images was really designed
for computer scientists and people were
studying machine learning to do some
research but it wasn't necessarily
designed to be practically applied in
the diverse world of many many things
that we have here so anyway I want to
like this is the first thing that I want
to talk about but we can use it we can
experiment that we can play with it we
could see where it works where it fails
and then as I make more videos we're
gonna look at how could I retrain it
with my own data how could I make my own
but I want to just start by making this
thing and so that we can play get our
hands in it see that see how it works
just just give it a try
I okay I feel gonna like redo this whole
thing because I went on for way too long
alright we're gonna try this one more
time
and matsyas gonna use whatever and once
he is sorry everybody most of you should
have gone to sleep by now like an hour
ago
I just want to see if I can do this
again in a less convoluted explanation
way what that was only a minute 30
seconds are you serious I felt to be
like I was talking for 10 minutes
well I'm gonna do I'm gonna oh yeah
burger Bob is asking about workflow and
not getting to that today but I wanted
to update some of the stuff that I'm
using like visually yeah exactly Visual
Studio curlier live server all right
hello it is me your friendly
neighborhood OBO bolo tie lab coats
what's going on here
hello I am going to do a coding
challenge that has to do with machine
learning I'm gonna use in this coding
challenge a library called ml5 I'm
actually here on the ml5 website
friendly machine learning for the web
this is a new library it's being
developed at ITP which is a graduate
program here at Tisch School of the Arts
New York University it's where I work
I've probably talked about that before
links all about that in the video
description now there's so much here
that I want to talk about and go through
and I plan many videos almost like a
tutorial playlist of videos about
machine learning concepts and beginner
steps working with this ml5 library I'm
not ready to do that yet so I'm just
gonna do a coding challenge where I
recreate this particular example and
what this example is doing is it is
getting a live feed from this webcam and
it is trying to guess what is in that
image and you can see it's getting it
terribly wrong now I can get it to do
something correct I'm gonna come over
here and get this ukulele and you can
see this it confidently registers this
as an acoustic guitar so why did it work
with that but when I jump and stand in
front of it it thinks I'm a bowtie again
which isn't such a bad guess it's
suppose labcoat so what's going on so
this example this is a machine learning
image classification example but it's
not magic it came from somewhere and
where it came from is something called
mobile net so this particular example
I'm gonna write the code for it is going
to load behind the scenes a pre trained
model called mobile net what is mobile
net mobile net is a pre trained model
that researchers created that used this
other thing called image net image net
is a database of 15 million images that
are all labeled this is a bird this is a
donkey this is a turkey know why those
things that are popping into my head
this is a acoustic guitar but it wasn't
necessarily made for a use case that you
might be thinking about
or something that's going to be applied
to a particular problem it was really
named for research into how image
classification works so there's a lot
missing from there we can actually go to
this page here and see these are all of
the labels that are actually in their
handheld computer harmonica a horse cart
iPod so we can see like okay iPod is in
there so if I go and grab this glowing
rectangle device we can see look at it
because it's a lab coat I guess I
probably have to turn it on okay anyway
cut that out
that didn't work he really recognizes
the phone pretty well it's a meat
cleaver
this is why I love I love for this to
fail because we have this thought that
is all just this like magic working
stuff but what I the point of me making
this video in this tutorial is one is
the Strega ml5 works to allow you to
make something to play with it get your
hands in it to ask the right questions
about what's there what's missing what's
good about this model what's bad about
this model so let's build the code for
this and I'm gonna come back later and
make many more videos and one of the
things I burst rate is how to train on
top of something that's pre trained so
this is a pre trained model but I could
actually instead of having to train a
machine learning system from scratch I
could actually take something that's
been trained already
and additionally train it with some new
images but something I'll do in a later
video okay so let's see so I'm gonna I'm
gonna close this page out if you're
still watching this I'm gonna go to this
blank p5 sketch so the only dependencies
here are the p5 library which I'm going
to use for quick access to the webcam
and then the ml5 library and I have that
now downloaded as a file called ml v
Minjae s if you look at the video
description and go link to the code
you'll see that you'll have it there now
um you can also reference ml v as a URL
just like I'm referencing the p5
libraries in here but I'll you know I'm
gonna come back to all this when I do a
more proper tutorial series about ml 5
all right so now let's first get the the
camps the camera so I'm gonna say video
and I'm gonna say video equals create
capture I think that's what I say
video and then I say like video dot
start I don't remember how p5 works so I
think this is how I create a video
element on the page I'm gonna go to
running my code right now go look and
there's the camera what did I get video
dot start is not a function I don't need
to say video not start probably so I'm
gonna run this we can see oh there's the
video now I could that's the video
element on the page now I'm actually
what I want to do is I'm going to a hide
it and then I'm going to add a draw
function and I'm gonna make this 320 the
canvas 320 by 240 and I'm just gonna
draw the video to the canvas this is not
necessary but you know if I want to use
this as a component in some other
algorithmic drawing thing I can actually
just hide the raw video element and draw
to a canvas so I'm gonna do that and we
should see now there it is look so um
that's smaller probably the videos
native side is 640 by 480 I can shrink
it down and I'm gonna do that just to
shrink it down and then make this a
little bigger and then I'm nice and
picks later okay hello it's me green
screen all that Sirsa all right so now
now I have the video how do I now create
the image classifier well this is one of
the things I love about ml 5 I'm going
to make I'm gonna actually call it
mobile net I am going to say mobile net
equals ml five dot image classifier so
ml 5 has a function all of the functions
inside of ml 5 are namespace so if you
have only used P 5 P 5 is kind of
non-traditional in that you could just
call stuff globally like create canvas
or image these these functions that I'm
calling here are I don't say P 5 dot
create canvas and this is this is a part
of a design decision p5 to be very
beginner friendly but it can be a
problem with JavaScript libraries that
you don't love using two libraries and
they both have the same function name so
this all the functions are names
based under ml5 so this creates an image
classifier and there are many ways that
you can make an image classifier in p5 I
mean ml 5 what are the ways is by
passing in a string with a reference to
a pre-trained model that you want to use
now you can't just like make up anything
you found on the internet and like pass
it in there but ml 5 knows about the
mobile net library so what it's actually
gonna do this wouldn't work if I were
offline like if my computer were not
connected to the Internet this would not
work because it's reaching out and
behind the scenes downloading the mobile
net model it's actually a pretty small
file where the reasons why it's called
mobile net it's highly optimized not for
accuracy but for efficiency for like you
know work run on a mobile device so I
could say this and then I need to I
think give it a callback where I say
model ready because that actually takes
some time like that that the models not
gonna be ready instantly so I'm gonna
write that callback call it model ready
and I'm just gonna say console dot log
model ready and so now I am going to
refresh and I'm gonna see the model is
ready now the other thing is I can use
mobile net with static images of course
I can do image classification but if I
want to use it with a video feed ml5 is
designed to sort of just know how to do
that
innately so as an optional second
argument before I give it to the
callback I can actually just give it the
video element itself so I'm saying hey
make an image classifier use the pre
trained model mobile net always look at
whatever is in the current this video
element but also you know it just tell
me when you're ready
so now here we go
I should see the video model ready I'm
not sure why I wouldn't expected the
video to appear and then model ready to
come after I'm not sure why the sequence
is happening that way but big deal
oh you well I don't know I'm not gonna
worry about that too much right now
so now as soon as the model is ready
what I want to do is ask for some
information so I can now say mobile net
dot predict so predict is the function
that's going to say hey predict what's a
prediction is the step that happens
after something symmetry right so I've
done a lot of video tutorials about
machine learning and training them
through the training process none of
that exists in this video we're just
saying hey somebody else did all this
work to train this model it's published
I can gain access to it through ml 5
which is a layer on top of tension flow
digest all these different pieces um so
I can just call predict now now predict
is gonna take some time so I also have
to give that a call back I can say got
results and so now I'm going to write
the got result call back got result and
I'm going to put results the got result
function requires an argument and inside
that that argument is filled that the
results
Evette is filled with the results from
the prediction so I'm gonna just say
console dot log results and let's take a
look at what we see now so the model is
ready and undefined hmm that's not good
I know the mistake that I made
so here's the thing I forgot about this
I'm so used to working with p5 and so
used to this sort of like load JSON with
a callback and got data and here's the
data that I forgot that the way that p5
works is somewhat non-traditional for
JavaScript libraries and actually most
job and because p5 like optionally lets
you check for errors and most job scribe
Rarity's want you to say like hey no no
you have to check for errors so actually
this got result callback should have two
parameters it's too big things are
filled to arguments and error and
results because I can say like so in
other words if something went wrong the
first argument would be the error if
there is an error I could say console
dot log there is an error and otherwise
I can just say console dot log
results so let's take a look at this now
I'm already oh look at this we got
something OOP got three things let's
take a look at what's in there I'm so
excited
bowtie it's me Oh a Windsor tie or a
sweatshirt I send such a sweatshirt but
I think about myself I think about being
a sweatshirt let's run this again and
let's see what we got
I'm a puffer fish excellent um so we can
see that this is working now hmm
interests strange this is a continuous
video image so once I got that result
what is it that I want to do well I
could recursively just call got result
again so there's different ways I could
approach this but I what I can do is
basically I'm saying like as soon as the
model is ready ask for a prediction then
when I get the prediction log it to the
console and then ask for another
prediction and in because I pass the
video up here the image classifier model
is going to know to always look at
whatever's currently in that video so
let's run this again and let's see
hopefully the browser doesn't crash with
me trying to do this a bunch of times I
only thought once what did I do wrong
here mumble net dot predict got results
that should work
so I'm thinking here what did I get
wrong
when in doubt refresh oh now it's
working I'm uh scenario okay sorry edit
the part where it didn't work for no
reason probably and hit save alright so
now we can see the console log it's like
doing the labels over and over again we
can look at tennis ball bowtie
microphone there we go so now what do I
want to do I what's in here for those so
first of all by the way it gave me
what's in here it gives me three it's an
array with three objects in it each with
a class name and a probability and the
highest probability is first so one of
the things you might notice here is that
I can optionally like if I ask for I
believe if I say comma 10 this would
actually give me the top ten things that
it thinks it is so we run this again and
we can see now it's always giving me ten
labels so I'm gonna be very basic about
this and say just want one thing and
then instead of console logging results
I'm gonna say console log results zero
dot class name so this would give me
what it currently thinks it is and we
should be able to see that in the
console so we can see things I'm a
laboratory coat and if I come over here
and I put my ukulele up here we can see
if we've got acoustic guitar so this now
is essentially that exact example remade
I you know I probably want to not look
at the result oops not look at the
results in the console so I might do
something like say let label equals
empty string and then in I'm gonna say
background zero I'm gonna say fill zero
and I'm gonna say text size sixty-four
and I'm going to say text label you know
I'll just put it at the bottom of the
whoops height how do you spell height
I'm gonna put it at the bottom
put it at like the bottom of the window
and I am here instead of console logging
it I'm just gonna say label equals
whatever currently thinks it is and I'm
going to hit refresh and now this is I
can I'm going to have both the canvas
and some text saying what it thinks it
is I'm like does it know what Kleenex
are thinks it's a remote control that's
fascinating how about some tape some
jewelry maybe that text is way too big
anyway you get the point so now you've
seen how this works so there are a bunch
of questions that were in the chat that
I'll mention very briefly I guess I can
just leave this running here I know I
keep hitting back
number one is time out for a second
I'm sorry hold on I'm just looking at
the chat for a second
okay oh I left 110 in oh yeah okay sorry
the chat is just telling me that I left
the 10 here it's not really going to
make a difference in terms of speed okay
so people are asking I in the chat kind
of about and a little bit more about ml5
again I'm go to my intention is to do an
introduction to ml 5 tutorial where I
talk about sort of how Y where that
project came from and what the pieces of
it are I would recommend that you check
out this article on AI TPS adjacent
journal which kind of explains
everything about ml 5 the people who
worked on it and how it's built on top
of tensorflow Jas I will just briefly
mention here that ml 5 and P 5 are
separate projects and the reason why ml
5 was called Pete called ml 5 was as an
homage to P 5 say well P 5 did something
to make programming in the browser
drawing an animation friendly and
accessible for beginners and
approachable for beginners and ml 5 is
trying to do it's having to do the same
sort of thing with machine learning so I
encourage you to poke around the ml 5
website hopefully this remix my coding
challenge to do something with it maybe
you can make one of the example projects
that my brain is like totally melted it
shouldn't be doing these live streams
for like three hours to remix the coding
challenge I made to use this in a
project you could you know just for fun
have it like try to create poetry or
sentences out of stuff that the webcam
is showing you could actually try using
this with static images you know you can
see an example of this on the ml 5
website where if I just take an image
like cow wait a second what just
happened here okay I don't know what
just flashed on the screen there
I'd never Google image search live while
live-streaming make make some kooky
project that shows labels for an image
but really think about and be critical
minded about what's in there what's
missing in the data set of mobile
networks this gonna work where's this
not going to work um have some fun with
it and I will see you hopefully in many
future videos about ml5 good bye
oh shoot all right I think I have to go
I don't know I don't know if that's
gonna I don't know if that's gonna make
it as a video oh when will you be making
games again I know I agree maybe next
time I still have too many things to do
I would like I was kind of interested in
doing Tetris because it's been suggested
a lot and I think it would be fun I
really want to make actually have a
question for the audience here I want to
make the tesseract 4d tesseract let's
see if I go and basically it should be
an animation of it here this this
animation I want to do a version of this
in processing and I'm trying to decide
whether it makes sense to try to do
actually the sort of like matrix math
calculations or to just compute in 3d
like the vertices of two cubes and then
interpolate between them to move stuff
around I don't know if anybody has any
advice I would like to know that well I
made the font so big there
I am a lab coat I am a Windsor tie I am
a person or microphone a lollipop ice
lollies would you like an ice lolly
popsicle
what's a popsicle in British English is
the popsicle refer to anything I don't
know I don't know I I came back to do a
live stream how is that all right I will
do the matrix math I made a matrix math
library that's a good point
all right I will try to take a few
questions before I go and hopefully this
live stream will turn into some edited
videos that people like to watch
I'm looking at the chat anybody have any
questions for me before I go I'll put on
my goodbye song when will you finish AG
RI oh I forgot what I even need to do
next for that hope I'm finished yet
but I could I could try octree that's I
did one do you know how to program C++
for Arduino
all right thanks Marshall
[Music]
you promised you workflow hey so first
of all I take issue with the promise I
specifically said I doubt I'll get to
all of this time now a drumstick
can you make videos about Arduino I do
have a recommendation for you if you're
interested in videos about Arduino let's
see if this shows up yep if you go to
yeah if you go to Vimeo calm / channel /
P comp there are tons of wonderful
videos about physical computing there's
actually looks like there's Raspberry Pi
ones and so I really recommend these
videos check them out ok so there's that
what else is going on here promise yeah
this promise was unresolved can you make
the face detection and blurring the face
into a video sequence that's interesting
I don't know if I fully understand that
question let me just check am I getting
any important messages and now that's
good alright I'm looking at the chat I
was gonna wait
yeah how long have you been learning
coding I I would say since 2001 would be
the answer I would give so you do the
math but I but you know I but I did do
coding a little bit in elementary school
and middle school and even a tiny bit
right after I graduated from college but
I really didn't do coding until they
really didn't do coding until 2001 Oh
[Music]
detecting face and blurring and
automatically yeah that's an interesting
idea for a project ooh the game Kinect
for with the min/max algorithm in canvas
this sounds like an awesome idea let's
see if it's been suggested already
connect what would I let me look for a
min max maybe tic-tac-toe with AI using
min max algorithm or also connect for
was just suggested now I like this idea
so often what I do is assign it the
sinus issue to myself when I like the
idea okay excellent I like that idea
what do you think about learning
assembly in order to become a better
programmer it's an interesting question
Oh Marshall is suggesting also more
tensorflow dodge as videos and note I
would also like to do that I'm suppose
that's about d3 okay let me try to take
those one at a time
attention photo just videos in node yes
I would definitely like to do that the
next thing on my list for tense flow des
is convolutional neural networks we'll
see when I can get to that but we're
adding the node stuff certainly I would
love to have that okay and then the
other question was d3 I have done a
little bit with d3 d3 is quite wonderful
it's not my expertise it's not sort of
what I natively know well that's a great
thing for me to have a guest come do
some d3 tutorials about it was one other
question and I saw sorry but I missed it
do I work for a company I work for New
York University as my full-time job I
make these videos as part of classes
that I teach at NYU the program's called
ITP and also ima just participial of the
arts and then the videos have kind of
taken on their life is own so I kind of
have a simple second part-time job here
doing the coding train okay
néstor asks how's life outside of the
coding tre now are you a little bit
overwhelmed it was hard to be traveling
for a while also moved to a new
apartment so I think my things is gonna
slow down for a little bit over the
summer but hopefully when I'm at work
everyday in the fall that's where I
record the videos is where is a building
where I teach classes so hopefully
things will ramp back up to speed in
September oh it's the assembly question
I missed thank you that's an interesting
one
you know I'm generally on the spectrum
of you know do I need to learn every
lower-level detail about coding for to
like should I just kind of like
experiment play around learn some stuff
trying to make stuff I generally lean
towards this end of the know it's not
really a reason to learn assembly just
to be creative and make stuff and learn
about code and participate in this world
of comedy this computational world that
we live in that said you know admittedly
I find things like assembly language
kind of fun and interesting and exciting
does that lower level stuff to be weird
and crazy and I do like having that
depth of knowledge myself personally so
I think there's value if you find
enjoyment in that if you were want to
make if you have some idea for an app
and you that's gonna help people do you
need to go and spend two years in a cave
becoming an assembly language expert
nothing you need to do that in a cave I
would say no but there can be some value
and some enjoyment in learning a lot and
certainly for research into the science
of computing and understanding and
lower-level how computers work it's a
credible value but for being a person
who's making stuff and doing data
visualization or solving problems and
trying to experiment with making art
with computers you know you can find
that you're a place on that continuum of
where you're most comfortable
is it tough to become a good programmer
is it true you must be born into it no
it is not true they need to be born into
it programming is hard and you have to
take a lot of time to mess up and be
frustrated and anybody should it can be
a part of programming and and triads and
you don't have to have there's no such
thing as some innate magical programmer
thing that you're born with maybe for
some people not for me not for I hope I
think all of you watching except for
some person that I don't know who's
probably not watching but so I would say
you should go for it it's hard and don't
let don't let it get you down it's hard
for everybody where did the names coding
train and coding Rainbow come from
coding Rainbow kit wasn't omage to a
80's television show called Reading
Rainbow that I love but there were some
issues with making something that kind
of has the same name as something else
which I should have been aware of and
coding train was just somebody suggested
it and I'm forgetting I really should
keep track of this stuff better
I'm gonna I can go back into my email
and I said that this person a t-shirt so
after we suggested I like it I just like
the like train so like the vibe of it
people complain about the fact that I
have this sort of like branding like I'm
a kids show and it's like it was not for
kids but I like that that's me so that's
what it is good programming habits I
don't have any good programming habits
next question you should usually develop
good programming habits I'm sure other
YouTube channels have good programming
habits oh okay everybody I have run out
of steam I've been live streaming for
three hours thank you for joining me I
hope you found something useful
I definitely think that the
recommendation JH makes for a fine
edited video to come out some point next
week pretty sure that the music one also
is fine and then I'm not so sure about I
feel like I I don't know but whatever I
think the ML v one is a good trial run
for making video tutorials of ML five
and I want to plan to make a lot of them
okay I'm sorry I can't answer every
single question I don't know when I'll
be back next week i I really if you're a
content creator establish a regular
timeslot I'm just completely incapable
of doing that but I do like Fridays so
but I and I and I am using YouTube
events to at least schedule stuff so if
you want to you could subscribe but
cookie alarm bell and then you get a
notification when I scheduled an event
and blah blah blah if you want there's
no requirement to do that whatsoever but
that's probably the best way you know
you can also sign up to be a sponsor or
a patron and I'm always posting in the
the slack channel that's for men
what's a cult any more like well I think
I'm gonna do it this Thursday oh never
mind
so that's where you can get the most
information but I will when I'm pretty
sure about it I schedule it on YouTube
thank you everybody
I but don't take my code for it I like
that suggestion I think I'm not gonna
play the outro today I think I'm just
going to press the button stop streaming
I really and I'm gonna go home and I'm a
nice weekend
and yeah that's that oh hi Jaden first
time watch our Jaden thank you I'm glad
that you're still watching and oh yes so
let me just the first of all I you know
I understand that not everybody has the
means our capability to subscribe
sponsor or patreon whatever that is
please do not feel any obligation to do
so I love that you're watching the fact
that you're watching and you don't even
have to watch you're watching is really
nice and if you're getting some value
out of this that makes me really happy
[Music]
so I wish and hopefully there are other
ways that we can create a community as
you can participate in communities of
people trying to do stuff with code and
creativity and whatever just through the
magic of this thing called the internet
now if you are a member or a patriot
patron and you do not have a slack
invitation which Marshall just posted
unfortunately this is a very awkward
system for doing this so best thing for
you to do is go to the I'm not going to
open up the community tab and somewhere
in there I have a post for sponsors only
with a link to a Google forum so you try
to find that if you can't find that
message me on Twitter
[Music]
I try to get in touch with me you know
you shouldn't be too hard to do so but
the and I will get you that slack
invitation I just have to do some kind
of cross check to make sure it's the you
have to give me your YouTube username
and then I can see if that username
actually met matches a sponsor and boy
now I don't try to gain this system I'm
just relying on the honesty good faith
of the internet you just go to them the
Google forum is the way I have to see
that you have view of that anyway so
Marshall hopefully can find it this I
would love a better system while amazing
that people in Malta are watching and
I'm gonna go I'm gonna go I'm gonna go I
was I said I was gonna get home by 9:00
and I got a subway ride some way to
catch new direction I go downtown not
uptown now I live in another borough
it's all very exciting
moving is rough I just unpacking some
boxes will be my weekend there's a lot
of it's the mess and it's it's but I did
get some air conditioning installed this
week which was huge
ok goodbye everybody I'm gonna I got to
go over here and hit first I'm gonna hit
stop recording that's me recording to
disk Sweden Canada Germany amazing
amazing and then I'm gonna hit stop
streaming I'm actually gonna click the
stop streaming button now this entire
live stream will be available for you to
watch as soon as I do this I am trying
to get us set up for some live streaming
from my apartment so that I could
actually do dare I say more live
streaming but more frequent shorter live
streams I would I would love actually
honestly I have this idea that if I just
like live stream every day for a half an
hour or something that that might mean
there's some value to the longer ones
but I don't know
okay I'm stopping streaming goodbye have
an eye