pxt-microbit 4.1.26 → 4.1.29

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.
@@ -355,11 +355,11 @@
355
355
  },
356
356
  "uploadDocs": true,
357
357
  "versions": {
358
- "branch": "v4.1.26",
359
- "tag": "v4.1.26",
360
- "commits": "https://github.com/microsoft/pxt-microbit/commits/8e52fbaa54225431f38e20eb9de4e35bd29a8dc3",
361
- "target": "4.1.26",
362
- "pxt": "7.5.21"
358
+ "branch": "v4.1.29",
359
+ "tag": "v4.1.29",
360
+ "commits": "https://github.com/microsoft/pxt-microbit/commits/a50d2ca7104beaea76556dd147d117591ca51c17",
361
+ "target": "4.1.29",
362
+ "pxt": "7.5.25"
363
363
  },
364
364
  "blocksprj": {
365
365
  "id": "blocksprj",
package/built/theme.json CHANGED
@@ -254,6 +254,7 @@
254
254
  },
255
255
  "winAppDeprImage": "/static/winapp.PNG",
256
256
  "showWinAppDeprBanner": false,
257
+ "legacyTutorial": true,
257
258
  "TOC": [
258
259
  {
259
260
  "name": "About",
@@ -0,0 +1,40 @@
1
+ # builtin Sound Effect
2
+
3
+ Get a sound expression string for a built-in sound effect.
4
+
5
+ ```sig
6
+ music.builtinSoundEffect(soundExpression.giggle)
7
+ ```
8
+
9
+ A collection of built-in sound effects are available as sound expressions. You choose one by selecting the name of the effect
10
+
11
+ ## Parameters
12
+
13
+ * **soundExpression**: A sound expression name. The available effects are:
14
+ >* `giggle`
15
+ >* `happy`
16
+ >* `hello`
17
+ >* `mysterious`
18
+ >* `sad`
19
+ >* `slide`
20
+ >* `soaring`
21
+ >* `spring`
22
+ >* `twinkle`
23
+ >* `yawn`
24
+
25
+ ## Returns
26
+
27
+ * a [sound](/types/sound) expression [string](/types/string) with the the named sound effect.
28
+
29
+ ## Example
30
+
31
+ Play the built-in sound effect for `giggle`.
32
+
33
+ ```blocks
34
+ music.playSoundEffect(music.builtinSoundEffect(soundExpression.giggle), SoundExpressionPlayMode.UntilDone)
35
+ ```
36
+
37
+ ## See also
38
+
39
+ [play sound effect](/reference/music/play-sound-effect),
40
+ [create sound effect](/reference/music/create-sound-effect)
@@ -0,0 +1,48 @@
1
+ # create Sound Effect
2
+
3
+ Create a sound expression string for a sound effect.
4
+
5
+ ```sig
6
+ music.createSoundEffect(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-sound-effect) 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`: similar to `vibrato` but with faster variations in the frequency changes.
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 [string](/types/string) with the the desired sound effect parameters.
36
+
37
+ ## Example
38
+
39
+ Create a sound expression string and assign it to a variable. Play the sound for the sound expression.
40
+
41
+ ```blocks
42
+ let mySound = music.createSoundEffect(WaveShape.Sine, 2000, 0, 1023, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
43
+ music.playSoundEffect(mySound, SoundExpressionPlayMode.UntilDone)
44
+ ```
45
+
46
+ ## See also
47
+
48
+ [play sound effect](/reference/music/play-sound-effect), [built-in sound effect](/reference/music/builtin-sound-effect)
@@ -0,0 +1,41 @@
1
+ # play Sound Effect
2
+
3
+ Play a sound that is generated from a sound expression.
4
+
5
+ ```sig
6
+ music.playSoundEffect("", SoundExpressionPlayMode.UntilDone)
7
+ ```
8
+
9
+ This will play a **[Sound](/types/sound)** object created from a sound expression. The sound will play for the duration that was set in the sound expression. The sound can play on the speaker or at a pin that is set for sound output.
10
+
11
+ Your program can wait for the sound to finish before it runs its next step. To do this, set the play mode to `until done`. Otherwise, use `background` for the program to continue immediately after the sound starts.
12
+
13
+ ### ~ reminder
14
+
15
+ #### Works with micro:bit V2
16
+
17
+ ![works with micro:bit V2 only image](/static/v2/v2-only.png)
18
+
19
+ 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.
20
+
21
+ ### ~
22
+
23
+ ## Parameters
24
+
25
+ * **sound**: a [string](/types/string) that is the sound expression for the sound you want to play.
26
+ * **mode**: the play mode for the sound, either `until done` or `background`.
27
+
28
+ ## Example
29
+
30
+ Play a sound from a sound expression for `1` second.
31
+
32
+ ```blocks
33
+ music.playSoundEffect(music.createSoundEffect(WaveShape.Sine, 2000, 0, 1023, 0, 1000, SoundExpressionEffect.None, InterpolationCurve.Linear), SoundExpressionPlayMode.UntilDone)
34
+ ```
35
+
36
+ ## See also
37
+
38
+ [create sound effect](/reference/music/create-sound-effect),
39
+ [built-in sound effect](/reference/music/builtin-sound-effect),
40
+ [set built in speaker enabled](/reference/music/set-built-in-speaker-enabled),
41
+ [analog set pitch pin](/reference/pins/analog-set-pitch-pin)
@@ -24,4 +24,8 @@ music.volume()
24
24
  [stopMelody](/reference/music/stop-melody), [onEvent](/reference/music/on-event),
25
25
  [beat](/reference/music/beat), [tempo](/reference/music/tempo),
26
26
  [changeTempoBy](/reference/music/change-tempo-by), [setTempo](/reference/music/set-tempo),
27
- [setVolume](/reference/music/set-volume), [volume](/reference/music/volume)
27
+ [setVolume](/reference/music/set-volume), [volume](/reference/music/volume),
28
+ [play sound effect](/reference/music/play-sound-effect),
29
+ [create sound effect](/reference/music/create-sound-effect),
30
+ [built-in sound effect](/reference/music/builtin-sound-effect)
31
+
@@ -0,0 +1,136 @@
1
+ # Sound
2
+
3
+ A **Sound** is a data object that is created from a sound expression. A sound expression is group of parameters that define a sound, such as wave shape, sound volume, frequency, and duration.
4
+
5
+ A sound is generated from an expression based on a fundamental wave shape, or waveform. To make a sound wave, the sound data must change from a high peak to a low trough over a period of time and repeat. The peaks and troughs are the positive amplitudes and negative amplitudes of the wave across the zero line. The volume controls the amplitude of the wave.
6
+
7
+ When the sound is played on a speaker or headphones, the vibrations create the pressures our ears detect as sound.
8
+
9
+ ### ~ hint
10
+
11
+ #### Sounds and Sound Expressions
12
+
13
+ In code, a **Sound** type is a complex data object that includes data for all the elements that represent a sound. This includes information about the frequencies and volumes at various points in time for the duration of the sound. A **SoundExpression** is another data type that helps create a **Sound**. It has the elements of how to make the sound. Many of them you specify when you edit a sound.
14
+
15
+ Code for creating and playing a sound from a sound expression could look like this:
16
+
17
+ ```typescript-ignore
18
+ let mySound = music.createSoundEffect(WaveShape.Sine, 2000, 0, 1023, 0, 500, SoundExpressionEffect.None, InterpolationCurve.Linear)
19
+ music.playSoundEffect(mySound, SoundExpressionPlayMode.UntilDone)
20
+ ```
21
+
22
+ ### ~
23
+
24
+ ## Sound Editing
25
+
26
+ When you click on the waveform in the ``||music:play sound||`` block, the sound editor will display. The sound editor defines the sound expression parameter with choices for the **waveform**, sound **duration** time, **frequency** range, **volume** range, **effect**, and **interpolation**.
27
+
28
+ ![Sound Editor](/static/types/sound/sound-editor.png)
29
+
30
+ Both the frequency and volume can start and end with different values across the duration of the sound.
31
+
32
+ ## Wave shape
33
+
34
+ The wave shape is chosen to create a natural sound or a synthetic sound. Some wave shapes can also serve to generate signals when played to a pin instead of a speaker or headphones.
35
+
36
+ ### Sine wave
37
+
38
+ The waveform that matches natural sound is the sine wave. This is the wave type in music and voice.
39
+
40
+ ![Sine wave](/static/types/sound/sine-wave.png)
41
+
42
+ ### Sawtooth wave
43
+
44
+ A sawtooth wave has a vertical rising edge and a linear falling edge. It's shape looks like the teeth on a saw.
45
+
46
+ ![Sawtooth wave](/static/types/sound/sawtooth-wave.png)
47
+
48
+ ### Triangle wave
49
+
50
+ The triangle wave is has symmetrical a rising and a falling edge. It makes the shape of triangles in the waveform.
51
+
52
+ ![Triangle wave](/static/types/sound/triangle-wave.png)
53
+
54
+ ### Square wave
55
+
56
+ A square wave has both verical rising and falling edges with a flat section on the top and bottom. The flat sections match the volume set for the sound. Square waves are sometimes used to represent digital data and will make an "electronic" sound.
57
+
58
+ ![Square wave](/static/types/sound/square-wave.png)
59
+
60
+ ### Noise wave
61
+
62
+ The noise wave is created using random frequenices and volume. Setting the frequency parameters for the sound expression creates a "tuning" range for the noise sound effect.
63
+
64
+ ![Noise wave](/static/types/sound/noise-wave.png)
65
+
66
+ ## Duration
67
+
68
+ The sound has a length of time that it plays for. This is set as a number of milliseconds (**ms**).
69
+
70
+ ## Volume
71
+
72
+ The volume controls the loudness (amplitude) of the sound. The sound can start with one volume setting and end with another. It can begin loud and end quiet, or the other way around. The volume control has start and end points that can be adjusted higher and lower. Grab them and move them up or down.
73
+
74
+ ### High to low
75
+
76
+ ![Volume from high to low](/static/types/sound/volume-hilo.png)
77
+
78
+ ### Low to High
79
+
80
+ ![Volume from low to high](/static/types/sound/volume-lohi.png)
81
+
82
+ ### Constant volume
83
+
84
+ ![Constant volume](/static/types/sound/volume-constant.png)
85
+
86
+ ## Frequency
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 frequecies that last for short periods of time in a sound.
89
+
90
+ A sound expression has both a starting frequency and an ending frequecy. The frequency can start low and end high, start high and end low, or remain the same for the duration of the sound.
91
+
92
+ ### High to low
93
+
94
+ ![Frequency from high to low](/static/types/sound/freq-hilo.png)
95
+
96
+ ### Low to High
97
+
98
+ ![Frequency from low to high](/static/types/sound/freq-lohi.png)
99
+
100
+ ### Effect
101
+
102
+ Effects add small changes to the waveform but can make a big change in how it sounds to a listener. There are a few effects available to apply to a sound.
103
+
104
+ * **Tremolo**: add slight changes in volume of the sound expression.
105
+
106
+ >![Tremolo effect setting](/static/types/sound/effect-tremolo.png)
107
+
108
+ * **Vibrato**: add slight changes in frequency to the sound expression.
109
+
110
+ >![Vibrato effect setting](/static/types/sound/effect-vibrato.png)
111
+
112
+ * **Warble**: similar to Vibrato but with faster variations in the frequency changes.
113
+
114
+ >![Warble effect setting](/static/types/sound/effect-warble.png)
115
+
116
+ ### Interpolation
117
+
118
+ Interpolation is how the sound expression will make the changes in frequency or volume of the sound. These changes can occur at a constant rate along duration of the sound or more suddenly at the beginning.
119
+
120
+ * **Linear**: The change in frequency is constant for the duration of the sound.
121
+
122
+ >![Frequency from low to high](/static/types/sound/interp-linear.png)
123
+
124
+ * **Curve**: The change in frequency is faster at the beginning of the sound and slows toward the end.
125
+
126
+ >![Frequency from low to high](/static/types/sound/interp-curve.png)
127
+
128
+ * **Logarithmic**: The change in frequency is rapid during the very first part of the sound.
129
+
130
+
131
+ >![Frequency from low to high](/static/types/sound/interp-log.png)
132
+
133
+ ## See also
134
+
135
+ [play sound effect](/reference/music/play-sound-effect),
136
+ [create sound effect](/reference/music/create-sound-effect)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-microbit",
3
- "version": "4.1.26",
3
+ "version": "4.1.29",
4
4
  "description": "micro:bit target for Microsoft MakeCode (PXT)",
5
5
  "keywords": [
6
6
  "JavaScript",
@@ -45,6 +45,6 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "pxt-common-packages": "9.5.6",
48
- "pxt-core": "7.5.21"
48
+ "pxt-core": "7.5.25"
49
49
  }
50
50
  }
package/pxtarget.json CHANGED
@@ -15,7 +15,8 @@
15
15
  "libs/microphone",
16
16
  "libs/settings",
17
17
  "libs/flashlog",
18
- "libs/datalogger"
18
+ "libs/datalogger",
19
+ "libs/color"
19
20
  ],
20
21
  "cloud": {
21
22
  "workspace": false,
@@ -601,7 +602,8 @@
601
602
  "incompatibleHardwareImage": "/static/download/incompatible.png"
602
603
  },
603
604
  "winAppDeprImage": "/static/winapp.PNG",
604
- "showWinAppDeprBanner": false
605
+ "showWinAppDeprBanner": false,
606
+ "legacyTutorial": true
605
607
  },
606
608
  "queryVariants": {
607
609
  "hidemenu": {