
-----------------------------------
TechLacky
Sun Jan 15, 2012 2:29 pm

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...



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!

-----------------------------------
Aange10
Sun Jan 15, 2012 3:01 pm

RE:How to specify the location of the mp3 file when using Music.PlayFile
-----------------------------------
Well, in turing '\' is the escape key. 
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
Sun Jan 15, 2012 3:05 pm

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
Sun Jan 15, 2012 3:10 pm

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
Sun Jan 15, 2012 3:31 pm

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
Sun Jan 15, 2012 3:43 pm

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
Sun Jan 15, 2012 3:46 pm

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
Sun Jan 15, 2012 4:02 pm

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.

-----------------------------------
RandomLetters
Sun Jan 15, 2012 6:43 pm

Re: RE:How to specify the location of the mp3 file when using Music.PlayFile
-----------------------------------
Well, in turing '\' is the escape key. 
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
Sun Jan 15, 2012 7:40 pm

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
Sun Jan 15, 2012 9:39 pm

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
Sun Jan 15, 2012 10:15 pm

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
Sun Jan 15, 2012 10:38 pm

RE:How to specify the location of the mp3 file when using Music.PlayFile
-----------------------------------
well also a bad habit lol

-----------------------------------
Aange10
Sun Jan 15, 2012 11:46 pm

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 
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 
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
Mon Jan 16, 2012 6:39 am

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)

-----------------------------------
Aange10
Mon Jan 16, 2012 11:43 am

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. 


Well said, single forward slashes it is.

-----------------------------------
tg851
Mon Jan 16, 2012 11:51 am

Re: How to specify the location of the mp3 file when using Music.PlayFile
-----------------------------------
meh,if its in sthe same file as the source code,you dont have to follow the full path
an example from a game im working on
  Music.PlayFileLoop ("danceofthequizmaster.mp3")
as long as the music file is in queston is in the same file with the source.t file its fine

-----------------------------------
mirhagk
Mon Jan 16, 2012 12:30 pm

RE:How to specify the location of the mp3 file when using Music.PlayFile
-----------------------------------
@tg851, and it's actually better to use relative file paths like that then full path names, since relative file paths let you move the program from computer to computer, and as long as the song is relatively in the same spot, then it's okay.
