Merge branch 'master' of https://github.com/Microsoft/pxt-microbit
This commit is contained in:
commit
a2cb2c2ed0
@ -6,7 +6,6 @@ Generation of music tones through pin ``P0``.
|
|||||||
music.playTone(0, 0);
|
music.playTone(0, 0);
|
||||||
music.ringTone(0);
|
music.ringTone(0);
|
||||||
music.rest(0);
|
music.rest(0);
|
||||||
music.noteFrequency(Note.C);
|
|
||||||
music.beat(BeatFraction.Whole);
|
music.beat(BeatFraction.Whole);
|
||||||
music.tempo();
|
music.tempo();
|
||||||
music.changeTempoBy(20);
|
music.changeTempoBy(20);
|
||||||
@ -15,4 +14,4 @@ music.setTempo(120);
|
|||||||
|
|
||||||
### See Also
|
### See Also
|
||||||
|
|
||||||
[playTone](/reference/music/play-tone), [ringTone](/reference/music/ring-tone), [rest](/reference/music/rest), [noteFrequency](/reference/music/note-frequency), [beat](/reference/music/beat), [tempo](/reference/music/tempo), [changeTempoBy](/reference/music/change-tempo), [setTempo](/reference/music/set-tempo)
|
[playTone](/reference/music/play-tone), [ringTone](/reference/music/ring-tone), [rest](/reference/music/rest), [beat](/reference/music/beat), [tempo](/reference/music/tempo), [changeTempoBy](/reference/music/change-tempo-by), [setTempo](/reference/music/set-tempo)
|
||||||
|
30
docs/reference/music/beat.md
Normal file
30
docs/reference/music/beat.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Beat
|
||||||
|
|
||||||
|
Returns the duration of a beat in milli-seconds
|
||||||
|
|
||||||
|
## Simulator
|
||||||
|
|
||||||
|
This function only works on the micro:bit and in some browsers.
|
||||||
|
|
||||||
|
```sig
|
||||||
|
music.beat(BeatFraction.Whole)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
* ``BeatFraction`` means fraction of a beat (BeatFraction.Whole, BeatFraction.Sixteenth etc)
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
|
||||||
|
* a [number](/reference/types/number) that means the amount of milli-seconds a beat fraction represents.
|
||||||
|
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
music.playTone(Note.C, music.beat(BeatFraction.Quarter))
|
||||||
|
```
|
||||||
|
|
||||||
|
### See also
|
||||||
|
|
||||||
|
[play tone](/reference/music/play-tone), [ring tone](/reference/music/ring-tone), [rest](/reference/music/rest), [set tempo](/reference/music/set-tempo), [change tempo by](/reference/music/change-tempo-by)
|
@ -22,7 +22,7 @@ change
|
|||||||
|
|
||||||
change-score-by
|
change-score-by
|
||||||
|
|
||||||
change-tempo
|
change-tempo-by
|
||||||
|
|
||||||
change-var
|
change-var
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ namespace music {
|
|||||||
* Change the tempo by the specified amount
|
* Change the tempo by the specified amount
|
||||||
* @param bpm The change in beats per minute to the tempo, eg: 20
|
* @param bpm The change in beats per minute to the tempo, eg: 20
|
||||||
*/
|
*/
|
||||||
//% help=music/change-tempo weight=39
|
//% help=music/change-tempo-by weight=39
|
||||||
//% blockId=device_change_tempo block="change tempo by (bpm)|%value" blockGap=8
|
//% blockId=device_change_tempo block="change tempo by (bpm)|%value" blockGap=8
|
||||||
export function changeTempoBy(bpm: number): void {
|
export function changeTempoBy(bpm: number): void {
|
||||||
init();
|
init();
|
||||||
|
Loading…
Reference in New Issue
Block a user