User Tools

Site Tools


ugbasic:user:kw:music
Translations of this page:


ugBASIC User Manual

MUSIC

SYNTAX

   MUSIC [LOOP] music [format]
   MUSIC music [format] [LOOP]

PURPOSE

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.

EXAMPLE

  MUSIC fugue
  MUSIC backmusic LOOP
  MUSIC soundtrack PSG

ABBREVIATION

 Mus

AVAILABLE ON

  • Commodore 128 (Zilog Z80)
  • Commodore 128 (MOS 8502)
  • SEGA SG-1000
  • Commodore 64
  • Commodore VIC-20
  • Atari (400/800)
  • Commodore PLUS/4
  • Olivetti Prodest PC128
  • Amstrad CPC 664
  • SEGA SC-3000
  • ColecoVision
  • TRS-80 Color Computer 3
  • MSX
  • TRS-80 Color Computer

ANY PROBLEM?

If you have encountered a problem using this command, if you think there is a bug or the explanation is unclear, please open an issue for this keyword on GitHub. Thank you!

POWERED BY