Difference between revisions of "PLAY"

From QB64 Wiki
Jump to navigation Jump to search
imported>Clippy
m
imported>Clippy
m
Line 5: Line 5:
  
  
*'''[[Keywords currently not supported by QB64|Currently NOT supported in QB64!]]'''
+
 
 
:::'''The commandstring can consist of the following commands:'''
 
:::'''The commandstring can consist of the following commands:'''
 
*'''O'''n - Sets the current octave (n can be between 0 to 6), example "O3"
 
*'''O'''n - Sets the current octave (n can be between 0 to 6), example "O3"
 
*'''N'''n - Plays the note n (n can be between 0 to 84, where 0 is a rest), example "N42"
 
*'''N'''n - Plays the note n (n can be between 0 to 84, where 0 is a rest), example "N42"
*'''<''' - Down one octave (cannot get below 0).
+
*'''<''' - Down one octave (cannot get below zero).
 
*'''>''' - Up one octave (cannot get above 6).
 
*'''>''' - Up one octave (cannot get above 6).
 
*'''A''', '''B''', '''C''', '''D''', '''E''', '''F''' or '''G''' - Play A-G in the current octave, you can use '''+''' or '''#''' for sharp and '''-''' for flat, example "C#"
 
*'''A''', '''B''', '''C''', '''D''', '''E''', '''F''' or '''G''' - Play A-G in the current octave, you can use '''+''' or '''#''' for sharp and '''-''' for flat, example "C#"
Line 47: Line 47:
  
  
''See also:''' [[PLAY(n)]], [[ON PLAY (n)]], [[SOUND]], [[DRAW]]
+
''See also:'''  
 +
 
 +
* [[PLAY(n)]], [[ON PLAY (n)]]  
 +
* [[SOUND]], [[DRAW]]
  
  
 
{{PageNavigation}}
 
{{PageNavigation}}

Revision as of 21:56, 4 November 2010

PLAY is a statement that plays music using a command STRING.


Syntax: PLAY commandstring


The commandstring can consist of the following commands:
  • On - Sets the current octave (n can be between 0 to 6), example "O3"
  • Nn - Plays the note n (n can be between 0 to 84, where 0 is a rest), example "N42"
  • < - Down one octave (cannot get below zero).
  • > - Up one octave (cannot get above 6).
  • A, B, C, D, E, F or G - Play A-G in the current octave, you can use + or # for sharp and - for flat, example "C#"
  • Ln - Sets length of a note (n can be 1 to 64 where 1 is a whole note and 4 is a quarter of a note etc.), example "L4"
  • Tn - Sets quarter of notes per minute (n can be 32 to 255 where 120 is the default), example "T180"
  • MS - Each note plays 3/4 of length (staccato)
  • MN - Each note plays full length (normal)
  • ML - Each note plays 7/8 of length (legato)
  • Pn - Pause in the duration of n quarternotes (n can be 1 to 64), example "P32"
  • MF - Play music in the foreground (each note must be completed before the other can start).
  • MB - Play music in the background (the background buffer can only hold 32 notes in QuickBASIC, QB64 have no limits)
  • X + VARPTR$(string-expression) - execute another command string.



Example: PLAY "c3 l16 a+ b- cdl8efl4gl16 p32 deggdel4gp1614c-p16l8cecdel4dl10c"


Explanation: (explained parts are shown in bold and separated from the rest)


"c3" means the same as "l3 c", setting the length to one third of a whole note.

a+ means A sharp (or a# which you can also use).

b- means B flat.

p32 means to pause 32 quarternotes.

You can use spaces in the string for clarity without affecting anything.


See also:'



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page