Skip to content

Commit

Permalink
adapt mixer docs for missing pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ganicke committed Aug 5, 2024
1 parent 8e3dcb2 commit 3087082
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
40 changes: 40 additions & 0 deletions docs/reference/music/string-playable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# string Playable

Created a short melody of notes composed in a string.

```sig
music.stringPlayable("D F E A E A C B ", 120)
```

The **melody** is short series of notes composed in a string. The melody is played at a rate set by the **tempo** value you give. The melody string contains a sequence of notes formatted like this:

``"E B C5 A B G A F "``

The melody is shown in the ``||music:melody||`` block as note symbols which also appear in the Melody Editor.

```block
music.stringPlayable("E F G F E G B C5 ", 120)
```

The melodies are most often created in the Melody Editor from the block so that valid notes are chosen and the correct melody length is set.

## Parameters

* **melody**: a [string](/types/string) which contains the notes of the melody.
* **tempo**: a [number](/types/number) which is the rate to play the melody at in beats per minute.

## Returns

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

## Example

Play the ``Mystery`` melody continuously.

```blocks
music.play(music.stringPlayable("E F G F E G B C5 ", 120), music.PlaybackMode.LoopingInBackground)
```

## See also

[tone playable](/reference/music/tone-playable)
29 changes: 29 additions & 0 deletions docs/reference/music/tone-playable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# tone Playable

Create a musical tone that will play for some amount of time.

```sig
music.tonePlayable(262, music.beat(BeatFraction.Whole))
```

## Parameters

* **note**: is the note frequency as a [number](/types/number) of [Hertz](https://wikipedia.org/wiki/Hertz) (how high or low the tone is, also known as _pitch_). If **note** is less or equal to zero, no sound is played.
* **duration**: is the [number](/types/number) of milliseconds (one-thousandth of a second) that the tone lasts for. If **duration** is negative or zero, the sound will play continuously.

## Returns

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

## Example

Store the musical note 'C' in the variable `note` and play that note for 1000 milliseconds (one second).

```blocks
let note = music.noteFrequency(Note.C);
music.play(music.tonePlayable(note, music.beat(BeatFraction.Whole)), music.PlaybackMode.UntilDone)
```

## See also

[string playable](/reference/music/string-playable)

0 comments on commit 3087082

Please sign in to comment.