how do you get music to play?

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

how do you get music to play?

Postby sugawara » Thu Oct 09, 2008 6:53 am

Ok, i have been lurking in a different thread on the AM forum, but i finally finished my tour program with the help of mercedes and libberdoggy and everyone else in that thread.

Now however im having a different problem: how do you get music to play? is it as simple as just putting an mp3 in one of the audio channels? because ive tried on one frame for example, and then tested the frame, with no luck. i tried ever channel with no luck. also, if i can get the music to work, can i make it play through every frame? and how so?

im sure this has been asked, and last week i was searching but didnt find anything relevant.

thanks to anyone who helps on this!
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby mercedes » Thu Oct 09, 2008 7:33 am

HI there..Suga..

Yes it's as simple as putting it in a channel under Audio Tab..Make sure the MP3 song is in the folder..[Areas and External]

Also u can do this as well..Put this script..no need to modify it..just copy and paste it in the Global Procedures

Code: Select all
Sub PlaySound(FileName, Repeat)
  Action.LoadControl MediaPlayerObject(2)
  MediaPlayerObject(2).FileName = FileName
  If Repeat = True Then
    MediaPlayerObject(2).PlayCount = 0
  Else
    MediaPlayerObject(2).PlayCount = 1
  End If
  MediaPlayerObject(2).Play
End Sub

Sub StopSound()
  MediaPlayerObject(2).Stop
  MediaPlayerObject(2).FileName = ""
  Action.UnloadControl MediaPlayerObject(2)
End Sub


Then u want to play a song ..you simply put in the Advanced

Code: Select all
PlaySound GetPath(2) + "filename.mp3", False


When u want it to stop..simply put

Code: Select all
StopSound
in the Advanced

This script can go into the Hotspots...and I beleive the Frame Properties as well..~ [Advanced TAB]


Make sure the File is copied to the External Folder


If you want play a song through every frame..u can put it in the First Channel in the Frame Properties..under Audio TAB

Then when u want to play another one..and still have the music playing in the background..u choose Second Channel down..in the Hotspot Audio TAB...Depending on what sound u want...I.E--click sounds..door opening..stuff like that..~
Put it in the Frame Properties if its another song u would like to play...Second channel down..if u want both playing..if not..First channel.


Peace..~

P.S..

You can hit the "Help" link from within your project..offline or online..and the document shows up...with alot of help on it as well..This is where i grabbed this code..:D
Last edited by mercedes on Tue Oct 21, 2008 6:10 am, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby sugawara » Tue Oct 14, 2008 11:06 pm

thankyou again mercedes! ill ive this a try this afternoon after i finish teaching classes.

i was also debating loading up the program, the "nihon university tour" buts 20megs and dont really know if the site can take it. lol
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby sugawara » Mon Oct 20, 2008 9:43 am

damnit, i tried it again today, the way you said, i put it in the folders but i didnt put any code in, and then i put it into the first channel on frame properties and still no luck, it doesnt play my mp3 when test the frame, so im at a loss. do i need the VB script in order to get music to play?
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby mercedes » Mon Oct 20, 2008 10:21 am

Hi Suga...:)

No..u don't need script..well its one way or the other..Either you can put it in the Global Procedures along with Advanced tab of either hotspot or Frame properties..OR u can use the Channels provided..

Have you tried more than one song...?--try another if not..

Have you tried to play the song outside of AM..[in your media Player]?

Let me know..:) Perhaps it's the loop thats currupted..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby sugawara » Tue Oct 21, 2008 11:24 am

hello again, ive tried everything but the script now, it doesnt want to work, ive tried several mp3s and no music plays, i dont get it honestly they all play fine on my comp and in the AM when i import it, it plays in the test box, but the page doesnt work.
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby sugawara » Tue Oct 21, 2008 11:30 am

Code: Select all
sub ClearDialogue()
Action.LoadAPicture Hotspot(Action.GetMergedHotspotIndex), ""
Text(Action.GetMergedTextIndex).caption=""
End Sub
Sub PlaySound(FileName, Repeat)
  Action.LoadControl MediaPlayerObject(2)
  MediaPlayerObject(2).FileName = FileName
  If Repeat = True Then
    MediaPlayerObject(2).PlayCount = 0
  Else
    MediaPlayerObject(2).PlayCount = 1
  End If
  MediaPlayerObject(2).Play
End Sub

Sub StopSound()
  MediaPlayerObject(2).Stop
  MediaPlayerObject(2).FileName = ""
  Action.UnloadControl MediaPlayerObject(2)
End Sub


ok so this is what i did, and then i added the other line to the frames advanced with the name of the mp3 in like it says, but no luck, it gives me a big error message and no music damnit


do i need a specific mp3? am i doing this wrong because im just using any old mp3 and need something made in music maker?
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby Lyberodoggy » Tue Oct 21, 2008 11:56 am

Please post the error message... :?
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby sugawara » Tue Oct 21, 2008 1:10 pm

