Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 music
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
iamcow




PostPosted: Wed Oct 25, 2006 4:40 pm   Post subject: music

Using an engine i saw somewhere else here i decided to program Bach's prelude #1 Its incomplete though...don't have that much time on my hands

code:



const tempo := 100 %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

for i : 1 .. 2
    Music.Sound (C div 2, s)
    Music.Sound (E div 2, s)
    Music.Sound (G, s)
    Music.Sound (C, s)

    Music.Sound (E, s)
    Music.Sound (G, s)
    Music.Sound (C, s)
    Music.Sound (E, s)
end for
for i : 1 .. 2
    Music.Sound (C div 2, s)
    Music.Sound (D div 2, s)
    Music.Sound (A, s)
    Music.Sound (D, s)

    Music.Sound (F, s)
    Music.Sound (A, s)
    Music.Sound (D, s)
    Music.Sound (F, s)
end for
for i : 1 .. 2
    Music.Sound (B div 2, s)
    Music.Sound (D div 2, s)
    Music.Sound (G, s)
    Music.Sound (D, s)

    Music.Sound (F, s)
    Music.Sound (G, s)
    Music.Sound (D, s)
    Music.Sound (F, s)
end for
for i : 1 .. 2
    Music.Sound (C div 2, s)
    Music.Sound (E div 2, s)
    Music.Sound (G, s)
    Music.Sound (C, s)

    Music.Sound (E, s)
    Music.Sound (G, s)
    Music.Sound (C, s)
    Music.Sound (E, s)
end for
for i : 1 .. 2
    Music.Sound (C div 2, s)
    Music.Sound (E div 2, s)
    Music.Sound (A, s)
    Music.Sound (E, s)

    Music.Sound (A * 2, s)
    Music.Sound (A, s)
    Music.Sound (E, s)
    Music.Sound (A * 2, s)
end for
for i : 1 .. 2
    Music.Sound (C div 2, s)
    Music.Sound (D div 2, s)
    Music.Sound (Fs div 2, s)
    Music.Sound (A, s)

    Music.Sound (D, s)
    Music.Sound (F div 2, s)
    Music.Sound (A, s)
    Music.Sound (D, s)
end for
for i : 1 .. 2
    Music.Sound (B div 2, s)
    Music.Sound (D div 2, s)
    Music.Sound (G, s)
    Music.Sound (D, s)

    Music.Sound (G * 2, s)
    Music.Sound (G, s)
    Music.Sound (D, s)
    Music.Sound (G * 2, s)
end for
for i : 1 .. 2
    Music.Sound (B div 2, s)
    Music.Sound (C div 2, s)
    Music.Sound (E div 2, s)
    Music.Sound (G, s)

    Music.Sound (C, s)
    Music.Sound (E div 2, s)
    Music.Sound (G, s)
    Music.Sound (C, s)
end for
for i : 1 .. 2
    Music.Sound (A div 2, s)
    Music.Sound (C div 2, s)
    Music.Sound (E div 2, s)
    Music.Sound (G, s)

    Music.Sound (C, s)
    Music.Sound (D div 2, s)
    Music.Sound (G, s)
    Music.Sound (C, s)
end for
for i : 1 .. 2
    Music.Sound (D div 2, s)
    Music.Sound (Fs div 2, s)
    Music.Sound (A, s)
    Music.Sound (D, s)

    Music.Sound (Fs, s)
    Music.Sound (A, s)
    Music.Sound (D, s)
    Music.Sound (Fs, s)
end for
for i : 1 .. 2
    Music.Sound (G div 2, s)
    Music.Sound (B div 2, s)
    Music.Sound (D div 2, s)
    Music.Sound (G, s)

    Music.Sound (B, s)
    Music.Sound (D div 2, s)
    Music.Sound (G, s)
    Music.Sound (B, s)
end for








Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Fri Oct 27, 2006 2:47 pm   Post subject: (No subject)

Sounds pretty good. Creative way of changing the octave. Smile

Though this should have been posted in the music sticky.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: