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

Username:   Password: 
 RegisterRegister   
 Music help
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Crunked89




PostPosted: Wed Mar 10, 2004 8:16 pm   Post subject: Music help

im just looking for a way to play music in a program.. thats all.. i tryed posting other places but noone wanted to help and just said beat it.. Embarassed Sad


hope you can help Rolling Eyes
Sponsor
Sponsor
Sponsor
sponsor
jonos




PostPosted: Wed Mar 10, 2004 8:31 pm   Post subject: (No subject)

well, it depends on what music. you could use
play or Music.Play which would allow you to make individual notes and compose a song.

like:

Music.Play("abcd")

check out the turing reference in help>>reference>> contents or soemthing to learn more about it.

for playing a file in turing:

Music.PlayFile("pathoffile.wav/.mp3/.midi")

if you ened help with that, also hceck the turing reference.

now you will want to fork that i think so that it will play along with your whole program, so you will need to make it a process, so:

process myMusic
Music.PlayFile("myMusicFile.midi/.wav/.mp3")
end myMusic

fork myMusic
your other program stuff
guruguru




PostPosted: Wed Mar 10, 2004 8:39 pm   Post subject: (No subject)

Quite redundant program but it shows what can be done...
You can sub in songs from files (like Jonos) for the play("Whatever").

code:


process music
    loop
        play ("a")
        delay(10)
        play ("b")
        delay(10)
        play ("c")
        delay(10)
        play ("d")
        delay(10)
        play ("e")
        delay(10)
        play ("f")
        delay(10)
        play ("g")
    end loop
end music

fork music
loop
    put "Music is playing!!!"
    delay(100)   
    put "This is amazing!!!"
    delay(100)       
end loop

Crunked89




PostPosted: Wed Mar 10, 2004 8:46 pm   Post subject: (No subject)

im trying to play a file.. but i get a "illegal extended character string literal" message
Cervantes




PostPosted: Wed Mar 10, 2004 8:50 pm   Post subject: (No subject)

I think that's because you've got your brackets backwards.

use / not \
Crunked89




PostPosted: Wed Mar 10, 2004 9:06 pm   Post subject: (No subject)

oops.. well theres no errors just no sound
Cervantes




PostPosted: Wed Mar 10, 2004 9:17 pm   Post subject: (No subject)

that could be because you typed the path wrong. Check it and make sure everything is correct. If something is wrong, it won't give you an error. It will just skip over it.
recneps




PostPosted: Wed Mar 10, 2004 9:21 pm   Post subject: (No subject)

Also check that you are using double slashes (\\) if its not in the same directory as the .t file, you need double because 1 indicates a parameter or something... Smile
Sponsor
Sponsor
Sponsor
sponsor
jonos




PostPosted: Wed Mar 10, 2004 9:24 pm   Post subject: (No subject)

\ slash usually allows for special commands like:
\n means new line
\a means alert (in c++)
\" means double quote (i think, not sure)

so if you use just \ then it has nothing after it so you can't really do anything,
but if you use \\ then it has something after it. something like that, i think iread that somewhere.
Crunked89




PostPosted: Wed Mar 10, 2004 9:26 pm   Post subject: (No subject)

y wont it work.. everythings correct..

code:
process myMusic
 Music.PlayFile("C:/My Music/Yeah.mp3")
 end myMusic
jonos




PostPosted: Wed Mar 10, 2004 9:27 pm   Post subject: (No subject)

you need to add:

code:

fork myMusic


to your code, because as it is a process, for it to be executed, it needs to be called.
Cervantes




PostPosted: Wed Mar 10, 2004 9:29 pm   Post subject: (No subject)

I was using this to test various things while this thread was up:
code:

Music.PlayFile ("C:/My Documents/My Music/John Lennon/John Lennon - Imagine.mp3")


single / . Works fine for me.
jonos: /n is not a new line. It's \n Smile
Crunked89




PostPosted: Wed Mar 10, 2004 9:31 pm   Post subject: (No subject)

is there a way to just post the full code because im kind of lost.
Cervantes




PostPosted: Wed Mar 10, 2004 9:35 pm   Post subject: (No subject)

jonos first post is all you need to look at. you don't need to pay attention to what spencer (aka recneps) said, or any posts until this one.
Crunked89




PostPosted: Wed Mar 10, 2004 9:36 pm   Post subject: (No subject)

where do i put the fork thingy.. Wink lol Rolling Eyes
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: