Petit Computer Wiki
Petit Computer Wiki
Advertisement

V1[]

BGMPLAY is a command for playing music or other sound effects. In SmileBasic V1, it can only be used in one way. It is followed by one number, which gets rounded down, the song associated with that number is played on the speakers. The relationship between the numbers 0 to 29 inclusive and songs is on the page List of Preset Music.

V2[]

In SmileBasic V2, the command may be used as described above. In addition, 'song numbers' between 128 and 255 inclusive can be used; these numbers refer to user-defined songs specified by BGMSET or BGMSETD commands. If a song was played with BGMPLAY using strings,

If BGMPLAY is followed by two numbers, the second is the song number as described above, and the first is the track number (0 to 7 inclusive).

If BGMPLAY is followed by three numbers, the first two are as for the two-number command, and the third number is the volume (0 to 127 inclusive).

If BGMPLAY is followed by between one and nine strings (inclusive), the strings are concatenated and interpreted as MML, and the resulting song is played at maximum volume on track 0. When BGMPLAY is used in this way, the song data is actually stored in an undocumented slot 256, which can then be replayed using BGMPLAY 256. This persists even after exiting to the main menu and running other programs, so long as those programs don't overwrite the song data with their own by the same method.

For example, BGMPLAY "EDCDEEE" will play the first part of "Mary Had A Little Lamb", and BGMPLAY 13 and BGMPLAY 0,13,127 will play "Ultra-hard Rock" at maximum volume on track 0.

See also BGMSTOP (Command).

V3[]

No information on SmileBasic V3.

Advertisement