JakobKallin / RPG-Ambience

Bring your tabletop RPGs to life with sound and visuals.
http://rpg-ambience.com
GNU General Public License v3.0
38 stars 10 forks source link

Ability to crossfade from scene to scene #38

Closed gene1wood closed 11 years ago

gene1wood commented 11 years ago

I haven't figured out how to do this but I may have just misunderstood.

I want to be able to have the audio from scene to scene crossfade from one to the next. I've found a way to get this working but it's clunky, I'm wondering if there's a way to improve this.

Assumptions :

The result of my work around is that I maintain two copies of every scene, one as a foreground and one as a background. This way I can fade between any two scenes by picking the opposite type (foreground for background, background for foreground).

Is there a way to be able to fluidly crossfade from any scene to any other scene?

My use case is that I'm establishing scenes based on theme/emotion of a scene. I've got

Ideally I'd like to be able to setup these scenes (only once, not having 2 copies of each), and just hit a single hotkey to crossfade from one to the next. I'd like to also retain the cool functionality of using background for music and foreground for things like the dragon roar in your example. This would mean being able to crossfade from background to background and then play over the background a foreground sound effect.

JakobKallin commented 11 years ago

You have understood it correctly: there is no built-in way to crossfade between scenes. Playback at the moment is very simple: first the current scene is stopped immediately (even if it's fading out), then the next scene is started. Adding support for crossfading scenes would require this mechanic to become more complex, since two scenes would be playing on the same layer at once. I also don't know at the moment how this functionality could be added to the interface in a simple way, especially in relation to the existing fade functionality.

It can also cause edge cases where the proper behavior is difficult to specify: if a crossfading scene is started while another one is already crossfading in, are all three played simultaneously? Although those problems can probably be solved with some effort, I'm wary of introducing these sorts of cases unless the benefit is considerable.

At this point it's not a prioritized feature, but I would still appreciate suggestions on how it should work and how it could be added to the interface.

JakobKallin commented 11 years ago

I've been thinking some more about this, and I believe it's possible to add seamlessly to the application. Right now, a scene with fading stops any currently playing scene and then fades in. Instead of stopping the old scene, it could fade the old scene out at the same speed as the new scene fades in. To keep it simple, the number of scenes fading at the same time should probably be limited to two, in order to prevent strange edge cases. This would require some changes to the underlying Ambience Stage library, but I think the current interface and adventure files could stay the same.

gene1wood commented 11 years ago

That would be awesome. I've not found a solution so far and have just reverted to playing music which isn't bound to the action in the game for a lack of tools. I tried modifying the code to get what I was looking for but wasn't able to figure out a solution. Thanks for looking at this Jakob

JakobKallin commented 11 years ago

I believe that I have come up with a design that can offer this feature with just a few changes. I will let you know how it goes and hopefully have a version for you to try out within a few days.

Out of curiosity, do your scenes consist of sound and images or just sound?

gene1wood commented 11 years ago

I just use the tool for audio. Audio needs tight coupling to action in the game. Dramatic music starting before the party encounters a bad guy, or after they're encountered him doesn't work.

However, imagery, I find, doesn't need as tight of coupling. If the party encounters some new character and while I'm describing the scene and the new character I rummage around and find the image file and bring it up on the screen for the party, this doesn't seem to be a problem. It also allows me to be more flexible/improvisational.

Since I'm not binding audio to a specific encounter in the game, but instead to a theme/vibe which might occur in any encounter it requires less up front commitment to a game sequence.

JakobKallin commented 11 years ago

I have implemented an experimental version of the feature that you requested. Since I'm not releasing a new version of RPG Ambience just yet, I have put it in a separate unstable part of the website. Let me know what you think!

(Don't mind the warning that pops up when you open the application - this new feature doesn't affect your adventure files; I'm simply putting it there for the future. It's also possible that you will have to explicitly refresh the page in order for the app to load properly.)

Note that all you need to do now in order to crossfade between two scenes is to start a scene with fading while another scene is playing; no need to manually stop the first scene before starting the second scene.

The crossfading feature currently leaves a DOM element behind every time a new scene is started, but this shouldn't affect anything unless you start a very large number of scenes.

JakobKallin commented 11 years ago

I should also mention that this experimental feature currently breaks the foreground/background feature: If you start a foreground scene, you won't be able stop any background scenes that are running, even after stopping the foreground scene.

JakobKallin commented 11 years ago

When you've had a chance to try this out, I would love to hear how it's working out for you.

The issues that I mentioned above have now been fixed in the development branch, which will be published soon, so I'm closing this for now (but you can still use the same thread to leave feedback about the feature).

JakobKallin commented 11 years ago

The new version of RPG Ambience, which includes crossfading without the bugs mentioned above, has now been released. Go to the site in order to use it. (The version available under /unstable/ is now an old version.)

gene1wood commented 11 years ago

I tried it out last week and it works fantastically! Thank you so much for adding this!