ok guys a question, can this be done or has it already been done, or can someone point me in the right direction (be aware i an a total newbie with action script)
i have a main swf movie about 600px x 400 px
what i want is this to run for say 30 seconds, then i want a countdown timer in the bottom corner for say 10 seconds, after this i want it to randomly load another swf file over the top of the original, and then the timer repeats for 10 seconds and repates the random loading of another swf file over the top etc, etc, etc
so whats the best way around this
It's possible. If you're comfortable with the basic syntax and grammar of AS3, then after adding the following topics to your toolbox, you should be ready.
1) Timers
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Timer.html
2) Loaders
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/Loader.html
3) Math.random()
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Math.html
In summary what I'd suggest would be to:
set up a Timer which fires every N seconds
when it fires, use a Loader to start loading a file whose file-name has been either generated or retrieved using a random number
Related
I want to make a looper similar to this website https://learningmusic.ableton.com/
users will be able to upload their own audio files to each pad, so long as all the loops are in the same bpm it should sound concise.
I'm having a problem figuring out how to sync the audio files together.
For example, if one loop is playing and I click on another loop, there should be a delay for when the new loop starts playing, similar to this example https://tonejs.github.io/examples/daw
I think what I need tone.js might have, but I'm having a hard time implementing it in code.
Should I take the longest loop and have the length of that be the baseline for the track? And then turn the length into bars so I can have a reference of when to start the next loop played?
any resources or help would be amazing!!! thanks
I've got a little side project going on using SDL2/SDL_mixer and a couple other sound libraries. I've been trying for a while now to synchronize my audio and video but haven't been able to get it anywhere near successfully. All new to this stuff so forgive the poorman's logic and coding. At first I thought to set the delay to SDL_Delay(30) after every frame, and then a few other numbers in that range. Not quite right. Then I tried doing it by getting Ticks. Where I would get the difference between current_ticks and last_ticks and set a delay if the delta between ticks was <=30 and set the delay to 30-delta. Still not quite right (by far). Hoping someone on here with more experience might guide me in the right direction. In regards to the video, it's a visualizer of course, seems like a popular beginners project.
The basic way you synchronize audio and video is that you choose one to use as a timer source and present the other according to that timer. The easiest is generally audio, but because it's generally buffered ahead, you need some method of measuring what time in the audio stream is actually coming out of the speakers. Once you get that, it's just a matter of waiting until the audio reaches the right time for the next video frame and displaying it.
In the following post Sleep a random time in with iMacros, works on FireFox/Chrome plugin
it describes how to add RANDOM time to replays.
My question: Is there a way to add a SPECIFIC amount of time to each replay either via the macro file or batch file.... such as it plays the first time at say 6pm, then the second time it plays same time the next day PLUS 2 minutes (so 6:02pm) then the third day another 2 minutes added (6:04pm) ??
Im running the macro from a batch file, so I could put it in there if there is a way.... ?? any ideas?
Yes.
But for this you need JavaScript scripting and a use of Date() objest in JS. Also look at this.
How do I get the current time only in JavaScript
I have both a 20 second audio file and a 60 second video file. I only want to include these once, but need different start/end times for them in various <MediaElement>s.
For example, on my page one I need the seconds 2-13 of the audio file and on page two I need the first 10 seconds (0-9). On page three I need seconds 12-18. I'd really prefer not to have 3 different audio files, just a set of start/end values for the portion of audio/video file.
I see .Position for a start time, but what about an end time that doesn't have to hook an event to stop itself? Also, I'm not sure what the XAML for .Position would look like as there is no sample of that on MSDN.
Any thoughts?
Found a great way to do this on this thread: Silverlight: Expose audio with specific start and stop times
I'm attempting to use a large number of short sound samples in a game I'm creating in Silverlight 2. The samples are less than 2 seconds long.
I would prefer to load all the audio samples onto the canvas during the initualization. I have been adding the media element to the canvas and a generic list to manage it. So far, it appears to work.
When I play the sample the first time, it plays perfectly. If it has finished playing and I want to re-use the same element, it cuts off the first part of the sound. To play the sample again, I stop and play the media element.
Is there another method I should use the samples so that the audio is not clipped and good performance is obtained?
Also, it's probably a good idea to make sure that all of your audio samples are brought down to the client side initially. Depending on how you set it up, it's possible that the MediaElements are using their progressive download functionality to get the media files from the server. While there's nothing wrong with this per se (browser caching should be helping you out after the initial download), it does mean that you have to deal with the browser cache, and there are some potential issues there.
Possible steps to try:
Mark your audio files as "Content". This will get them balled up in the .xap.
Load your audio files into MemoryStreams (see Application.GetResourceStream method) and call MediaElement.SetSource().
HTH,
Erik
Some comments:
From MSDN:
Try to limit the number of MediaElement objects you have in your application at once. If you have over one hundred MediaElement objects in your application tree, regardless of whether they are playing concurrently or not, MediaFailed events may be raised. The way to work around this is to add MediaElement objects to the tree as they are needed and remove them when they are not.
You could try to seek to the start of the sample to reset the point currently being played before re-using it with:
mediaelement.Position = new TimeSpan();
See also MSDNs MediaElement.Position.
One techique you can use, although I'm not sure how well it will work in Silverlight, is create one large file with all of your samples joined together (probably with a half-second or so of silence between each). Figure out the timecode for each sample and seek the media element to that position and play. You'll only need as many media elements as simultaneous sounds you want to play.