PDA

View Full Version : Continuos Loop Sound?



pagedown
09-15-2002, 06:30 PM
I'm working on a project, and i want a Mp3 or Wave Sound to start playing as soon when the intro page comes up and continue throught the project. Is this possible. Currently I have it play on mouse rollover on the banner, but once i rollover again it stops and restarts as to be expected. I also have 5 links and i'm thinking i want the loop to continue thru even if i click a link to one of my pages.. Gosh is this possible?

AGRO
09-15-2002, 08:48 PM
Well this might not be the best idea but it works.

1. I made a flash movie 1px by 1px with nothing in it but a .mp3 that was set to loop 100 times.

2. Then I used SWF Studio v1.0 to make it a transparent .exe with properties set in SWF Studio to exit the .exe with the depresed escape button on the keyboard.

3. Then in AMS OnIntialize I executed the .exe I made from SWF Studio.

You can not see it. It is only 1px by 1px. With the escape button both the AMS and SWF Studio .exe are closed.

Kinda crude but I was in a hurry and it worked.

Corey
09-15-2002, 10:35 PM
Well there's a couple ways to do this. AGRO's is best because with Flash you also have some control over the MP3, i.e. volume, panning, looping, start, stop, etc. But I would modify that method by omitting the step with SWF studio. Simply create a flash movie and plunk your sound down on frame 2 and put a stop action on frame one. That allows you to insert it at design time without having the sound start. Simply add a flash object seek to frame 2 and play (Frame 2 will actually be "frame 1" since AMS's flash frame handling is zero based as per Macromedia's reccomendations) to the page's "On Show" actions area...

In Flash MX you can set your sound to loop up to 99,999 times...

Find an unused area on your page 1 X 1 pixels and insert your flash there, use the override background color feature of AMS if needed to make it fit in, and that's all you need...

You can also do this very easily purely in AMS but there's a small gap of silence when the loop retstarts so it may not work unless your music is 2-3 minutes long and can handle a quick gap like that. To do this simply drag your MP3 into the distribution folder in your distribution bar and then double click on your first page and set "On Initialize" to:

1. MP3 OBJECT > LOAD to load your sound...
2. 1. MP3 OBJECT > SET REPEAT > TRUE to engage looping...
3. MP3 OBJECT > PLAY to get the ball rolling...

Hope that helps...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

TJ_Tigger
09-16-2002, 09:52 AM
Is there a way to have the song not reset if you change pages. When you change pages and come back to the page with the song, it restarts the song.

This is in reference to the MP3 Object method mentioned above.

Lorne
09-16-2002, 10:54 AM
Yes, set a variable to "true" the first time that page is initialized, and then only start playing the music on page open if that variable is false.

pagedown
09-16-2002, 07:27 PM
I had it all down also, and ran into the same problem. It restarts when you come back to the page. On the set variable i assume clicking on variable" Set Variable" change default to True, then i'm lost where to do you set the false expression?

TJ_Tigger
09-16-2002, 07:30 PM
OK,

So sorry to be dense. If I set the actions on the Initialize page to something like

%visit%="false"

On the Show page do something like
If (%visit% = "false")
MP3.Load(song)
MP3.SetRepeat (TRUE)
MP3.Play
%visit%="true"
EndIf

Lorne
09-17-2002, 08:30 AM
Almost right. Just get rid of the part where you set %visit% to false on the page's "On Initialize" event. Otherwise, it will be set to false every time you jump to that page, defeating the entire purpose.

