The MUSIC
command starts a piece of music from the music variable. This
music will be played independently of your program, without affecting it in the
slightest.
Normally, it's possible to store several complete arrangements.
Each composition is assigned its own individual music variable.
The music system is intelligent, and will automatically suspend your music for the
duration of any subsequent sound effects on the current channel. When the sound has
finished, your tune will be restarted from its previous position.
The command accepts an additional keyword, LOOP
, which allows you to indicate that
the piece of music must be played without ever ending playback: ugBASIC will make it
start again from the beginning, once playback has finished.
Finally, the command accepts the indication of the format
in which the music is stored
in the variable. This specification is necessary only if the audio file was not loaded
by the LOAD MUSIC
command. The LOAD MUSIC
command takes care of converting one
of the supported formats into the internal (IAF
) ugBASIC format. However,
ugBASIC can play formats compatible with your audio hardware. In this case, by specifying
the format in which the data is prepared, it is possible to follow up on this request.
Each target has a specific list of supported audio formats.
MUSIC [LOOP] music [format] MUSIC music [format] [LOOP]
MUSIC fugue MUSIC backmusic LOOP MUSIC soundtrack PSG
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
MUSIC ↔ Mus
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS