1 00:00:00,000 --> 00:00:00,500 2 00:00:00,500 --> 00:00:02,210 SPEAKER 1: Let's take a look at bday. 3 00:00:02,210 --> 00:00:05,180 In this problem, here are the things that you're going to need to do. 4 00:00:05,180 --> 00:00:08,870 First, we'll give you the sheet music for the song Happy Birthday. 5 00:00:08,870 --> 00:00:10,970 And using your understanding of sheet music 6 00:00:10,970 --> 00:00:13,670 and what each of the lines and spaces between the lines mean 7 00:00:13,670 --> 00:00:17,510 and how long each note lasts, you'll figure out what notes are being played 8 00:00:17,510 --> 00:00:19,310 and how long they're going to last. 9 00:00:19,310 --> 00:00:23,990 And finally, you're going to write down the ASCII representation of those notes 10 00:00:23,990 --> 00:00:26,210 in a file called bday.txt. 11 00:00:26,210 --> 00:00:28,310 We'll show you in a moment a format whereby 12 00:00:28,310 --> 00:00:30,620 you can represent notes and their occidentals 13 00:00:30,620 --> 00:00:34,500 and their octave and their length all in a text-based format. 14 00:00:34,500 --> 00:00:36,830 So let's take a look at that format now. 15 00:00:36,830 --> 00:00:40,700 Here's some ways that we would represent notes as ASCII text. 16 00:00:40,700 --> 00:00:46,640 If I had a line that looked like C4@1/8 the interpretation of this 17 00:00:46,640 --> 00:00:49,910 is the note is C, it's in the fourth octave, 18 00:00:49,910 --> 00:00:52,430 and everything after the at sign is how long that it lasts, 19 00:00:52,430 --> 00:00:55,310 and one-eighth means it's an eighth note. 20 00:00:55,310 --> 00:00:57,620 So that's C4@1/8. 21 00:00:57,620 --> 00:00:59,900 If we want to represent a note with occidentals, 22 00:00:59,900 --> 00:01:03,360 we could include that in this text-based representation as well. 23 00:01:03,360 --> 00:01:10,040 For example, C#4@1/8 means this is the note C#, also on the fourth octave, 24 00:01:10,040 --> 00:01:12,220 and it's also an eighth note. 25 00:01:12,220 --> 00:01:15,890 And finally, if we wanted to represent a flat note, for example, 26 00:01:15,890 --> 00:01:20,770 we might do C flat four, where the flat is just represented by the lowercase b 27 00:01:20,770 --> 00:01:22,160 ASCII character-- 28 00:01:22,160 --> 00:01:27,760 Cb4@1/4 which would be C flat in the fourth octave, but this time a quarter 29 00:01:27,760 --> 00:01:31,160 note instead of an eighth note where a quarter note if you recall, 30 00:01:31,160 --> 00:01:33,700 is twice as long as an eighth note is. 31 00:01:33,700 --> 00:01:35,950 And using this representation, we have the ability 32 00:01:35,950 --> 00:01:38,470 to represent sheet music just using the characters 33 00:01:38,470 --> 00:01:39,940 that we have on our keyboard. 34 00:01:39,940 --> 00:01:43,360 And so a sequence of notes might look something like this. 35 00:01:43,360 --> 00:01:46,300 Right here, we have it D in the fourth octave which 36 00:01:46,300 --> 00:01:50,230 is going to be an eighth note, followed by F sharp in the fourth octave which 37 00:01:50,230 --> 00:01:54,550 is going to be a quarter note, followed by A in the fourth octave which is also 38 00:01:54,550 --> 00:01:55,600 a quarter note. 39 00:01:55,600 --> 00:01:57,880 And that blank line just means that we're going 40 00:01:57,880 --> 00:02:00,530 to rest for an eighth note length. 41 00:02:00,530 --> 00:02:03,580 In other words, there's going to be no sound for a period of time 42 00:02:03,580 --> 00:02:05,230 equal to one eighth note. 43 00:02:05,230 --> 00:02:07,320 And then following that blank line, we have 44 00:02:07,320 --> 00:02:11,760 D in the fifth octave being played for the length of one eighth note. 45 00:02:11,760 --> 00:02:13,990 And so using this representation, we have the ability 46 00:02:13,990 --> 00:02:16,880 to represent songs using just text. 47 00:02:16,880 --> 00:02:20,290 So your task now doesn't actually require you to write any code, 48 00:02:20,290 --> 00:02:23,890 but all you'll need to do is take a look at the sheet music for Happy Birthday, 49 00:02:23,890 --> 00:02:27,820 figure out what notes are being played, and then turn that into that text-based 50 00:02:27,820 --> 00:02:31,180 representation of notes where each note gets its own-- 51 00:02:31,180 --> 00:02:34,300 that's the note, followed by an occidental if it has it, 52 00:02:34,300 --> 00:02:37,480 followed by an octave number, followed by the at sign, followed 53 00:02:37,480 --> 00:02:40,830 by the length of that note where one over eight is an eighth note, 54 00:02:40,830 --> 00:02:45,430 one over four is a quarter note, and one over two is a half note for instance. 55 00:02:45,430 --> 00:02:49,580 Put all of that in a file called bday.txt, and you're done. 56 00:02:49,580 --> 00:02:51,540 And that's bday. 57 00:02:51,540 --> 00:02:53,120