Variables pretty much start out resolving to false (because all strings except the word "true" are considered false, and until you assign a value to a variable, it's just like any other string), so you can leave it unassigned until it gets set to true...or, you could explicitly set it to "false" in the project's "On Initialize" event, so it will only be initialized once.

TJ_Tigger
09-17-2002, 12:34 PM
Here is what I ended up doing and it works well

<IR_ACTIONS_LIST>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition> ! (%visit% = "true")</Condition>
</Action>
<Action name="Load">
<Type>105</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<MP3File>%SrcDir%\song.mp3</MP3File>
<External>1</External>
</Action>
<Action name="Set Repeat">
<Type>132</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Repeat>TRUE</Repeat>
</Action>
<Action name="Play">
<Type>106</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="Set Value">
<Type>6</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%visit%</Variable>
<Value>true</Value>
<Evaluate>0</Evaluate>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
</IR_ACTIONS_LIST>

pagedown
09-17-2002, 05:52 PM
Wow TJ, where did you put all that? I wish i was more on the programming side.......

TJ_Tigger
09-17-2002, 09:03 PM
It is not really that much. Copy that entire txt block and put it in the "On Initialize" event for the start page. It will format itself to look like an earlier post of mine. It worked well. I am now working on adding a button to stop the music, if the person viewing the application doesn't want to hear it or if I have the time I have thought of adding the option of having the person select some other song.

pagedown
09-17-2002, 10:49 PM
Thanks TJ, it worked and i'm cheesing... you have a great idea let me know,something i'd like to add also.. Gosh if i can continue to pull this off the Real-Estate company will be tooooooooo happy.... My only other issue is the jpeg i'm using i need to size correctly witha border around them, anyway thanks

Lorne
09-18-2002, 09:11 AM
BTW, you can change your condition from:

! (%visit% = "true")

to just:

!%visit%

...if you want. /ubbthreads/images/icons/smile.gif They both mean "if %visit% is not true."

%visit% = "true"

...and:

%visit%

...are both exactly the same.

TJ_Tigger
09-18-2002, 02:21 PM
Thankyou for the help again. Anything to simplify.

Is there a way to have AMS play one MP3 and when finished play the next one in line. Rather than looping one song.

Thanks again.

Lorne
09-18-2002, 03:01 PM
Is there a way to have AMS play one MP3 and when finished play the next one in line. Rather than looping one song.

Yep. Just put actions on the MP3 player's "On Song End" event.

The best way is probably to use a Global List of filenames, start with the first one, and on song end, get the next one in the list and play that...or you could just use a delimited list stored in a variable (building the list from whatever's in a certain folder with a "File - Search" action)...the sky's pretty much the limit there.

TJ_Tigger
09-18-2002, 06:23 PM
Can a global list be a variable or does it have to be a file of some sort.

I have done a file.search and created a variable with the list of songs. I am now trying to set the current position in the file to choose which song I want to play.

I appologize with the questions, I am trying to figure some of this out in the users guide too. Are there other free tutorials online about this product?

Thanks

Lorne
09-19-2002, 08:14 AM
Can a global list be a variable or does it have to be a file of some sort.



See "Global List" in the command reference.

TJ_Tigger
09-19-2002, 10:23 AM
Great! That worked smooth.

Thanks for the help.

pagedown
09-19-2002, 10:12 PM
TJ could you post that?

TJ_Tigger
09-20-2002, 08:24 AM
Rather than posting the code here I have attached a .zip file with .txt files in it. Hopefully they are labled clearly. If there are other questions please let me know.

11938-actions for ams.zip (http://www.indigorose.com/ubbthreads/uploads/11938-actions for ams.zip)

pagedown
09-20-2002, 05:20 PM
Thanks TJ

pagedown
09-20-2002, 05:59 PM
Uh-Oh... My project gives me an error now, it tells me it can't find the " file name of my mp3 song" which plays throughout the project it indicates the it can't find it on the "D:\ which is my CD Rom. This happens only after i've burned to a disk and try to test it. Screen comes up and i get the error code with the aforementioned msg.. Helppppppppppppp

TJ_Tigger
09-20-2002, 08:51 PM
What do you have as your action for the On Initialize? Is the file in the correct location? Have you explored the CD to ensure that the burned copy is named the same as in your project. I had a CD that I burned and the software changed the long file names to 8.3 file names so a log of my links were toast.

Just something to check into.

pagedown
09-21-2002, 07:35 AM
This is my file on initialize

<IR_ACTIONS_LIST>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition> ! (%visit% = "true")</Condition>
</Action>
<Action name="Load">
<Type>105</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<MP3File>%SrcDir%\Fourplay - Chant.mp3</MP3File>
<External>1</External>
</Action>
<Action name="Set Repeat">
<Type>132</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Repeat>TRUE</Repeat>
</Action>
<Action name="Play">
<Type>106</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="Set Value">
<Type>6</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%visit%</Variable>
<Value>true</Value>
<Evaluate>0</Evaluate>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
</IR_ACTIONS_LIST>

I have the Mp3 inside the Distribution folder, and also word doc. i had a action set up if the click on the form it would open up a word doc to allow them to request more info, anyway when i build and the files are in the folder. I have the Data Folder Autorun exe, the Autorun txt file, Autorun.apm and it shows my mp3 file and the word doc. It all worked before the new loop info file you supplied, but the other way wouldn't play continously, so i like this new way. I just don't know why it indicates "Could not load mp3 file. file not found 'D:\fourplay-chant.mp3' I click ok and the project comes up and runs but not with any sound........

TJ_Tigger
09-21-2002, 08:29 AM
Does it work when you launch it from your Hard Drive? After you do a build that is?

did you check the CD to ensure that the name is not being converted to an 8.3 format instead of Fourplay - chant.mp3 you would end up with fourpl~1.mp3. And then your like would not work. It may work after a build on your HD but if your burning software converts it it won't work.

Had that happen to me :-/

Another thing I don't know about is will AMS read a file with spaces in the name. You may try renaming the file to Fourplay_chant.mp3 and redo the link on the initialization page rebuild and test.

pagedown
09-21-2002, 08:51 AM
It works from my HD, i'm going to test with the _ instead of- in the file name, and the 8.3format.... I'll be back

pagedown
09-21-2002, 03:53 PM
changed the - to _ and still nothing. I shortend the name to just the mp3 file name an i still get the same error. *&amp;^$#@

TJ_Tigger
09-21-2002, 08:11 PM
Don't know what to tell ya. Seems weird that it would work on your hard drive and not on a CD. I would just make sure that the file is getting burned correctly on CD. Have you browsed the CD to ensure that the file is there and existing where it is supposed to be?

pagedown
09-21-2002, 09:28 PM
TJ,

I got it, thanks for the suggestions. I had to change the Original MP3 with the Underscore Fourplay_Chant.mp3 before i loaded. Then in the load file select and it matched up. I guess It was looking for the Fourplay-Chant.mp3, i only changed it once, forgot it needed two changes...... Thanks, no to figure out the Global List feature

TJ_Tigger
09-24-2002, 09:21 AM
I am glad that you got it working.

Here is my latest string of actions. I got tired of listening to the same song every time I tested my build. So I set a variable to create a random variable and then use that random variable to set position in the global list and then play from the current position. Here it is

<IR_ACTIONS_LIST>
<Action name="IF">
<Type>200</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Condition> !%visit%</Condition>
</Action>
<Action name="Set Random Value">
<Type>65</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%RndValue%</Variable>
<Method>0</Method>
<Maximum>11</Maximum>
<Minimum>0</Minimum>
<Mask/>
</Action>
<Action name="Set Position">
<Type>113</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<TargetList>playlist</TargetList>
<SetType>4</SetType>
<Index>%rndvalue%</Index>
</Action>
<Action name="Get Item">
<Type>112</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<TargetList>playlist</TargetList>
<GetType>0</GetType>
<Index/>
<IndexDelimiter>;;</IndexDelimiter>
<Variable>%FullPath%</Variable>
<VarDelimiter>;;</VarDelimiter>
</Action>
<Action name="Load">
<Type>105</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<MP3File>%fullpath%</MP3File>
<External>1</External>
</Action>
<Action name="Play">
<Type>106</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
<Action name="Set Value">
<Type>6</Type>
<Function>0</Function>
<DTIndentLevel>1</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
<Variable>%visit%</Variable>
<Value>TRUE</Value>
<Evaluate>1</Evaluate>
</Action>
<Action name="END IF">
<Type>201</Type>
<Function>1</Function>
<DTIndentLevel>0</DTIndentLevel>
<Enabled>1</Enabled>
<ErrorHandling>
<UserNotificationMode>2</UserNotificationMode>
<CustomErrorMessage/>
<OnErrorAction>0</OnErrorAction>
<JumpToLabel/>
</ErrorHandling>
</Action>
</IR_ACTIONS_LIST>

yosik
03-02-2003, 09:22 AM
Hi,
I tried the methods quoted in this thread. But what I want is the song to play over pages (with an added bonus to have the sound stop and start again at certain points, like when a media object is launched).
ALL methods, except executing a flash projector, had the song stop when moving from one page to the other (mp3 object, flash object with song embedded...).
Am I missing something?

Thanks
Yossi

Corey
03-02-2003, 11:31 AM
If you are asking for seamless MP3 from page to page which can automatically pause/resume when other objects play I know of no way.

Although as a workaround if you can make your page more dynamic, and therefore contain your app to a specific page you could simulate that pretty well...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

yosik
03-02-2003, 12:16 PM
If you mention it. What would the difference be between having a project broken down between pages and having all of it on one page? sluggish? slow? long delay?

The best way to reslove my problem would be to launch an external flash projector. But how can I close it down when needed (and of course, at the end of the project)?

Thanks
Yossi

Corey
03-02-2003, 12:26 PM
I have no idea how you can control an external projector, not something I would try personally... Seems like you're getting pretty complicated considering the end user will most likely not even notice your great creation. /ubbthreads/images/icons/smile.gif My personal opinion is that you are pursuing something without much end value, but hey whatever works...

So that being said I have never noticed my one page apps getting sluggish... I guess that would depend on the size of the app, but I can't see what would make it sluggish. Think about it though, are you doing anything which will tax the system? If so maybe this isn't a good plan. Not sure...

Another solution would be to build your entire app in Flash then you can just use a sound object... Wish I had more to offer but I'm pretty much out of perspective on this one, best of luck...

P.S. you could always suggest this as a new feature too if you think it's important. Just ask for a universal project background sound which auto-ducks in-app audio events... Who knows? /ubbthreads/images/icons/smile.gif

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

yosik
03-02-2003, 12:45 PM
Thanks for the "good" words :-)
I am not trying to make things complicated. Just to have a nice background music that plays continously, unless something else, using sound has to be active.
I will write it as a suggestion.
Thanks again,
Yossi

Corey
03-02-2003, 01:55 PM
I don't think there's any application/tool in existence which can do that automatically BTW. /ubbthreads/images/icons/smile.gif

Also as years of Flash have taught us, background music is usually unwelcome by the user and should always be optional...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

jscott14
03-06-2003, 01:17 PM
Actually, I think it IS possible to do this under the right circumstances. I've successfully accomplished having a looping mp3 play seamlessly from page to page, pausing when other sound plays, then resuming when the sound is done. Maybe I'm a very special case, but here's how:
My AMS project is created to demo over 100 Flash templates that I've designed. I have pages of thumbnail images of each Flash template. When you click a thumbnail, it starts the executable Flash.
I think it's already been established how to get the mp3 to play from page to page, so I'll skip that part. To make the audio pause, here are the actions for each thumbnail "On Mouse Click":

MP3.Pause
File.Execute ("%SrcDir%\filename.exe","",Wait)
MP3.Play

Basically, you're telling the mp3 to "pause" on mouse click, then you're waiting for the exe file to finish before it goes to the next instruction in the list. Once the exe file has finished (in my case, once the user closes the Flash movie), the next instruction is executed, which says to Play the paused mp3.

This works like a charm for me. I hope it can help you out as well.

enigma1
03-14-2003, 10:11 AM
I've read all down this thread, and a number of people have asked just what I am asking....how to start an Mp3 or Wav playing and have it play continuously through jumps from page to page. I have slavishly tried doing what has been suggested with the 'foreign language' thing (I know NOTHING about programming, and all this ENDIF's and TRUE'S stuff goes right over my head). I don't think I am being unreasonable in asking if ANYONE out there could set out in simple steps just exactly what to do to achieve the desired aim. I say 'simple steps' because that exactly what they'll have to be for ME to understand them /ubbthreads/images/icons/smile.gif) Thanks in anticipation

Worm
03-14-2003, 01:52 PM
Here is a very basic 3 page project with an MP3 that loads and plays from Page 1's On Show event. You can then jump around from page to page and it'll keep playing.

Put you own MP3 in the Distribution folder, and edit the MP3.Load action to load your MP3 and you should be all set.

Download (http://www.warmuskerken.com/ams/mp3play.zip)

sterling
07-29-2003, 01:24 PM
Hi everyone - I'm new to the forum.

Where are we at on this background music issue? Is it possible to have background music playing that pauses for video or flash with audio, and then resumes?

Is there a developer out there with a solution who would be willing to assist over the phone for a fee to make this work?

Thanks - sv@removethis.promomagic.com

Worm
07-29-2003, 02:12 PM
It would be simple enough to do with a MP3 for background. You would manually have to pause the MP3 when the video started, and then use the objects On Stream End to start the music again.