'--------------------------------------------------------------------
_TITLE "PLAY string$ visualizer" 'lovestory comes from an old lost .net post
'gorilla and gorilla2 come from programs/samples/misc/gor64.bas
'happynewyear, frosty and galleonschord come from the wiki
REM Uncomment the lines of
"PLAY string" below you want
to visualize:
gorilla: playString$ = "MBT160O1L8CDEDCDL4ECC"
'gorilla2: playString$ = "MF t120o1l16b9n0baan0bn0bn0baaan0b9n0baan0b o2l16e-9n0e-d-d-n0e-n0e-n0e-d-d-d-n0e-9n0e-d-d-n0e- o2l16g-9n0g-een0g-n0g-n0g-eeen0g-9n0g-een0g- o2l16b9n0baan0g-n0g-n0g-eeen0o1b9n0baan0b T160O0L32EFGEFDC T160O0L32EFGEFDC T160O0L32EFGEFDC T160O0L32EFGEFDC"
'galleonschord: playString$ = "v10l1c,l4egl2o5c,o4l4eg"
'frosty: playString$ = "t140o2p4g2e4.f8g4o3c2o2b8o3c8d4c4o2b4a8g2. o2b8o3c8d4c4o2b4a8a8g8o3c4o2e8e4g8a8g4f4e4f4g2. g2e4.f8g4o3c2o2b8o3c8d4c4o2b4a8g2. o2b8o3c8d4c4o2b4a8a8g8o3c4o2e8e4g8a8g4f4e4d4c2. c4a4a4o3c4c4o2b4a4g4e4f4a4g4f4e2. e8e8d4d4g4g4b4b4o3d4d8o2b8o3d4c4o2b4a4g4p4 g2g2e4.f8g4o3c2o2b8o3c8d4c4o2b4a8g8g2. o2b8o3c8d4c4o2b4a8a8g8o3c4o2e8e4g8a8g4f4e4d4c2.p4 t180g8g8g4g4g4a8g8g4g4g4a4g4e4g4d1 t180g8g8g4g4g4a8g8g4g4g4g8g8g4a4b4o3c2c4p1"
'lovestory: playString$ = "O2 L8 B- D D B- ML L2 B- L8 B- MN D D B- B- D E- D C C C A ML L2 A L8 A MN C C A A C D C < B- B- B- > G L2 G P8 L8 < B- B- > G G < B- > C < B- A A A > F# ML L2 F# L4 F# MN G A F# ML L2 D D MN P1 L8 B- D D B- ML L2 B- L8 B- MN D D B- B- D E- D C C C A ML L2 A L8 A MN C C A A C D C < B- B- B- > G L2 G P8 L8 < B- B- > G G < B- > C < B- A A A > F# ML L2 F# L4 F# MN G A F# ML L1 B L4 B MN > C D < G > L2 ML E- L8 E- MN < L8 G B- G G A ML L4 A L8 A MN > C E- C ML L2 D L8 D MN < F > D < F F G ML L4 G L8 G MN B- > D < B- > ML L2 C L8 C MN < A > C < A L4 B- L8 B- > D < G B- > D ML L2 E- L8 E- MN < G G B- L4 B- ML A L2 A MN L8 B- > C < E- ML L2 D L8 D MN D E F# L4 A ML L4 G L8 G MN G L8 F# E D ML L2 C# L8 C# MN L8 E G E ML L2 F# F# MN P1 L8 B- D D B- ML L2 B- L8 B- MN D D B- B- D E- D C C C A ML L2 A L8 A MN C C A A C D C < B- B- B- > G L2 G P8 L8 < B- B- > G G < B- > C < B- A A A > F# ML L2 F# L4 F# MN G A F# ML L2 G G MN P1"
'happynewyear: playString$ = " o3 l4 t 0120c ml<f1 ,a 1, >c 1, mnf .e 8f am l< e1 ,g 1, >c 1, mn g. f8 ga 8g 8m l< f2.,a2., >c 2. ,m nf .f 8a ml<f ,a,>c,mn >cd2.,<f2 .,d2 .,<b -2 .m lb -,>d,f,mn>d ml <c 1, <a 1, f1 ,m n> >c .< a8 af ml c1 ,< e1 ,g 1,m n> g.f8ga8g8m l< f1 ,d1, <b -1 ,m n> >f .d 8d c< f2 ., a2 ., c2 .,>f2. ml < b- ,> d, f, mn>dml <c 1,< a1 ,f 1, mn >> c. <a 8a fm lc 2.,< e2 .,g2 .,mn >g .f8 gml<b-,>d, f, mn >d ml <<f2.,a2., > c2.,m n> c.<a 8a ml <e, g, >c ,m n>cm l< <b -2 ., >d 2. ,f 2.,mn> d2.ml< <b -, >d ,f ,m n>dm l<<f1, a1,>c1,mn >c.<a 8a fmlc 1, <e1,g1,mn>g .f 8g a8 g8ml << b- 1, >d 1, f1 ,mn>f.d8dc l1 ml f, c, <a ,f"
'defaults:
octave = 4
tempo = 120
pauseBetween = 1
volume = 50
length = 4
noteHeight = 7
zoom = 20
maxZoom = 50
reDraw:
playString$ = FormatPlayString$(playString$)
i = 1
x = 1 + leftOffset
DrawGrid
CASE "c", "d", "e", "f", "g", "a", "b" noteLength = length
note = note + 1
note = note - 1
i = i + 1
noteLength = noteLength + (3 / 4)
noteLength = noteLength + (1 / 2)
noteLength = GetNumber(playString$, i)
i = i + 1
i = i + 1
noteLength = noteLength + (3 / 4)
noteLength = noteLength + (1 / 2)
theresMore = -1
i = i + 1
DrawNote
'IF NOT theresMore THEN
' playstring$ = LEFT$(playstring$, i + 1) + " " + MID$(playstring$, i + 2)
' i = i + 1
'END IF
theresMore = 0
'staccato
pauseBetween = 2
i = i + 1
'normal
pauseBetween = 1
i = i + 1
'legato
pauseBetween = 0
i = i + 1
'foreground play
i = i + 1
'background play
i = i + 1
octave = GetNumber(playString$, i)
octave = octave + 1
octave = octave - 1
tempo = GetNumber(playString$, i)
note = GetNumber(playString$, i)
DrawNote
pause = GetNumber(playString$, i)
noteLength = -pause
IF noteLength
= 0 THEN noteLength
= -length
'playstring$ = LEFT$(playstring$, i) + " " + MID$(playstring$, i + 1)
'i = i + 1
DrawNote
length = GetNumber(playString$, i)
volume = GetNumber(playString$, i)
i = i + 1
maxDrawnLength = x - leftOffset
prevZoom = zoom
IF zoom
> maxZoom
THEN zoom
= maxZoom
IF zoom
<> prevZoom
THEN prevZoom
= zoom:
GOTO reDraw
leftOffset = leftOffset - 50
leftOffset = leftOffset + 50
IF leftOffset
> 0 THEN leftOffset
= 0 IF zoom
< maxZoom
THEN zoom
= zoom
+ 1 IF zoom
> 1 THEN zoom
= zoom
- 1
position% = position% + 1
tempNum$
= tempNum$
+ MID$(text$
, position%
, 1) GetNumber#
= VAL(tempNum$
)
i = 83 - note
nl = (zoom * zoom) / (noteLength * m)
LINE (x
, i
* noteHeight
+ 1)-STEP(nl
, noteHeight
- 2), _RGB32(100, 172, 100), BF
LINE (x
, i
* noteHeight
+ 1)-STEP(nl
, noteHeight
- 2), _RGB32(11, 17, 11), B
x = x + nl + pauseBetween * zoom
o% = 33 + (octave - 2) * 12 - 9
FindNote = 0 + o%
FindNote = 2 + o%
FindNote = 4 + o%
FindNote = 5 + o%
FindNote = 7 + o%
FindNote = 9 + o%
FindNote = 11 + o%
s$ = __s$
'remove MF and MB, and convert N0 to P
s$ = ""
FormatPlayString$ = s$
'--------------------------------------------------------------------