Skip to content

Commit

Permalink
Add reference pages for the built-in melody accessors (#5880)
Browse files Browse the repository at this point in the history
* add reference pages for built-in melody accessors

* update help paths
  • Loading branch information
ganicke authored and abchatra committed Sep 4, 2024
1 parent 37494a3 commit c7261e4
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
51 changes: 51 additions & 0 deletions docs/reference/music/built-in-melody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# built In Melody

Get a melody string for a built-in melody.

```sig
music.builtInMelody(Melodies.Dadadadum)
```

A collection of built-in melodies are available. You choose one by selecting the name of the melody.

## Parameters

* **melody**: A melody name. The available melodies are:

>* `dadadum`
>* `entertainer`
>* `prelude`
>* `ode`
>* `nyan`
>* `ringtone`
>* `funk`
>* `blues`
>* `birthday`
>* `wedding`
>* `funeral`
>* `punchline`
>* `baddy`
>* `chase`
>* `ba ding`
>* `wawawawaa`
>* `jump up`
>* `jump down`
>* `power up`
>* `power down`
## Returns

* a [string](/types/string) that contains the melody.

## Example

Play the built-in melody for **blues**.

```blocks
music.startMelody(music.builtInMelody(Melodies.Blues), MelodyOptions.Once)
```

## See also

[start melody](/reference/music/start-melody),
[built-in sound effect](/reference/music/builtin-sound-effect)
50 changes: 50 additions & 0 deletions docs/reference/music/built-in-playable-melody.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# built In Playable Melody

Get a playable sound object for a built-in melody.

```sig
music.builtInPlayableMelody(Melodies.Dadadadum)
```

A collection of built-in melodies are available as [playable](/types/playable) sound objects. You choose one by selecting the name of the melody.

## Parameters

* **melody**: A melody name. The available melodies are:

>* `dadadum`
>* `entertainer`
>* `prelude`
>* `ode`
>* `nyan`
>* `ringtone`
>* `funk`
>* `blues`
>* `birthday`
>* `wedding`
>* `funeral`
>* `punchline`
>* `baddy`
>* `chase`
>* `ba ding`
>* `wawawawaa`
>* `jump up`
>* `jump down`
>* `power up`
>* `power down`
## Returns

* a [playable](/types/playable) object that contains the melody.

## Example

Play the built-in melody for **blues**.

```blocks
music.play(music.builtInPlayableMelody(Melodies.Blues), music.PlaybackMode.InBackground)
```

## See also

[built-in sound effect](/reference/music/builtin-sound-effect)
4 changes: 2 additions & 2 deletions libs/core/music.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ namespace music {
* Gets the melody array of a built-in melody.
* @param name the note name, eg: Note.C
*/
//% weight=50 help=music/builtin-melody
//% weight=50 help=music/built-in-melody
//% blockId=device_builtin_melody block="%melody"
//% blockHidden=true
//% group="Melody Advanced"
Expand All @@ -336,7 +336,7 @@ namespace music {
* Gets the melody array of a built-in melody.
* @param melody the melody name
*/
//% weight=60 help=music/builtin-melody
//% weight=60 help=music/built-in-playable-melody
//% blockId=device_builtin_melody_playable block="melody $melody"
//% toolboxParent=music_playable_play_default_bkg
//% toolboxParentArgument=toPlay
Expand Down

0 comments on commit c7261e4

Please sign in to comment.