Music in Pencilcode.net




Picture
Pencilcode.net has some very neat tricks. Did you know it can play music. This was information was originally sent to me as an example by David Bau the pencilcode creator. https://twitter.com/pencilcoder

Using the play command you can make music. 



A quaver (or half note) is play "c/2'
A crotchet (1 beat) is play "c"
A minum (2 beat) is play "c2"
A semibreve (4 beats) is play "c4"
A dotted crotchet (1 1/2 beats) is play "c11/2"
A rest is z

Use ^ (for sharp) for c# use play "^c"
Use _ (for flat) for Bb use play "_b"
Use ' for an octave higher play "c'c"
Use , for an octave lower play "c,c"
You can do chords by surrounding more than one note in [brackets] play "[G^DG,]"

Type this into a new file in Pencilcode.net:
play “
 F ^G c f
 [gE] c ^G
 g [^g^D] c
 ^G ^g [dD]
 ^A F d
 [^Cc] ^G F
 ^G21/3 c ^G F
 [G^DG,] [F,F^G] [^GFF,]2”
write 'stairway to heaven