pxt-microbit 7.1.40 → 7.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/block-tests.js +1 -1
- package/built/common-sim.js +2 -1
- package/built/hexcache/{986702a417fa55a0e1b078a6d7403b3498bc795834f771651ebc340080a116d1.hex → 01c7e5cb51578ac59493014bcb66c4b4048db778b1d56f3b2fb53b35b7c174b2.hex} +10240 -10236
- package/built/hexcache/{d8cab56e73d9451077691022c34b835c5bbdbe6b561106a2812f7964c11125c7.hex → 3e38e448adf90822532efe34db3169af19a93c210fc406e5cd854361ca1e530f.hex} +9672 -9667
- package/built/hexcache/6cfc55436909519e8685c5d459e64fa030227c849d10978cb274204ba487916d.hex +14538 -0
- package/built/hexcache/{3858c1af7a919520536cd0945353c09f5d6651f5364aac72bddd143022164eca.hex → 8e76592a9cb06b299cd74ce547ef7a0f701f2aacd15646ccbfa1ba0f22c726ad.hex} +7409 -7404
- package/built/sim.d.ts +27 -1
- package/built/sim.js +71 -0
- package/built/target-strings.json +1 -1
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.js +1 -1
- package/built/targetlight.json +1 -1
- package/built/theme.json +1 -1
- package/built/web/blockly.css +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +4 -4
- package/built/web/semantic.css +4 -4
- package/docs/courses/csintro/algorithms.md +0 -4
- package/docs/courses/csintro/arrays.md +0 -4
- package/docs/courses/csintro/binary.md +0 -4
- package/docs/courses/csintro/booleans.md +0 -4
- package/docs/courses/csintro/conditionals.md +0 -4
- package/docs/courses/csintro/coordinates.md +0 -4
- package/docs/courses/csintro/iteration.md +0 -4
- package/docs/courses/csintro/making.md +0 -4
- package/docs/courses/csintro/radio.md +0 -4
- package/docs/courses/csintro/variables.md +0 -4
- package/docs/courses/csintro.md +0 -4
- package/docs/extensions/extension-gallery.md +4 -0
- package/docs/projects/games.md +1 -5
- package/docs/projects/guitar.md +1 -5
- package/docs/projects/inchworm.md +1 -5
- package/docs/projects/reaction-time.md +1 -5
- package/docs/projects/servo-calibrator.md +1 -1
- package/docs/projects/wallet.md +0 -4
- package/docs/projects/watch.md +0 -4
- package/docs/reference/music/built-in-playable-melody.md +1 -1
- package/docs/reference/music/create-sound-expression.md +68 -0
- package/docs/reference/music/play.md +80 -13
- package/docs/test/courses/csintro.md +0 -4
- package/docs/types/playable.md +10 -2
- package/docs/types/sound.md +7 -7
- package/package.json +3 -3
- package/pxtarget.json +8 -3
- package/targetconfig.json +2 -3
- package/built/hexcache/8282abaaf754219aa67b07053567547dda2179a2888d75791d2cd9b66bf8e531.hex +0 -14533
|
@@ -17,10 +17,6 @@ Students will...
|
|
|
17
17
|
3. [**Activity**: Happy face, sad face](/courses/csintro/algorithms/activity)
|
|
18
18
|
4. [**Project**: Fidget cube](/courses/csintro/algorithms/project)
|
|
19
19
|
|
|
20
|
-
## Flipgrid
|
|
21
|
-
|
|
22
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Algorithms** lesson: https://flipgrid.com/31ed5382
|
|
23
|
-
|
|
24
20
|
## Related standards
|
|
25
21
|
|
|
26
22
|
[Targeted CSTA standards](/courses/csintro/algorithms/standards)
|
|
@@ -28,10 +28,6 @@ Students will...
|
|
|
28
28
|
3. [**Activity**: Headband charades](/courses/csintro/arrays/activity)
|
|
29
29
|
4. [**Project**: Musical instrument ](/courses/csintro/arrays/project)
|
|
30
30
|
|
|
31
|
-
## Flipgrid
|
|
32
|
-
|
|
33
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Arrays** lesson: https://flipgrid.com/f0f1bbc5
|
|
34
|
-
|
|
35
31
|
## Related standards
|
|
36
32
|
|
|
37
33
|
[Targeted CSTA standards](/courses/csintro/arrays/standards)
|
|
@@ -27,10 +27,6 @@ Students will...
|
|
|
27
27
|
3. [**Activity**: Binary transmogrifier](/courses/csintro/binary/activity)
|
|
28
28
|
4. [**Project**: Make binary a cash register](/courses/csintro/binary/project)
|
|
29
29
|
|
|
30
|
-
## Flipgrid
|
|
31
|
-
|
|
32
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Binary** lesson: https://flipgrid.com/d44cd204
|
|
33
|
-
|
|
34
30
|
## Related standards
|
|
35
31
|
|
|
36
32
|
[Targeted CSTA standards](/courses/csintro/binary/standards)
|
|
@@ -26,10 +26,6 @@ Students will...
|
|
|
26
26
|
3. [**Activity**: Double coin flipper](/courses/csintro/booleans/activity)
|
|
27
27
|
4. [**Project**: Boolean](/courses/csintro/booleans/project)
|
|
28
28
|
|
|
29
|
-
## Flipgrid
|
|
30
|
-
|
|
31
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Booleans** lesson: https://flipgrid.com/36e0c7e0
|
|
32
|
-
|
|
33
29
|
## Related standards
|
|
34
30
|
|
|
35
31
|
[Targeted CSTA standards](/courses/csintro/booleans/standards)
|
|
@@ -20,10 +20,6 @@ Students will...
|
|
|
20
20
|
3. [**Activity**: Rock, paper, scissors](/courses/csintro/conditionals/activity)
|
|
21
21
|
4. [**Project**: Board game](/courses/csintro/conditionals/project)
|
|
22
22
|
|
|
23
|
-
## Flipgrid
|
|
24
|
-
|
|
25
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Conditionals** lesson: https://flipgrid.com/f260eda7
|
|
26
|
-
|
|
27
23
|
## Related standards
|
|
28
24
|
|
|
29
25
|
[Targeted CSTA standards](/courses/csintro/conditionals/standards)
|
|
@@ -31,10 +31,6 @@ Students will...
|
|
|
31
31
|
3. [**Activity**: Animation and patterns](/courses/csintro/coordinates/activity)
|
|
32
32
|
4. [**Project**: Screensaver or game](/courses/csintro/coordinates/project)
|
|
33
33
|
|
|
34
|
-
## Flipgrid
|
|
35
|
-
|
|
36
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Coordinates** lesson: https://flipgrid.com/699ca0b7
|
|
37
|
-
|
|
38
34
|
## Related standards
|
|
39
35
|
|
|
40
36
|
[Targeted CSTA standards](/courses/csintro/coordinates/standards)
|
|
@@ -29,10 +29,6 @@ Students will...
|
|
|
29
29
|
3. [**Activity**: Loops demos](/courses/csintro/iteration/activity)
|
|
30
30
|
4. [**Project**: Get loopy](/courses/csintro/iteration/project)
|
|
31
31
|
|
|
32
|
-
## Flipgrid
|
|
33
|
-
|
|
34
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Iteration** lesson: https://flipgrid.com/ee559ab7
|
|
35
|
-
|
|
36
32
|
## Related standards
|
|
37
33
|
|
|
38
34
|
[Targeted CSTA standards](/courses/csintro/iteration/standards)
|
|
@@ -22,10 +22,6 @@ Students will...
|
|
|
22
22
|
* [**Activity**: MakeCode download](/courses/csintro/making/activity)
|
|
23
23
|
* [**Project**: micro:pet (including mods and rubric)](/courses/csintro/making/project)
|
|
24
24
|
|
|
25
|
-
## Flipgrid
|
|
26
|
-
|
|
27
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Making** lesson: https://flipgrid.com/5773f935
|
|
28
|
-
|
|
29
25
|
## Related standards
|
|
30
26
|
|
|
31
27
|
[Targeted CSTA standards](/courses/csintro/making/standards)
|
|
@@ -26,10 +26,6 @@ Students will...
|
|
|
26
26
|
3. [**Activity**: Marco Polo and Morse code](/courses/csintro/radio/activity)
|
|
27
27
|
4. [**Project**: Radio project](/courses/csintro/radio/project)
|
|
28
28
|
|
|
29
|
-
## Flipgrid
|
|
30
|
-
|
|
31
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Radio** lesson: https://flipgrid.com/eb9af729
|
|
32
|
-
|
|
33
29
|
## Related standards
|
|
34
30
|
|
|
35
31
|
[Targeted CSTA standards](/courses/csintro/radio/standards)
|
|
@@ -23,10 +23,6 @@ Students will...
|
|
|
23
23
|
3. [**Activity**: Make a Game Scorekeeper](/courses/csintro/variables/activity)
|
|
24
24
|
4. [**Project**: Everything Counts](/courses/csintro/variables/project)
|
|
25
25
|
|
|
26
|
-
## Flipgrid
|
|
27
|
-
|
|
28
|
-
The [Flipgrid](https://info.flipgrid.com/) topic for the **Variables** lesson: https://flipgrid.com/dc42bdcc
|
|
29
|
-
|
|
30
26
|
## Related standards
|
|
31
27
|
|
|
32
28
|
[Targeted CSTA standards](/courses/csintro/variables/standards)
|
package/docs/courses/csintro.md
CHANGED
|
@@ -38,10 +38,6 @@ Each of the 12 lessons is structured in this format:
|
|
|
38
38
|
* Assessment - A project rubric and guidance for grading the project.
|
|
39
39
|
* Standards - A list of CSTA K-12 Computer Science Standards and/or concepts covered by this lesson.
|
|
40
40
|
|
|
41
|
-
### Course on Flipgrid
|
|
42
|
-
|
|
43
|
-
Flipcode for the **Intro to CS** course grid: **[csintromicrobit](https://flipgrid.com/csintromicrobit)**
|
|
44
|
-
|
|
45
41
|
## Course contents
|
|
46
42
|
|
|
47
43
|
* [About](/courses/csintro/about)
|
|
@@ -867,6 +867,10 @@ Many extensions are available to work with interface kits, add-on hardware, or o
|
|
|
867
867
|
|
|
868
868
|
```codecard
|
|
869
869
|
[{
|
|
870
|
+
"name": "Elecfreaks Petal:bit",
|
|
871
|
+
"url": "/pkg/elecfreaks/pxt-petal",
|
|
872
|
+
"cardType": "package"
|
|
873
|
+
}, {
|
|
870
874
|
"name": "Joy IT RFID Module MFRC-522",
|
|
871
875
|
"url": "/pkg/joy-it/pxt-rfid-mfrc522",
|
|
872
876
|
"cardType": "package"
|
package/docs/projects/games.md
CHANGED
package/docs/projects/guitar.md
CHANGED
package/docs/projects/wallet.md
CHANGED
package/docs/projects/watch.md
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# create Sound Expression
|
|
2
|
+
|
|
3
|
+
Create a sound expression object for a sound effect.
|
|
4
|
+
|
|
5
|
+
```sig
|
|
6
|
+
music.createSoundExpression(WaveShape.Sine, 2000, 0, 1023, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
A sound expression is set of parameters that describe a **[Sound](/types/sound)** that will last for some amount of time. These parameters specify a base waveform, frequency range, sound volume, and effects. Sound data is created as a [Sound](/types/sound) object and can then be [played](/reference/music/play) to the speaker, headphones, or at an output pin.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
* **waveShape**: the primary shape of the waveform:
|
|
14
|
+
>* `sine`: sine wave shape
|
|
15
|
+
>* `sawtooth`: sawtooth wave shape
|
|
16
|
+
>* `triangle`: triangle wave shape
|
|
17
|
+
>* `square`: square wave shape
|
|
18
|
+
>* `noise`: random noise generated wave shape
|
|
19
|
+
* **startFrequency**: a [number](/types/number) that is the frequency of the waveform when the sound expression starts.
|
|
20
|
+
* **endFrequency**: a [number](/types/number) that is the frequency of the waveform when the sound expression stops.
|
|
21
|
+
* **startVolume**: a [number](/types/number) the initial volume of the sound expression.
|
|
22
|
+
* **endVolume**: a [number](/types/number) the ending volume of the sound expression.
|
|
23
|
+
* **duration**: a [number](/types/number) the duration in milliseconds of the sound expression.
|
|
24
|
+
* **effect**: an effect to add to the waveform. These are:
|
|
25
|
+
>* `tremolo`: add slight changes in volume of the sound expression.
|
|
26
|
+
>* `vibrato`: add slight changes in frequency to the sound expression.
|
|
27
|
+
>* `warble`: a combination of the `tremolo` and `vibrato` effects.
|
|
28
|
+
* **interpolation**: controls the rate of frequency change in the sound expression.
|
|
29
|
+
>* `linear`: the change in frequency is constant for the duration of the sound.
|
|
30
|
+
>* `curve`: the change in frequency is faster at the beginning of the sound and slows toward the end.
|
|
31
|
+
>* `logarithmic`: the change in frequency is rapid during the very first part of the sound.
|
|
32
|
+
|
|
33
|
+
## Returns
|
|
34
|
+
|
|
35
|
+
* a [sound](/types/sound) expression with the the desired sound effect parameters.
|
|
36
|
+
|
|
37
|
+
## Examples
|
|
38
|
+
|
|
39
|
+
### Sine wave sound
|
|
40
|
+
|
|
41
|
+
Create a sound expression and assign it to a variable. Play the sound for the sound expression.
|
|
42
|
+
|
|
43
|
+
```blocks
|
|
44
|
+
let mySound = music.createSoundExpression(WaveShape.Sine, 2000, 0, 1023, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
|
|
45
|
+
music.play(mySound, music.PlaybackMode.UntilDone)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Complex waveform sound
|
|
49
|
+
|
|
50
|
+
Create a `triangle` wave sound expression with `vibrato` and a `curve` interpolation. Play the sound until it finishes.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
let mySound = music.createSoundExpression(
|
|
54
|
+
WaveShape.Triangle,
|
|
55
|
+
1000,
|
|
56
|
+
2700,
|
|
57
|
+
255,
|
|
58
|
+
255,
|
|
59
|
+
500,
|
|
60
|
+
SoundExpressionEffect.Vibrato,
|
|
61
|
+
InterpolationCurve.Curve
|
|
62
|
+
)
|
|
63
|
+
music.play(mySound, music.PlaybackMode.UntilDone)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## See also
|
|
67
|
+
|
|
68
|
+
[play](/reference/music/play)
|
|
@@ -1,43 +1,110 @@
|
|
|
1
1
|
# play
|
|
2
2
|
|
|
3
|
-
Play a sound
|
|
3
|
+
Play a song, melody, tone, or a sound effect from a playable music source.
|
|
4
4
|
|
|
5
5
|
```sig
|
|
6
|
-
|
|
6
|
+
music.play(music.tonePlayable(262, music.beat(BeatFraction.Whole)), music.PlaybackMode.UntilDone)
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Music is played for a simple tone, a melody, or a song. Each of these music sources is called a [playable](/types/playable) object. The ``||music:play||`` block can take any of these playable objects and play them as sound output for your game.
|
|
10
10
|
|
|
11
11
|
### ~ reminder
|
|
12
12
|
|
|
13
|
+
#### For micro:bit v2 only
|
|
14
|
+
|
|
13
15
|

|
|
14
16
|
|
|
15
17
|
This block requires the [micro:bit V2](/device/v2) hardware. If you use this block with a micro:bit v1 board, you will see the **927** error code on the screen.
|
|
16
18
|
|
|
17
19
|
### ~
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
The simplest music source is a **tone**, on note play for a duration of time:
|
|
22
|
+
|
|
23
|
+
```block
|
|
24
|
+
music.play(music.tonePlayable(262, music.beat(BeatFraction.Whole)), music.PlaybackMode.UntilDone)
|
|
25
|
+
```
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
Then, there is the **melody** which is a series of notes played at a certain speed, or `tempo`. You can create your own melody of choose a built-in one to play:
|
|
22
28
|
|
|
23
29
|
```block
|
|
24
|
-
|
|
30
|
+
music.play(music.stringPlayable("D F E A E A C B ", 120), music.PlaybackMode.UntilDone)
|
|
31
|
+
music.play(music.builtInPlayableMelody(Melodies.BaDing), music.PlaybackMode.UntilDone)
|
|
25
32
|
```
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
The most complex playable object is a **sound expression**. [Sound expressions](/reference/music/create-sound-expression) are composed in the [Sound Editor](/types/sound#sound-editing) using different parameters for making sound waves and effects..
|
|
28
35
|
|
|
29
|
-
```
|
|
30
|
-
|
|
36
|
+
```block
|
|
37
|
+
music.play(music.createSoundExpression(WaveShape.Sine, 5000, 0, 255, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear), music.PlaybackMode.UntilDone)
|
|
31
38
|
```
|
|
32
39
|
|
|
33
|
-
##
|
|
40
|
+
## Parameters
|
|
41
|
+
|
|
42
|
+
* **toPlay**: the [playable](/types/playable) object, or music source, to play.
|
|
43
|
+
* **playbackMode**: the playback mode for continuing the program:
|
|
44
|
+
>* `play until done`: play the music source in **toPlay** but wait to run the next part of the program until music play is done.
|
|
45
|
+
>* `in background`: play the music source in **toPlay** but continue with the rest of the program before music play is done.
|
|
46
|
+
>* `looping in background`: play the music source in **toPlay** but continue with the rest of the program before music play is done. The music will remain playing, returning to the first note of the music after its duration.
|
|
47
|
+
|
|
48
|
+
### ~ hint
|
|
49
|
+
|
|
50
|
+
#### Stop the music!
|
|
51
|
+
|
|
52
|
+
You can stop any music currently playing with the ``||music:stop all sounds||`` block. This is useful if **playbackMode** is set to `in background looping` and you wish to stop the music for a scene change or respond to an event with a different sound.
|
|
53
|
+
|
|
54
|
+
### ~
|
|
55
|
+
|
|
56
|
+
## Examples #example
|
|
57
|
+
|
|
58
|
+
### Play a melody
|
|
59
|
+
|
|
60
|
+
Play a short melody created in the Melody Editor.
|
|
61
|
+
|
|
62
|
+
```blocks
|
|
63
|
+
music.play(music.stringPlayable("D F E A E A C B ", 120), music.PlaybackMode.UntilDone)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Different music sources, one block to play them all
|
|
67
|
+
|
|
68
|
+
Put 4 different playable music sources in an array. Play one after the other.
|
|
69
|
+
|
|
70
|
+
```blocks
|
|
71
|
+
let playables = [
|
|
72
|
+
music.tonePlayable(262, music.beat(BeatFraction.Whole)),
|
|
73
|
+
music.stringPlayable("D F E A E A C B ", 120),
|
|
74
|
+
music.builtInPlayableMelody(Melodies.BaDing),
|
|
75
|
+
music.createSoundExpression(WaveShape.Sine, 5000, 0, 255, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
|
|
76
|
+
]
|
|
77
|
+
for (let someMusic of playables) {
|
|
78
|
+
music.play(someMusic, music.PlaybackMode.UntilDone)
|
|
79
|
+
basic.pause(500)
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Looping music play
|
|
84
|
+
|
|
85
|
+
Play a simple song in the background. When the @boardname@ is shaken, stop the song an play the `power down` melody.
|
|
86
|
+
|
|
87
|
+
```blocks
|
|
88
|
+
music.play(music.stringPlayable("C5 A B G A F A C5 ", 120), music.PlaybackMode.LoopingInBackground)
|
|
89
|
+
input.onGesture(Gesture.Shake, function () {
|
|
90
|
+
music.stopAllSounds()
|
|
91
|
+
music.play(music.builtInPlayableMelody(Melodies.PowerDown), music.PlaybackMode.InBackground)
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
### Play a sound effect
|
|
34
95
|
|
|
35
|
-
Play
|
|
96
|
+
Play a sine wave sound effect for `5` seconds.
|
|
36
97
|
|
|
37
98
|
```blocks
|
|
38
|
-
|
|
99
|
+
music.play(music.createSoundExpression(WaveShape.Sine, 5000, 0, 255, 0, 5000, SoundExpressionEffect.None, InterpolationCurve.Linear), music.PlaybackMode.UntilDone)
|
|
39
100
|
```
|
|
40
101
|
|
|
41
102
|
## See also
|
|
42
103
|
|
|
43
|
-
[
|
|
104
|
+
[tone playable](/reference/music/tone-playable),
|
|
105
|
+
[string playable](/reference/music/string-playable),
|
|
106
|
+
[melody playable](/reference/music/built-in-melody-playable),
|
|
107
|
+
[create song](/reference/music/create-song),
|
|
108
|
+
[stop all sounds](/reference/music/stop-all-sounds),
|
|
109
|
+
[sound editor](/reference/types/sound#sound-editing),
|
|
110
|
+
[create sound expression](/reference/music/create-sound-expression)
|
|
@@ -38,10 +38,6 @@ Each of the 12 lessons is structured in this format:
|
|
|
38
38
|
* Assessment - A project rubric and guidance for grading the project.
|
|
39
39
|
* Standards - A list of CSTA K-12 Computer Science Standards and/or concepts covered by this lesson.
|
|
40
40
|
|
|
41
|
-
### Course on Flipgrid
|
|
42
|
-
|
|
43
|
-
Flipcode for the **Intro to CS** course grid: **[csintromicrobit](https://flipgrid.com/csintromicrobit)**
|
|
44
|
-
|
|
45
41
|
## Course contents
|
|
46
42
|
|
|
47
43
|
* [About](/test/courses/csintro/about)
|
package/docs/types/playable.md
CHANGED
|
@@ -22,6 +22,14 @@ Melodies are a series of notes and a tempo to play them at.
|
|
|
22
22
|
music.stringPlayable("D F E A E A C B ", 120)
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
### Sound Expression
|
|
26
|
+
|
|
27
|
+
A sound expression is set of parameters that describe a **[sound](/types/sound)** that will last for some amount of time. These parameters specify a base waveform, frequency range, sound volume, and effects.
|
|
28
|
+
|
|
29
|
+
```block
|
|
30
|
+
music.play(music.createSoundExpression(WaveShape.Sine, 5000, 0, 255, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear), music.PlaybackMode.UntilDone)
|
|
31
|
+
```
|
|
32
|
+
|
|
25
33
|
## Play the music
|
|
26
34
|
|
|
27
35
|
In your programs, you can simply use the ``||music:play||`` blocks for each playable object. Like this one for tone:
|
|
@@ -47,5 +55,5 @@ for (let someMusic of playables) {
|
|
|
47
55
|
|
|
48
56
|
## See also
|
|
49
57
|
|
|
50
|
-
[play](/reference/music/play), [tone playable](/reference/music/tone-playable)
|
|
51
|
-
[string playable](/reference/music/string-playable)
|
|
58
|
+
[play](/reference/music/play), [tone playable](/reference/music/tone-playable)
|
|
59
|
+
[string playable](/reference/music/string-playable), [create sound expression](/reference/music/create-sound-expression)
|
package/docs/types/sound.md
CHANGED
|
@@ -15,8 +15,8 @@ In code, a **Sound** type is a complex data object that includes data for all th
|
|
|
15
15
|
Code for creating and playing a sound from a sound expression could look like this:
|
|
16
16
|
|
|
17
17
|
```typescript-ignore
|
|
18
|
-
let mySound = music.
|
|
19
|
-
music.
|
|
18
|
+
let mySound = music.createSoundExpression(WaveShape.Sine, 2000, 0, 1023, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
|
|
19
|
+
music.play(mySound, music.PlaybackMode.UntilDone)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
### ~
|
|
@@ -59,7 +59,7 @@ A square wave has both verical rising and falling edges with a flat section on t
|
|
|
59
59
|
|
|
60
60
|
### Noise wave
|
|
61
61
|
|
|
62
|
-
The noise wave is created using random
|
|
62
|
+
The noise wave is created using random frequencies and volume. Setting the frequency parameters for the sound expression creates a "tuning" range for the noise sound effect.
|
|
63
63
|
|
|
64
64
|

|
|
65
65
|
|
|
@@ -85,9 +85,9 @@ The volume controls the loudness (amplitude) of the sound. The sound can start w
|
|
|
85
85
|
|
|
86
86
|
## Frequency
|
|
87
87
|
|
|
88
|
-
Frequency is how fast a wave repeats itself from the zero line to its peak down to its trough and back to the zero line. If it does this 1000 times in one second then the frequency has 1000 cycles per second and is measured in units of Hertz (1000 Hz). The frequency of the sound at any point in time is its current _pitch_. Musical notes and parts of speech are different
|
|
88
|
+
Frequency is how fast a wave repeats itself from the zero line to its peak down to its trough and back to the zero line. If it does this 1000 times in one second then the frequency has 1000 cycles per second and is measured in units of Hertz (1000 Hz). The frequency of the sound at any point in time is its current _pitch_. Musical notes and parts of speech are different frequencies that last for short periods of time in a sound.
|
|
89
89
|
|
|
90
|
-
A sound expression has both a starting frequency and an ending
|
|
90
|
+
A sound expression has both a starting frequency and an ending frequency. The frequency can start low and end high, start high and end low, or remain the same for the duration of the sound.
|
|
91
91
|
|
|
92
92
|
### High to low
|
|
93
93
|
|
|
@@ -132,5 +132,5 @@ Interpolation is how the sound expression will make the changes in frequency or
|
|
|
132
132
|
|
|
133
133
|
## See also
|
|
134
134
|
|
|
135
|
-
[play
|
|
136
|
-
[create sound
|
|
135
|
+
[play](/reference/music/play),
|
|
136
|
+
[create sound expression](/reference/music/create-sound-expression)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pxt-microbit",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.43",
|
|
4
4
|
"description": "micro:bit target for Microsoft MakeCode (PXT)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"JavaScript",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"typescript": "4.8.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"pxt-common-packages": "12.3.
|
|
49
|
-
"pxt-core": "11.4.
|
|
48
|
+
"pxt-common-packages": "12.3.31",
|
|
49
|
+
"pxt-core": "11.4.29"
|
|
50
50
|
},
|
|
51
51
|
"overrides": {
|
|
52
52
|
"@blockly/field-colour": {
|
package/pxtarget.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"corepkg": "core",
|
|
8
8
|
"bundleddirs": [
|
|
9
9
|
"libs/core",
|
|
10
|
+
"libs/audio-samples",
|
|
10
11
|
"libs/radio",
|
|
11
12
|
"libs/devices",
|
|
12
13
|
"libs/bluetooth",
|
|
@@ -430,14 +431,18 @@
|
|
|
430
431
|
"workspaceSearch": true,
|
|
431
432
|
"allowPackageExtensions": true,
|
|
432
433
|
"addNewTypeScriptFile": true,
|
|
433
|
-
"
|
|
434
|
+
"enabledFeatures": {
|
|
435
|
+
"blocksErrorList": {},
|
|
436
|
+
"aiErrorHelp": {
|
|
437
|
+
"includeRegions": ["US"]
|
|
438
|
+
}
|
|
439
|
+
},
|
|
434
440
|
"experiments": [
|
|
435
441
|
"accessibleBlocks",
|
|
436
442
|
"debugExtensionCode",
|
|
437
443
|
"bluetoothUartConsole",
|
|
438
444
|
"bluetoothPartialFlashing",
|
|
439
|
-
"identity"
|
|
440
|
-
"blocksErrorList"
|
|
445
|
+
"identity"
|
|
441
446
|
],
|
|
442
447
|
"supportedExperiences": [
|
|
443
448
|
"code-eval"
|
package/targetconfig.json
CHANGED
|
@@ -350,7 +350,6 @@
|
|
|
350
350
|
"microsoft/pxt-jacdac/motor": {},
|
|
351
351
|
"microsoft/pxt-jacdac/multitouch": {},
|
|
352
352
|
"microsoft/pxt-jacdac/potentiometer": {},
|
|
353
|
-
"microsoft/pxt-jacdac/power": {},
|
|
354
353
|
"microsoft/pxt-jacdac/pulse-oximeter": {},
|
|
355
354
|
"microsoft/pxt-jacdac/rain-gauge": {},
|
|
356
355
|
"microsoft/pxt-jacdac/real-time-clock": {},
|
|
@@ -477,6 +476,7 @@
|
|
|
477
476
|
"ines-hpmm/pxt-luma-matrix": { "tags": [ "Lights and Display" ] },
|
|
478
477
|
"team-bp/pxt-bplab": { "tags": [ "Science" ] },
|
|
479
478
|
"jimd80/pxt-coderdojo-controller": { "tags": [ "Gaming" ] },
|
|
479
|
+
"elecfreaks/pxt-petal": { "tags": [ "Science" ] },
|
|
480
480
|
"microsoft/pxt-simx-sample": {
|
|
481
481
|
"simx": {
|
|
482
482
|
"sha": "7301f5900879b85127482d79bab48f03c25690a8",
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
},
|
|
499
499
|
"jacdac/pxt-jacdac": {
|
|
500
500
|
"simx": {
|
|
501
|
-
"sha": "
|
|
501
|
+
"sha": "c286f6312ba29f9acc9a153d7b852f37f31e62e3",
|
|
502
502
|
"devUrl": "https://jacdac.github.io/pxt-jacdac/"
|
|
503
503
|
}
|
|
504
504
|
},
|
|
@@ -542,7 +542,6 @@
|
|
|
542
542
|
"jacdac/pxt-jacdac/motor": {},
|
|
543
543
|
"jacdac/pxt-jacdac/multitouch": {},
|
|
544
544
|
"jacdac/pxt-jacdac/potentiometer": {},
|
|
545
|
-
"jacdac/pxt-jacdac/power": {},
|
|
546
545
|
"jacdac/pxt-jacdac/pulse-oximeter": {},
|
|
547
546
|
"jacdac/pxt-jacdac/rain-gauge": {},
|
|
548
547
|
"jacdac/pxt-jacdac/real-time-clock": {},
|