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

Username:   Password: 
 RegisterRegister   
 How to specify the location of the mp3 file when using Music.PlayFile
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
TechLacky




PostPosted: Sun Jan 15, 2012 2:29 pm   Post subject: How to specify the location of the mp3 file when using Music.PlayFile

What is it you are trying to achieve?
Play a mp3 file song on Turing


What is the problem you are having?
So i typed in the brackets but it says "Illegal extended character in string literal"
0.0 illegal?!?!?!


Describe what you have tried to solve this problem
retyping the location of the file i want to play many times and many different ways... =_=
also tried using ""%oot" which i have no idea what that does...
I also tried changing the folder name to not begin with "K"
This makes it legal apparently =_= but the song still doesnt play...


Turing:

process DoMusic
    loop
        Music.PlayFile ("C:\KoolMusic\Ellie Goulding - Lights (Bassnectar Remix).mp3")
    end loop
end DoMusic

fork DoMusic


Please specify what version of Turing you are using
I think 4.1?

help would be greatly appreciated, Thanks!
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Sun Jan 15, 2012 3:01 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

Well, in turing '\' is the escape key. http://en.wikipedia.org/wiki/Backslash

Wikipedia wrote:

In many programming languages such as C and Perl and in Unix scripting languages, the backslash is used to indicate that the character following it should be treated specially (if it would otherwise be treated normally), or normally (if it would otherwise be treated specially). It is sometimes referred to as a knock-down or escape character.


A fix to this is to change the '\' to '//'.
TechLacky




PostPosted: Sun Jan 15, 2012 3:05 pm   Post subject: Re: How to specify the location of the mp3 file when using Music.PlayFile

Thanks XD that solved the illegal problem!
but the song still doesnt play...
is there a reason for this?
Aange10




PostPosted: Sun Jan 15, 2012 3:10 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

http://compsci.ca/v3/viewtopic.php?t=190&highlight=music


Here is a tutorial on how to do it. Your version of Turing may or may not support MP3 files.
TechLacky




PostPosted: Sun Jan 15, 2012 3:31 pm   Post subject: Re: How to specify the location of the mp3 file when using Music.PlayFile

ya, i read that tutorial before posting this.. but thanks
(my version of turing is 4.1 btw...)

He says that the file has to be in the turing dir or specify its location
how do you specify its location?
Aange10




PostPosted: Sun Jan 15, 2012 3:43 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

That should be how, but if it doesn't work, I suggest trying the other way.


If not, im not sure.
TechLacky




PostPosted: Sun Jan 15, 2012 3:46 pm   Post subject: Re: How to specify the location of the mp3 file when using Music.PlayFile

nvm, got it, thanks XD
i put the file in the "turing 4.1" folder then in the brackets, typed:

loop
"Music.PlayFile ("%oot/Lights - Ellie Goulding (Bassnectar Remix) [Lyrics] - YouTube.wav")
end loop

thankyou again XD
(i think the reformating to .wav was the solution? =D)
Raknarg




PostPosted: Sun Jan 15, 2012 4:02 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

Also, I think there is a file size limit to the music you are trying to play. I remember having a similar problem, and discovered that after a certain length, the song doesnt load.
Sponsor
Sponsor
Sponsor
sponsor
RandomLetters




PostPosted: Sun Jan 15, 2012 6:43 pm   Post subject: Re: RE:How to specify the location of the mp3 file when using Music.PlayFile

Aange10 @ Sun Jan 15, 2012 3:01 pm wrote:
Well, in turing '\' is the escape key. http://en.wikipedia.org/wiki/Backslash

Wikipedia wrote:

In many programming languages such as C and Perl and in Unix scripting languages, the backslash is used to indicate that the character following it should be treated specially (if it would otherwise be treated normally), or normally (if it would otherwise be treated specially). It is sometimes referred to as a knock-down or escape character.


A fix to this is to change the '\' to '//'.


did you mean "\\"?
Aange10




PostPosted: Sun Jan 15, 2012 7:40 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

No. I meant '//'. But \\ may or may not work. I remember having difficulties with the backslash in Turing, and ended up using forward slashes.


But '//' does work.
mirhagk




PostPosted: Sun Jan 15, 2012 9:39 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

but a single forward slash should work, I don't know why you'd use a double one (or even if that would work, although it probably does)
Aange10




PostPosted: Sun Jan 15, 2012 10:15 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

Simply because it always worked for me, so it stuck. Bad habit? Nah, just convenient.
mirhagk




PostPosted: Sun Jan 15, 2012 10:38 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

well also a bad habit lol
Aange10




PostPosted: Sun Jan 15, 2012 11:46 pm   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

I disagree, it's a coding convention. As long as it is readable, gets the meaning accross, and doesn't interfere with the program, there is nothing wrong. It is simply self given syntatic sugar.

Such as wikipedia said:

Wikipedia wrote:

Good style is a subjective matter, and is difficult to define.


It's not a bad habit, it doesn't affect my code. It isn't less readable and isn't fundamentally corrupt (at least in the language of choice).

That exact principle was also discussed on these forums here.


Edit: And as well said by Gandalf:

Quote:

They both have merits, so it really comes down to your choice of which to use. What's more imporant than this choice is that you keep a consistent style throughout your code.
mirhagk




PostPosted: Mon Jan 16, 2012 6:39 am   Post subject: RE:How to specify the location of the mp3 file when using Music.PlayFile

Well maybe a single forward slash vs a double backslash. But a double forward slash is unnecessary, and demonstrates a lack of understanding in the fundamental difference between the two.

Not only that this only works in turing because of a fluke. Try using double forward slashes in the windows explorer. You'll notice it doesn't work. Single forward slashes work fine (as do single backslashes).

Bad habits are things that are unnecessary, hide the meaning behind things, and don't work universally. (it should be noted double back slashes also don't work in windows explorer, but it's needed within programming languages unless they have unescaped literal evaluation)
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  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: