
-----------------------------------
bored_hacker
Thu Jul 14, 2005 10:31 am

mario
-----------------------------------
i'm working on a mario game right now and i wanted to make it old arcade style (including the music). what i've posted is more than just the mario song, it's also a very useful template for writing music in turing. you may use this template in any projects you wish but please give me some kind of credit whether it's a comment in a file or if my screen name moves across the screen. anyway, here's the music.

const tempo := 120 %Tempo is at a quarter base
%Note-Duration (or rests)
%Normal-Notes
const w := round (2000 * (120 / tempo)) %Whole notes
const h := round (1000 * (120 / tempo)) %Half Notes
const q := round (500 * (120 / tempo))  %Quarter Notes
const e := round (250 * (120 / tempo))  %Eighth Notes
const s := round (125 * (120 / tempo))  %Sixteenth Notes
%Dotted-Notes
const w_dot := round (w * 1.5)
const h_dot := round (h * 1.5)
const q_dot := round (q * 1.5)
const e_dot := round (e * 1.5)
const s_dot := round (s * 1.5)
%Triplet-Notes
const w3 := round (w * 2 / 3)
const h3 := round (h * 2 / 3)
const q3 := round (q * 2 / 3)
const e3 := round (e * 2 / 3)
const s3 := round (s * 2 / 3)
%Notes
const G := 392
const Gs := 415
const Ab := 415
const A := 440
const As := 466
const Bb := 466
const B := 494
const C := 523
const Cs := 554
const Db := 554
const D := 587
const Ds := 622
const Eb := 622
const E := 659
const F := 698
const Fs := 740
const Gb := 740
%To raise it by an octave, times it by 2
%To lower it by an octave, divide it by 2
%Mario
Music.Sound (E, s)
Music.Sound (E, e)
Music.Sound (E, s)
delay (s)
Music.Sound (C, s)
Music.Sound (E, e)
Music.Sound (G * 2, q)
Music.Sound (G, q)
for z : 1 .. 2
    Music.Sound (C, q3)
    Music.Sound (G, q3)
    Music.Sound (E div 2, q3)
    delay (s)
    Music.Sound (A, e)
    Music.Sound (B, e)
    Music.Sound (As, s)
    Music.Sound (A, e)
    Music.Sound (G, e3)
    Music.Sound (E, e3)
    Music.Sound (G * 2, e3)
    Music.Sound (A * 2, e)
    Music.Sound (F, s)
    Music.Sound (G * 2, s)
    delay (s)
    Music.Sound (E, e)
    Music.Sound (C, e_dot)
    Music.Sound (D, s)
    Music.Sound (B, s)
end for
for z : 1 .. 2
    delay (e)
    Music.Sound (G * 2, s)
    Music.Sound (Fs, s)
    Music.Sound (F, s)
    Music.Sound (Ds, e)
    Music.Sound (E, s)
    delay (s)
    Music.Sound (Gs, s)
    Music.Sound (A, s)
    Music.Sound (C, e)
    Music.Sound (A, s)
    Music.Sound (C, s)
    Music.Sound (D, s)
    delay (e)
    Music.Sound (G * 2, s)
    Music.Sound (Fs, s)
    Music.Sound (F, s)
    Music.Sound (Ds, e)
    Music.Sound (E, s)
    delay (s)
    Music.Sound (C * 2, e)
    Music.Sound (C * 2, s)
    Music.Sound (C * 2, q)
    delay (e)
    Music.Sound (G * 2, s)
    Music.Sound (Fs, s)
    Music.Sound (F, s)
    Music.Sound (Ds, e)
    Music.Sound (E, s)
    delay (s)
    Music.Sound (Gs, s)
    Music.Sound (A, s)
    Music.Sound (C, e)
    Music.Sound (A, s)
    Music.Sound (C, s)
    Music.Sound (D, s)
    delay (e)
    Music.Sound (Ds, e_dot)
    Music.Sound (D, e_dot)
    Music.Sound (C, q)
    delay (q)
end for
Music.Sound (C, s)
Music.Sound (C, e)
Music.Sound (C, e)
Music.Sound (C, s)
Music.Sound (D, e)
Music.Sound (E, s)
Music.Sound (C, e)
Music.Sound (A, s)
Music.Sound (G, q)
Music.Sound (C, s)
Music.Sound (C, e)
Music.Sound (C, e)
Music.Sound (C, s)
Music.Sound (D, s)
Music.Sound (E, s)
delay (h)
Music.Sound (C, s)
Music.Sound (C, e)
Music.Sound (C, e)
Music.Sound (C, s)
Music.Sound (D, e)
Music.Sound (E, s)
Music.Sound (C, e)
Music.Sound (A, s)
Music.Sound (G, q)
Music.Sound (E, s)
Music.Sound (E, e)
Music.Sound (E, e)
Music.Sound (C, s)
Music.Sound (E, e)
Music.Sound (G * 2, q)
Music.Sound (G, q)
for z : 1 .. 2
    Music.Sound (C, q3)
    Music.Sound (G, q3)
    Music.Sound (E div 2, q3)
    delay (s)
    Music.Sound (A, e)
    Music.Sound (B, e)
    Music.Sound (As, s)
    Music.Sound (A, e)
    Music.Sound (G, e3)
    Music.Sound (E, e3)
    Music.Sound (G * 2, e3)
    Music.Sound (A * 2, e)
    Music.Sound (F, s)
    Music.Sound (G * 2, s)
    delay (s)
    Music.Sound (E, e)
    Music.Sound (C, e_dot)
    Music.Sound (D, s)
    Music.Sound (B, s)
end for
for z : 1 .. 2
    Music.Sound (E, s)
    Music.Sound (C, e)
    Music.Sound (G, e_dot)
    Music.Sound (Gs, e)
    Music.Sound (A, s)
    Music.Sound (F, e)
    Music.Sound (F, s)
    Music.Sound (A, q)
    Music.Sound (B, e3)
    Music.Sound (A * 2, e3)
    Music.Sound (A * 2, e3)
    Music.Sound (A * 2, e3)
    Music.Sound (G * 2, e3)
    Music.Sound (F, e3)
    Music.Sound (E, s)
    Music.Sound (C, e)
    Music.Sound (A, s)
    Music.Sound (G, q)
    Music.Sound (E, s)
    Music.Sound (C, e)
    Music.Sound (G, e_dot)
    Music.Sound (Gs, e)
    Music.Sound (A, s)
    Music.Sound (F, e)
    Music.Sound (F, s)
    Music.Sound (A, q)
    Music.Sound (B, s)
    Music.Sound (F, e)
    Music.Sound (F, s)
    Music.Sound (F, e3)
    Music.Sound (E, e3)
    Music.Sound (D, e3)
    Music.Sound (C, h * z)
end for[/code]

-----------------------------------
Delos
Thu Jul 14, 2005 11:07 am


-----------------------------------
Sounding pretty good...just wondering if you had any particular reason for using Sound() instead of play() for this job?
Since this music is transcribable on piano, you should be able to figure out any note used.  I can see the problem of having the notes short enough, since Turing doesn't really support notes much shorter than a semi-quaver (or was it quaver at best)?  Atop that, you can't even do something as mundane as a dotted-quaver!



var mario : array 1 .. 5 of string
mario (1) := ">8e4e e 8c 4e 2g "
mario (2) := "4cega 8e4g 8ed ega 8e4g 8ed 8gf+f4d+4e4cc4d 8gf+f4d+4e>4c8c4c"
mario (5) := "