Placeholder Image

字幕表 動画を再生する

  • all right.

  • Hello.

  • I'm back on this video.

  • Do another video about the recommendation sequence in the previous video.

  • What?

  • I did waas visualize it and you could see here.

  • This is me.

  • This is not me.

  • But this is the P five code.

  • I wrote to visualize the recommend number sequence as a continuous series of arcs.

  • Looks like they're circles, but they're actually connected.

  • Arc's gonna watch the previous video where I go and build this whole code.

  • But one of the things that 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 your favorite website entirely in the entire world the online Encyclopedia of integer sequences you know, if I'm here on the recommends sequence page, I can click right here to listen, and it will give me a MIDI file Mini being a system for encoding music as numbers.

  • So if I can encode music as numbers and I have a number sequence that I could make that number sequence midi and then I can play it as music.

  • So this is what I want to try to dio and I'm going to attempt to do it with the P five Jess Sound library.

  • Making use probably.

  • And I don't really know that Well, so we're doing a lot of looking up in the reference while I do this going to do with it oscillator to generate a sound and the envelope an envelope to kind of craft that sound essentially create my own synthesizer.

  • Should also mention that this video was pointed out to me from Dale.

  • Come on.

  • Which is also visualizing sequence in a completely different way with colors and also making it so I hope after watching both of these, we will see a world full of mean.

  • Um 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 on DDE.

  • Let's think about this.

  • So do I.

  • Want him to keep the visualization going, and basically so I could start from scratch.

  • I'm gonna just keep this code.

  • I'm gonna add to it on DDE.

  • What I want to do is I want to play a note.

  • So let's see if I how how to best to do this.

  • So the first thing that I know that I need to do is I need to create a oscillator.

  • And oscillator is an object that will generate a tone.

  • And there are different kinds of oscillators, right?

  • 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 P five oscillators that will go into that perhaps a bit more.

  • But I'm not.

  • What I'm gonna do is I'm just gonna take this code exactly as is, and I'm gonna paste it into set up you're coding challenge copy paste from examples.

  • And then I'm going to create make that a global variable.

  • And I'm goingto discover what interesting error I will have now.

  • So P five 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 gonna go and add reference in my html file to the p five sound library.

  • So hopefully that's gonna clear that error up.

  • Great.

  • It's going to hear anything.

  • So let's go to the sketch and why do we not hear anything?

  • Because I said the amplitude zero.

  • Let's set the amplitude toe one and which is 100% volume hit.

  • Refresh.

  • And so now you hear the sine wave?

  • No.

  • So what's what do I want to do here?

  • So I have this click back here to stop the sound for a second.

  • I have this number sequence that's going up.

  • We could look at those numbers.

  • They're 0136 to 7 13 20 What if I just took each number and assigned it off 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 haven't turned up.

  • Eventually, I think I'll start Here is something.

  • So here's the thing there is a range off frequencies frequency as, ah being a measurement of how many cycles of a wave per second.

  • So now we can start to hear it e like that.

  • Okay, so for a while, we didn't hear any notes.

  • And all this time we started to hear something.

  • So you don't think it's much too arbitrary to just set a the number from zero to whatever as the frequency?

  • There is a specific audible range of frequencies that we can hear.

  • And so and there also are formulas for converting from many notes to frequency and back and forth.

  • I'm sorry about this.

  • Applause has nothing to do with me.

  • Clearly, there's something going on in the hallway was something I could do about it.

  • Right now, it is gonna be in this video forever, but and so I pretty sure that p five has a like MIDI to frequency or to note or something functions 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.

  • 88 key, Standard 100.

  • Keep extended.

  • We can actually find the frequency of any key end 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 recommendation numbers all these numbers and I'm just going to do from 0 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 really insane.

  • Very distracting.

  • All right.

  • Uh, okay.

  • So I want to say the, uh the frequency is Go back to this formula, uh, to to the n minus 49.

  • Okay, So power to and and which is?

  • Index minus 49.

  • Divided by, uh, divided by 12 times.

  • And I believe it was 4 40 for for 40.

  • I wonder.

  • Four forties like middle C or the note A I think it's the tune to a 4 42 A is like the 4 40 is hurts is the is the note?

  • A So So Now if I were to say, uh this let's consul log index and the frequency just to hear it.

  • And I also want to just go to set up and I'm gonna if I already had set the frame rate down to five in anticipation of this, but I'm actually said it toe one.

  • Make it even slower.

  • All right, let's take a listen.

  • Do you guys hear those very low notes?

  • Use index mod 88.

  • That makes sense.

  • Um, it's got a loud All right, so I can't seem to get those really low notes to play.

  • Let's increase the frame rate.

  • So first of all, I wouldn't data on the load to this whole point of this.

  • I want it to sound somewhat nice.

  • So what is an envelope?

  • So in addition to the oscillator, there is this thing called an envelope.

  • An envelope has four elements to it.

  • They're actually described right here.

  • And I have a video all about this which is attacked, decay, sustained, release everything about playing a note.

  • Like when you hit a note on the piano.

  • There's this sort of attack.

  • There's the notes from fading out.

  • There's the sustained.

  • There's the release.

  • All those those four things is various private.

  • I'm just gonna kind of use a default setting.

  • Um, and I'm gonna go to this example p five dot envelope in this layer of look, So let's let's grab.

  • Thank you.

  • Let's crab, because I have fake applause.

  • Sound effect.

  • And then there's people with blood, and so I'm gonna grab all of this stuff, these settings for that envelope.

  • Um, I am going to create an envelope right here on then, um, I'm gonna make the envelope.

  • Sorry.

  • Before I make the oscillator.

  • So I basically want to use the envelope incense as a rapper around the oscillator.

  • The oscillator is going to give me the quality of the sound and the frequency.

  • What kind of wave it is on the envelope is gonna allow them make it feel like I'm almost playing a key on a synthesizer.

  • Um, 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 going to say awesome amplitude envelope, and then I'm just gonna say envelope dot play.

  • Let's try this.

  • And I need start any frequency envelope dot play.

  • Okay, so then I want that.

  • I want 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, uh I should be able to set the frequency and play the envelope again.

  • So here, I'm gonna set the frequency, and I'm going Thio, play the envelope again.

  • It's not going well on dhe.

  • I am going Thio not set the frequency here or play the envelope here and let's see what we get.

  • Okay, that is loud.

  • I don't know if I just totally destroyed your ears.

  • One thing that I could 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.

  • Turn the volume down a little bit.

  • Paul, You okay?

  • It is over.

  • As you can see, I am terrible.

  • Terrible doing step with music insane.

  • Hold on.

  • This video is not over yet.

  • Getting, ah suggestion from the chat from K Week Mon saying you will get more musical results by restricting the range of it.

  • 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, eh?

  • A sharp be That's 12 and I have ceased.

  • That's 12 notes total.

  • So, um, if I go, I want, like, a range of two actors would be 24 notes.

  • Maybe I would allow the last note so I would have 25 notes, so I would maybe I want to say something like the the end is Index plus and I should start up somewhere like plus 48.

  • Um, module is 25.

  • Is that like, crazy?

  • 0 14 and minus 49.

  • That's interesting.

  • Um, um, okay, so is this.

  • Does this make any sense at all?

  • Let's try a little bit higher, like 24.

  • 48 96.

  • What?

  • Because I'm module?

  • No, no, no, no, no, no.

  • I am after module ist the 25 plus 48.

  • Okay, look down here.

  • Is this better?

  • Just the weirdest videos ever made anyway.

  • Now you see that?

  • I eh, No addition.

  • Having no visual talent, I also have no musical talent.

  • I don't know that much about you, like I know, but I played the violin and I attempt to play very out of tune ukulele.

  • All right, so, um, this is the end of the video.

  • I've said that somebody times share with me your musical compositions based off of this number sequence or other number sequences in ways that you discover.

  • And I look forward to seeing your future court challenges.

  • Okay.

  • Goodbye.

all right.

字幕と単語

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

B1 中級

コーディングチャレンジ #110.2.レカマンのシークエンス - パート2 (オーディオ) (Coding Challenge #110.2: Recamán's Sequence - Part 2 (Audio))

  • 1 0
    林宜悉 に公開 2021 年 01 月 14 日
動画の中の単語