forked from microsoft/pxt-calliope
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cherry pick mb updates 7.0.12to7.0.20
- Loading branch information
1 parent
7fc3600
commit 6162390
Showing
52 changed files
with
1,268 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# string Playable | ||
|
||
Created a short melody of notes composed in a string. | ||
|
||
```sig | ||
music.stringPlayable("D F E A E A C B ", 120) | ||
``` | ||
|
||
The **melody** is short series of notes composed in a string. The melody is played at a rate set by the **tempo** value you give. The melody string contains a sequence of notes formatted like this: | ||
|
||
``"E B C5 A B G A F "`` | ||
|
||
The melody is shown in the ``||music:melody||`` block as note symbols which also appear in the Melody Editor. | ||
|
||
```block | ||
music.stringPlayable("E F G F E G B C5 ", 120) | ||
``` | ||
|
||
The melodies are most often created in the Melody Editor from the block so that valid notes are chosen and the correct melody length is set. | ||
|
||
## Parameters | ||
|
||
* **melody**: a [string](/types/string) which contains the notes of the melody. | ||
* **tempo**: a [number](/types/number) which is the rate to play the melody at in beats per minute. | ||
|
||
## Returns | ||
|
||
* a [playable](/types/playable) object that contains the **melody** and **tempo**. | ||
|
||
## Example | ||
|
||
Play the ``Mystery`` melody continuously. | ||
|
||
```blocks | ||
music.play(music.stringPlayable("E F G F E G B C5 ", 120), music.PlaybackMode.LoopingInBackground) | ||
``` | ||
|
||
## See also | ||
|
||
[tone playable](/reference/music/tone-playable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# tone Playable | ||
|
||
Create a musical tone that will play for some amount of time. | ||
|
||
```sig | ||
music.tonePlayable(262, music.beat(BeatFraction.Whole)) | ||
``` | ||
|
||
## Parameters | ||
|
||
* **note**: is the note frequency as a [number](/types/number) of [Hertz](https://wikipedia.org/wiki/Hertz) (how high or low the tone is, also known as _pitch_). If **note** is less or equal to zero, no sound is played. | ||
* **duration**: is the [number](/types/number) of milliseconds (one-thousandth of a second) that the tone lasts for. If **duration** is negative or zero, the sound will play continuously. | ||
|
||
## Returns | ||
|
||
* a [playable](/types/playable) object that contains the tone. | ||
|
||
## Example | ||
|
||
Store the musical note 'C' in the variable `note` and play that note for 1000 milliseconds (one second). | ||
|
||
```blocks | ||
let note = music.noteFrequency(Note.C); | ||
music.play(music.tonePlayable(note, music.beat(BeatFraction.Whole)), music.PlaybackMode.UntilDone) | ||
``` | ||
|
||
## See also | ||
|
||
[string playable](/reference/music/string-playable) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# set Audio Pin Enabled | ||
|
||
Enable a pin on the edge connector to output audio. | ||
|
||
```sig | ||
pins.setAudioPinEnabled(false) | ||
``` | ||
|
||
You can enable the @boardname@ to output audio to a pin on the edge connector. | ||
|
||
### ~ hint | ||
|
||
#### micro:bit V2 speaker | ||
|
||
With the [micro:bit V2](/device/v2) hardware, the built-in speaker will play (mirror) the same tones and music sent to the audio pin. | ||
|
||
### ~ | ||
|
||
## Parameters | ||
|
||
* **enabled**: audio is output to a pin is enabled if `true`, disabled if `false`. | ||
|
||
## Example | ||
|
||
Enable audio output to a pin on the edge connector and play a tone for the "A4" note at pin **P0** for 1 second. | ||
|
||
```blocks | ||
pins.setAudioPinEnabled(false) | ||
pins.setAudioPin(AnalogPin.P0) | ||
let frequency = 440 | ||
let duration = 1000 | ||
pins.analogPitch(frequency, duration) | ||
``` | ||
|
||
## See also | ||
|
||
[@boardname@ pins](/device/pins), [set audio pin](/reference/pins/set-audio-pin), | ||
[analog set pitch pin](/reference/pins/analog-set-pitch-pin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.