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

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




PostPosted: Wed Apr 06, 2005 5:21 am   Post subject: Multiple notes!

I was browsing some posts at night during a project... and i noticed a post about being able to play more then one note at a time... i thought ot simply forking a pocess with two different notes. But this creates a problm ... well anyway,this is my first post here

be nice Razz an enjoy.. cause i dunno if anyone has done this yet, and i knwo it doesn't work perfect, maybe someone could aid in improvement. tyvm

it's fairly well commented also



MULTI NOTE MUSIC!.T
 Description:
Plays the beginning of starwars, with a major 5th harmony on the top

Download
 Filename:  MULTI NOTE MUSIC!.T
 Filesize:  2.94 KB
 Downloaded:  578 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
GlobeTrotter




PostPosted: Wed Apr 06, 2005 5:35 pm   Post subject: (No subject)

The thing is, that doesn't really play the notes together at all. It simply plays the notes quickly at the beginning, then holds the last one to be forked for the longest.

Listen to this cadence using your method. You can hear that these chords are not full, nor are notes being played simultaneously.

code:

process c1 (music1 : string)
    Music.Play (music1)
end c1

process c2 (music2 : string)
    Music.Play (music2)
end c2

process c3 (music3 : string)
    Music.Play (music3)
end c3

process c4 (music4 : string)
    Music.Play (music4)
end c4

process c5 (music5 : string)
    Music.Play (music5)
end c5

fork c1 ("1c")
fork c1 ("1e")
fork c3 ("1f")
fork c4 ("1b")
fork c5 ("1>c")

delay(1080)

fork c1 ("<1f")
fork c1 ("1a")
fork c3 ("1>c")
fork c4 ("1e")
fork c5 ("1f")

delay(1080)

fork c1 ("<1g")
fork c1 ("1b")
fork c3 ("1>d")
fork c4 ("1f")
fork c5 ("1g")

delay(1080)

fork c1 ("<1c")
fork c1 ("1e")
fork c3 ("1f")
fork c4 ("1b")
fork c5 ("1>c")
jamonathin




PostPosted: Wed Apr 06, 2005 7:58 pm   Post subject: (No subject)

No offense, but they both sound bad. Just play the star wars theme by itself, and try setting one process to play notes on the beat of the star wars theme. I doubt it will work, but juss stick to the basic piano playin, or juss fork an mp3. Confused
c0bra54




PostPosted: Wed Apr 06, 2005 10:03 pm   Post subject: (No subject)

yeh i understand that the notes aren't actually being played concrrently, however for my FP i was considering doing a music creator in turing, that would be able to have a user choose notes on the staff, durations, and also key signatures.

I was also thinking, that i wouldn't be able to do it using the piano, or sound (x,y) how ever i was wondering, what about forking MIDI's

like have midi files setup for ll the notes, like have one Aflat that runs for 3 beats, and one for C# for 4 beats.... or something to that effect....

are my dreams completely unresonable???

and btw, thx alot for the input.. also that old turing program... well if you had a delay of (1) diretly between forks... it runs in perfect order.. like it runs the way it's supposed to run, where they never repeat one or the other... i dunno how this couldbe used, but it sort of has to do with this Razz...

tyvm for your time,

Kevin
GlobeTrotter




PostPosted: Wed Apr 06, 2005 10:28 pm   Post subject: (No subject)

If you want to do a more complex music program, I reccomend writing your own music functions similar to what I did here. You may find this useful. This way, you can define scales and simply play them by going through the array in a certain pattern.

code:
var notes : array 1 .. 89 of int
var name : array 1 .. 89 of string
var temp : real := 27.5
var temp1 : int
var count := 0
var mx, my, mb, pastmx : int
var mxspeed : int
loop
    count += 1
    temp *= 2 ** (1 / 12)
    notes (count) := round (temp)
    exit when count >= 89
    if count mod 12 = 1 then
        name (count) := "A"
    elsif count mod 12 = 2 then
        name (count) := "A#"
    elsif count mod 12 = 3 then
        name (count) := "B"
    elsif count mod 12 = 4 then
        name (count) := "C"
    elsif count mod 12 = 5 then
        name (count) := "C#"
    elsif count mod 12 = 6 then
        name (count) := "D"
    elsif count mod 12 = 7 then
        name (count) := "D#"
    elsif count mod 12 = 8 then
        name (count) := "E"
    elsif count mod 12 = 9 then
        name (count) := "F"
    elsif count mod 12 = 10 then
        name (count) := "F#"
    elsif count mod 12 = 11 then
        name (count) := "G"
    elsif count mod 12 = 12 then
        name (count) := "G#"
    elsif count mod 12 = 0 then
        name (count) := "G#"
    end if
end loop

for i : 1 .. 88
    if name (i) = "A#" or name (i) = "C#" or name (i) = "D#" or name (i) = "F#" or name (i) = "G#" then
        drawfillbox (i * (maxx div 88), maxy div 2, i * (maxx div 88) + (maxx div 88), maxy - 150, 21)
    else
        drawfillbox (i * (maxx div 88), 150, i * (maxx div 88) + (maxx div 88), maxy - 150, 30)
    end if
    drawbox (i * (maxx div 88), 150, i * (maxx div 88) + (maxx div 88), maxy - 150, 7)
end for
mousewhere (pastmx, my, mb)
loop
    mousewhere (mx, my, mb)
    mxspeed := abs (mx - pastmx)
    if mx > (maxx div 88) and mx < maxx - 2 * (maxx div 88) then
        if mb = 1 then
            if mx div (maxx div 88) mod 12 = 2 or mx div (maxx div 88) mod 12 = 5 or mx div (maxx div 88) mod 12 = 7 or mx div (maxx div 88) mod 12 = 10 or mx
                    div (maxx div 88) mod 12 = 0 then
                if my > maxy div 2 then
                    Music.Sound (notes (mx div (maxx div 88)), round (200 / (mxspeed+1)))
                end if
            else
                if mx div (maxx div 88) mod 12 = 2 or mx div (maxx div 88) mod 12 = 5 or mx div (maxx div 88) mod 12 = 7 or mx div (maxx div 88) mod 12 = 10 or mx
                        div (maxx div 88) mod 12 = 0 then
                    if mx < (mx div (maxx div 88)) * 88 then
                        Music.Sound (notes ((mx div (maxx div 88) - 1)), round (200 / (mxspeed+1)))
                        locate (1, 1)
                        put name (mx div ((maxx div 88) - 1))
                    else
                        Music.Sound (notes ((mx div (maxx div 88) + 1)), round (200 / (mxspeed+1)))
                        locate (1, 1)
                        put name (mx div ((maxx div 88) + 1))
                    end if
                else
                    Music.Sound (notes (mx div (maxx div 88)), round (200 / (mxspeed+1)))
                end if
            end if
        else
        end if
    end if
    mousewhere (pastmx, my, mb)
    delay (10)
end loop
c0bra54




PostPosted: Thu Apr 07, 2005 12:13 am   Post subject: (No subject)

wow nice. the only thing is.. i hate that sound Razz

but yeh this si gerneally how i want to do it, but instead of having a piano, have amusic staff, and you click where the note goes and it inserts i, it can print sheet music.. but yeh, thx a tonne for the ideas here. If i use ny of em directly i'll make sure your name is in there.

well tyvm everyone, i've got some new ieas on hwo to do this now.. and your eventually see an update here again (altho i am not sure when since first i need to finish FF1 Very Happy... that comes later Very Happy )

thx again to everyone
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  [ 6 Posts ]
Jump to:   


Style:  
Search: