This commit is contained in:
Peli de Halleux 2016-10-21 14:46:23 -07:00
commit a2cb2c2ed0
4 changed files with 33 additions and 4 deletions

View File

@ -6,7 +6,6 @@ Generation of music tones through pin ``P0``.
music.playTone(0, 0);
music.ringTone(0);
music.rest(0);
music.noteFrequency(Note.C);
music.beat(BeatFraction.Whole);
music.tempo();
music.changeTempoBy(20);
@ -15,4 +14,4 @@ music.setTempo(120);
### 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)

View 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)

View File

@ -22,7 +22,7 @@ change
change-score-by
change-tempo
change-tempo-by
change-var

View File

@ -211,7 +211,7 @@ namespace music {
* Change the tempo by the specified amount
* @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
export function changeTempoBy(bpm: number): void {
init();