@ -10,11 +10,11 @@ This function only works on the @boardname@ and in some browsers.
|
||||
music.beat(BeatFraction.Whole)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``BeatFraction`` means fraction of a beat (BeatFraction.Whole, BeatFraction.Sixteenth etc)
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* a [number](/types/number) that means the amount of milli-seconds a beat fraction represents.
|
||||
|
||||
@ -25,6 +25,6 @@ music.beat(BeatFraction.Whole)
|
||||
music.playTone(Note.C, music.beat(BeatFraction.Quarter))
|
||||
```
|
||||
|
||||
### See also
|
||||
## 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)
|
@ -10,7 +10,7 @@ This function only works on the @boardname@ and in some browsers.
|
||||
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``melody`` is the array representation of a melody you wish to play
|
||||
|
||||
@ -22,7 +22,7 @@ This example plays the ``Entertainer`` built-in melody.
|
||||
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[play tone](/reference/music/play-tone), [rest](/reference/music/rest), [ring tone](/reference/music/ring-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||
[change tempo by](/reference/music/change-tempo-by)
|
||||
|
@ -11,13 +11,13 @@ This function only works on the @boardname@ and in some browsers.
|
||||
music.changeTempoBy(20)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``bpm`` is a [number](/types/number) that says how much to
|
||||
change the bpm (beats per minute, or number of beats in a minute of
|
||||
the music that the @boardname@ is playing).
|
||||
|
||||
### Examples
|
||||
## Examples
|
||||
|
||||
This program makes the music faster by 12 bpm.
|
||||
|
||||
@ -31,7 +31,7 @@ This program makes the music _slower_ by 12 bpm.
|
||||
music.changeTempoBy(-12)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[play tone](/reference/music/play-tone), [ring tone](/reference/music/ring-tone)
|
||||
|
||||
|
@ -6,12 +6,12 @@ Raises events for melodies or music events.
|
||||
music.onEvent(MusicEvent.MelodyNotePlayed, () => {})
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``value`` the kind of event
|
||||
* ``handler`` the code to run when the event is raised.
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This example prints all the events to the serial output.
|
||||
|
||||
|
@ -2,17 +2,17 @@
|
||||
|
||||
Play a musical tone through pin ``P0`` of the @boardname@ for as long as you say.
|
||||
|
||||
### ~ hint
|
||||
## ~ hint
|
||||
|
||||
This function only works on the @boardname@ and in some browsers.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
```sig
|
||||
music.playTone(440, 120)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``frequency`` is the [number](/types/number) of Hertz (how high or low the tone is).
|
||||
* ``ms`` is the [number](/types/number) of milliseconds that the tone lasts
|
||||
@ -28,7 +28,7 @@ music.playTone(freq, 1000)
|
||||
```
|
||||
|
||||
|
||||
### Using other pins
|
||||
## Using other pins
|
||||
|
||||
Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin used to generate music.
|
||||
|
||||
@ -36,7 +36,7 @@ Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[rest](/reference/music/rest), [ring tone](/reference/music/ring-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||
[change tempo by](/reference/music/change-tempo-by)
|
||||
|
@ -10,7 +10,7 @@ This function only works on the @boardname@ and in some browsers.
|
||||
music.rest(400)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``ms`` is a [number](/types/number) saying how many
|
||||
milliseconds the @boardname@ should rest. One second is 1000
|
||||
@ -24,7 +24,7 @@ music.playTone(frequency, 1000)
|
||||
music.rest(1000)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[play tone](/reference/music/play-tone), [ring tone](/reference/music/ring-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo), [change tempo by](/reference/music/change-tempo-by)
|
||||
|
||||
|
@ -11,14 +11,14 @@ This function only works on the @boardname@ and in some browsers.
|
||||
music.ringTone(440)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``frequency`` is a [number](/types/number) that says
|
||||
how high-pitched or low-pitched the tone is. This
|
||||
number is in **Hz** (**Hertz**), which is a measurement of frequency
|
||||
or pitch.
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program checks the **accelerometer** for the @boardname@'s
|
||||
**acceleration** (how much the @boardname@ is speeding up or slowing
|
||||
@ -32,7 +32,7 @@ basic.forever(() => {
|
||||
})
|
||||
```
|
||||
|
||||
### Using other pins
|
||||
## Using other pins
|
||||
|
||||
Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin used to generate music.
|
||||
|
||||
@ -40,7 +40,7 @@ Use [analogSetPitchPin](/reference/pins/analog-set-pitch-pin) to change that pin
|
||||
pins.analogSetPitchPin(AnalogPin.P1);
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[rest](/reference/music/rest), [play tone](/reference/music/play-tone),
|
||||
[tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||
|
@ -7,11 +7,11 @@ Replaces the implementation of the [music play tone](/reference/music/play-tone)
|
||||
music.setPlayTone((frequency: number, duration: number) => {})
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``f`` the replacement function
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This example send the frequency and duration over radio
|
||||
and plays it on the remote @boardname@.
|
||||
@ -32,7 +32,7 @@ input.onButtonPressed(Button.B, () => {
|
||||
})
|
||||
})
|
||||
```
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[rest](/reference/music/rest), [ring tone](/reference/music/ring-tone) , [tempo](/reference/music/tempo), [set tempo](/reference/music/set-tempo),
|
||||
[change tempo by](/reference/music/change-tempo-by)
|
||||
|
@ -9,11 +9,11 @@ music.setTempo(60)
|
||||
|
||||
This function only works on the @boardname@ and in some browsers.
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``bpm`` is a [number](/types/number) that means the beats per minute you want (the number of beats in a minute of the music that the @boardname@ is playing).
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[play tone](/reference/music/play-tone), [ring tone](/reference/music/ring-tone) , [rest](/reference/music/rest), [tempo](/reference/music/tempo), [change tempo by](/reference/music/change-tempo-by)
|
||||
|
||||
|
@ -6,12 +6,12 @@ Finds the tempo (speed of a piece of music).
|
||||
music.tempo()
|
||||
```
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* a [number](/types/number) that means the beats per minute (number of
|
||||
beats in a minute of the music that the @boardname@ is playing).
|
||||
|
||||
### See also
|
||||
## 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)
|
||||
|
||||
|
Reference in New Issue
Block a user