object doesnt support this property or method:
mediaplayerobject(..).filename
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby mercedes » Tue Oct 21, 2008 1:39 pm

That whole code..the big one..goes into the Global Procedures..not the frame...what goes into the frame's advanced is simply;

Playsound GetPath(2) + " file name.mp3" , False

From what u are saying..sounds like u may have put that in the frames advanced.?..

i dont get it honestly they all play fine on my comp and in the AM when i import it, it plays in the test box, but the page doesnt work.


The sound plays when u "Test" while in Manage Resources..? but it doesn't work..when u actually TEST the whole frame.. Is that right..?

Ok im going to assume this is what u are saying and that you are wanting a song to play..when the frame loads..and not when someone clicks a hotspot..--

Do you hear other sounds in AM.....in a hotspot..either by using the channel or the Advanced TAB..

Even a "click" sound you import..anything else.."beep" sounds..? Try one or two of those..please post back..:)
Last edited by mercedes on Tue Oct 21, 2008 2:18 pm, edited 1 time in total.
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Tue Oct 21, 2008 2:16 pm

Add the extention to the end of the filename.

Ex: Playsound "example.mp3", False
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby sugawara » Tue Oct 21, 2008 10:57 pm

hmm i had added the extension to the ending of it, it said filename.mp3 but no luck it didnt play, i double checked everything. is there any way i can actually send someone the 20 meg project and have it looked at?
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby sugawara » Tue Oct 21, 2008 10:58 pm

yeah mercedes i was trying to add it to the frame not a hotspot. i havent actually tried a sound that isnt a song per se, so this afternoon ill give that a shot if the family allows.
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby Mystery » Wed Oct 22, 2008 2:04 am

If you're still having difficulties, you can send me your project folder, and I'll take a look tomorrow evening when I come home from work :)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby mercedes » Wed Oct 22, 2008 2:25 am

Suga...your supposed to add the actual name of the song..not filename.mp3..Everything i've read here so far suggests that you may be putting in "filename.mp3"...Put the actual name of the song and the right extention..:)


Put this in Global Procedures--[Link on the side of project]--copy and paste

Code: Select all
Sub PlaySound(FileName, Repeat)
  Action.LoadControl MediaPlayerObject(2)
  MediaPlayerObject(2).FileName = FileName
  If Repeat = True Then
    MediaPlayerObject(2).PlayCount = 0
  Else
    MediaPlayerObject(2).PlayCount = 1
  End If
  MediaPlayerObject(2).Play
End Sub

Sub StopSound()
  MediaPlayerObject(2).Stop
  MediaPlayerObject(2).FileName = ""
  Action.UnloadControl MediaPlayerObject(2)
End Sub


Put this in the Advanced TAB of the frame

Code: Select all
PlaySound GetPath(2) + "The_Actual_Song_Name.mp3", False


Make sure the song u want is copied from areas folder to External Folder

Hopefully this will do it..for you..:P

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Lyberodoggy » Wed Oct 22, 2008 8:02 am

You can send it to me too.. I suspect there's a bug with the Getpath() function


Try this code in debug during runtime of your game (right click-> debug-> execute VBS) to check if it's allright:

filename=Getpath(2)+"your file's name.extention"
Msgbox filename


It should say sth like C:\Program Files\Adventure Maker\Projects\projectname\external\your file's name.extention

If not, there is the problem. That's if you have placed the file in the External folder...
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby sugawara » Fri Oct 24, 2008 12:45 pm

ahhh! in the code, the global procedures i havent actually changed the "filename" just in the second code that has the "filename.mp3" so i will try that, but it still seems odd that just doing it normally in channel 1 of audio tab doesnt seem to work. but ill definately try, it and get back to you all, thankyou very much. also, where would i send 20 megs? how would i send it? split it in two 10 meg files and send it via msn? or something better?
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am

Postby mercedes » Fri Oct 24, 2008 12:49 pm

Suga..u don't change whats in the Global procedures..only in what u put in the Frames advanced..The global procedures u copy and paste as is..

to send the file...u upload it to a site where either one of us can download

http://www.mediafire.com

try there..:)

Peace
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby sugawara » Thu Oct 30, 2008 5:17 am

whooo, ok something strange happened. i installed AM on my desktop and brought my project over to it, and low and behold the music worked! i had it in channel 1 and bam! i tested it and it worked! so i wonder why it wouldnt work on my laptop? i know my sound was turned on, but it never played the music file during the test, wierd it works the normal way without VB on my destop and not at all on my laptop.

anyhow, the project is then as done as i wanted to make it (im onto the next project, thanks to all the help from everyone it went very quick), i am uploading the exe file and i will put a thread in the forum under finished projects, if you want you can take a look at my "nihon university in mishima tour"

let me know what you think!

edit: i through the link to the file under the the thread "nihon university..." in the general discussion forum.
sugawara
Active Member
 
Posts: 90
Joined: Sat Oct 28, 2006 4:25 am


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests