Fixing beat fraction typo (#263)

This commit is contained in:
Richard Knoll 2016-09-23 22:27:57 -07:00 committed by Peli de Halleux
parent 96e23d99b2
commit 0676d780ab
3 changed files with 76 additions and 76 deletions

View File

@ -7,7 +7,7 @@ Have you ever tried to play a song on an instrument? Let's try coding the song "
Let's start by adding the code in the music drawer that includes a single musical chord (or pitched sound) with the `play` block. Then insert the chord "C". Once you are done coding, don't forget to run your code in the simulator or the micro:bit.
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
```
* click run to see if the code works as expected.
@ -15,12 +15,12 @@ music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
We want to continue to adding musical chords with the `play` block. So insert the appropriate chord blocks: `D`, `F`, `G` to complete the first part of the song. Modify your code so that your code looks like this.
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
basic.pause(100);
```
@ -29,19 +29,19 @@ basic.pause(100);
We want to continue to adding musical chords with the `play` block. Then insert the appropriate chords: `B`, `C`, `D`, `E` , `F` to complete the second part of the song. Modify your code so that your code looks like this.
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
basic.pause(100);
```

View File

@ -8,19 +8,19 @@ Complete the [happy birthday](/lessons/happy-birthday/activity) activity and you
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
basic.pause(100);
@ -35,26 +35,26 @@ Let's code the third part of Happy Birthday!
To do this, you need to add blocks after the last line of the `play` blocks. We want to continue to adding musical chords with the `play` block. Then insert the appropriate chord blocks `G`, `E`, `C`, `B`, `A` to complete the third part of the song. Modify your code so that your code looks like this.
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
basic.pause(100);
```
@ -66,33 +66,33 @@ Finally, we continue to adding the appropriate `play` block and fit the followin
```blocks
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.C), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.E), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.D), music.beat(BeatFraction.Quarter));
basic.pause(100);
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.B), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quater));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.A), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.B), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.G), music.beat(BeatFraction.Quarter));
music.playTone(music.noteFrequency(Note.F), music.beat(BeatFraction.Quarter));
```

View File

@ -115,7 +115,7 @@ enum BeatFraction {
//% block="1/2"
Half = 2,
//% block="1/4"
Quater = 4,
Quarter = 4,
//% block="1/8"
Eighth = 8,
//% block="1/16"
@ -192,7 +192,7 @@ namespace music {
let beat = 60000 / beatsPerMinute;
if (fraction == BeatFraction.Whole) return beat;
else if (fraction == BeatFraction.Half) return beat / 2;
else if (fraction == BeatFraction.Quater) return beat / 4
else if (fraction == BeatFraction.Quarter) return beat / 4
else if (fraction == BeatFraction.Eighth) return beat / 8;
else return beat / 16;
}