Page 1 of 1
Audio/Music/Sound
Posted: Tue Oct 08, 2013 7:07 pm
by foolmoron
Is there any integrated way of playing sounds and music in this engine? Maybe I'm blind but I could not find anything that handled it.
Re: Audio/Music/Sound
Posted: Sun Oct 13, 2013 9:06 am
by foolmoron
I'm assuming the best way to handle this is using an external library such as SoundJS to play audio?
Re: Audio/Music/Sound
Posted: Sun Oct 13, 2013 11:35 am
by coolbloke1324
foolmoron wrote:I'm assuming the best way to handle this is using an external library such as SoundJS to play audio?
Hey ya,
I've been pondering sound support for a while now. There are many libs already available including the one that GoldFire wrote for CasinoRPG called "Howler.js".
I'm considering the benefit vs the work since other libs are already available. What are your thoughts on a built-in one?
Re: Audio/Music/Sound
Posted: Sun Oct 13, 2013 1:32 pm
by Xaleph
If I may pitch in, there are some excellent (modulair) audio libraries available which can, if done right, be integrated quite easily. I`m not sure how you feel about sharing credit, but there are some excellent libraries out there. If you create a wrapper for a good one, it can feel integrated while you only implement an interface for an existing library.
Not the best out there, but quite a simple one is:
http://buzz.jaysalvat.com/, I simply created a wrapper at the time but it worked quite well.
Re: Audio/Music/Sound
Posted: Mon Oct 14, 2013 3:09 pm
by foolmoron
I don't think there would be too great of a benefit to an integrated system. There are so many sound libraries that it might be best just to let the developer pick whichever one fits the needs of the game. And sound generally going to be completely separate from the scene graph, so I don't see what you would do with an integrated sound system anyways, beyond just a wrapper.
Although for beginners, if there was a recommended sound library with an example, that would be useful. I saw Buzz before and it looked great. Howler looks really awesome, too, especially the sound sprites. I might go with that.
Re: Audio/Music/Sound
Posted: Mon Oct 14, 2013 9:54 pm
by robaldred
Personally I'd invest time elsewhere in the engine Rob. I've been using createjs's soundjs fine with ige. There's really no need for another library, unless of course howler was integrated I suppose.
I've not used it howler though so cannot comment.
But I'm a fan of
soundJS from the createJS suite by Grant Skinner
There's also
Sound Manager 2
I've used both, much prefer the soundJS, I wrote a little wrapper class which I use in all my html games, its by no means perfect but it works fine with IGE.
SoundManager source (coffeescript)
https://gist.github.com/raldred/6982954
Use it by first getting the soundmanager instance in your ige client
Code: Select all
this.sound_manager = SoundManager.getInstance()
load a sound using either (supports fallback types seperated by | (pipe):
Code: Select all
ige.client.sound_manager.registerMusic("path/to/music.ogg|path/to/music.mp4","intro")
ige.client.sound_manager.registerMusic("path/to/level1.ogg|path/to/level1.mp4","level1")
ige.client.sound_manager.registerMusic("path/to/level2.ogg|path/to/level2.mp4","level2")
load fx with:
Code: Select all
ige.client.sound_manager.registerFX("path/to/explosion.ogg|path/to/explosion.mp4","explosion")
ige.client.sound_manager.registerFX("path/to/select.ogg|path/to/select.mp4","select")
Then play sfx use the following:
Code: Select all
ige.client.sound_manager.playFX("explosion")
To play music: (music will fade from the currently playing track)
Code: Select all
ige.client.sound_manager.playMusic("level1")