pxt-calliope/docs/reference/music/begin-melody.md
Mark f5eebf2931 Update begin-melody.md (#574)
Based on customer feedback, it may be useful to have an example of the array, this may then lead them to coding their own arrays.
2017-11-29 20:08:29 -08:00

916 B

Begin Melody

Begin playing a musical melody through pin P0 of the @boardname@.

Simulator

This function only works on the @boardname@ and in some browsers.

music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)

or in the format NOTE[octave][:duration] eg: ['g5:1']

music.beginMelody(['g4:1', 'c5', 'e', 'g:2', 'e:1', 'g:3'], MelodyOptions.Once)

Parameters

  • melody is the array representation of a melody you wish to play

Example

This example plays the Entertainer built-in melody.

music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once)

See also

play tone, rest, ring tone , tempo, set tempo, change tempo by