GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Download
  • News
  • Community
  • Resources
  • Language Reference
  • SmallBASIC Manual

This view

  • Original page
  • New address

GeezerVison is showing smallbasic.github.io — SmallBASIC | PLAY

Edit History

PLAY

PLAY string

Home > Reference > Console

Play musical notes, a mp3 or ogg sound file. The music string is composed of the following building blocks:

String Description
A-G[- +
On Octave n = 0..6, n = < moves down one octave, n = > moves up one octave
Nn Play note n = 0..84 (0 = pause)
Pn Pause n = 1..64
Ln Length of note n = 1..64 (1/nnn)
Tn Tempo n = 32..255. Number of 1/4 notes per minute.
MS Staccato (1/2)
MN Normal (3/4)
ML Legato
Vn Volume n = 0..100
MF Play on foreground
MB Play on background
Q Clear sound queue

To play a sound file use file://filename as string. When playing on background, program execution continuous. If the end of the program is reach, the playback will stop.

Example 1: Play a note

play "L2A"    ' note A with length 1/2

Example 2: Play multiple notes

' Set volume to 50%
play "V10"  
' Play Menuet by J. Sebastian Bach
play "T180L8O3MN O4D4O3MLGABO4C O4D4O3MNG4MLG4 O4MNE4MLCDEF# O4G4O3MNG4MLG4 O4MNC4MLDCO3BA O3MNB4MLO4CO3BAG O3MNA4MLBAGF# G2.MN"

Example 3: Play notes on background

play "MBL2A"    ' note A with length 1/2 on background
pause           ' make sure, that program will not end

Example 4: Play a sound file

' Copy a mp3 file to the working directory and name it test.mp3

play "file://test.mp3"
pause                    ' make sure, that program will not end
Code samples using PLAY
005 challenge.bas   2048.bas   3d rotating cube with message.bas   3d wire cube v1.bas   3d wire cube.bas   3dtictac.bas   3dttt.bas   3dttt.bas   4tune.bas   7gables.bas   agendus.bas   analog clock.bas   anball 1.0.bas   bairstow.bas   Balleta 2-11-15.bas   betrayal: crows ii.bas   biorythms.bas   blackbox.bas   Blackbox.bas   blackjack.bas   BlackJack.bas   bolmo.bas   bonkers.bas   bowling7.bas   bplus paddleball.bas   btn 21.bas   checkers.bas   chess.bas   clock.bas  
Console
AT   BEEP   CAT   CLS   DEFINEKEY   FORM   INKEY   INPUT   LINEINPUT   LINPUT   LOCATE   LOGPRINT   NOSOUND   PEN   PLAY   PRINT   SOUND   TAB  
This page was last edited on Fri, 15 Sep 2023 13:26:39 +0200 | Markdown processed with pandoc 3.1.12.1
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.