Dad72 Posted January 30, 2015 Share Posted January 30, 2015 Ok, you reasons. I did this:var sons = null, ogg = music.ogg, mp3 = music.mp3, wav = music.wav;var audio = new Audio(); if(ogg != null && audio.canPlayType("audio/ogg") != "") { sons = new BABYLON.Sound("musicOgg", ogg, scene, null, { loop: true, autoplay: true, spatialSound: true });}else if(mp3 != null && audio.canPlayType("audio/mpeg") != "") { sons = new BABYLON.Sound("mucicMp3", mp3, scene, null, { loop: true, autoplay: true, spatialSound: true });}else if(wav != null && audio.canPlayType("audio/wav") != "") { sons = new BABYLON.Sound("musicWav", wav, scene, null, { loop: true, autoplay: true, spatialSound: true });} jerome 1 Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2015 Author Share Posted January 30, 2015 This is way better. UA Sniffing is the cause of so many problems on the web. It must be avoided as much as possible! Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 30, 2015 Share Posted January 30, 2015 Since video texture supports many kinds of video files, it would be nice to have the same support for audio. Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2015 Author Share Posted January 30, 2015 As for the videos, Babylon.js support as many audio codecs as your browser does. No more, no less. ;-) Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2015 Author Share Posted January 30, 2015 Hello, The Sandbox has been updated to support drag'n'drop and file open of .babylon scenes containing sounds: http://www.babylonjs.com/sandbox. I've finished also the 3DS Max exporter to export sound properties. It now needs to be tested & validated. Bye, David Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 30, 2015 Share Posted January 30, 2015 Yep, video supports only what the browser supports, audio can be the same :-) I'm not really sure what the benefits of ogg are, but if the browser supports it, why not? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 30, 2015 Share Posted January 30, 2015 would like to start integrating webAudio support into Blender. Does anyone knows if Blender has some support for sound? Basically I'm looking to add a sound to the sound as well as to a mesh Quote Link to comment Share on other sites More sharing options...
gryff Posted January 30, 2015 Share Posted January 30, 2015 Does anyone knows if Blender has some support for sound? DK, you can open a window/panel called "Video sequence Editor" (see image below highlighted in red) You can open either a video or an audio file in this window/panel, In the case of an audio file, display its waveform, add more audio, scrub through the audio etc. I have not used it a lot as I usually use Audacity. No idea about adding audio to a mesh though. cheers, gryff Quote Link to comment Share on other sites More sharing options...
davrous Posted January 30, 2015 Author Share Posted January 30, 2015 Yep, video supports only what the browser supports, audio can be the same :-)I'm not really sure what the benefits of ogg are, but if the browser supports it, why not? I don't understand your point. This is already the case. If the browser supports ogg, Babylon.JS will be able to use it. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 30, 2015 Share Posted January 30, 2015 Thanks Gryff. I eventually decided to put sound info into custom babylon.js properties panel:) Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 30, 2015 Share Posted January 30, 2015 I don't understand your point. This is already the case. If the browser supports ogg, Babylon.JS will be able to use it. All I mean is that, as dad72 said, using something like this - new BABYLON.Sound("Audio", ["audio.ogg", "audio.mp3"], scene, null, { loop: true, autoplay: true, spatialSound: true });would be nice. Dad72, WolfKodi and JCPalmer 3 Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted June 21, 2016 Share Posted June 21, 2016 On 1/29/2015 at 5:12 PM, RaananW said: All I mean is that, as dad72 said, using something like this - new BABYLON.Sound("Audio", ["audio.ogg", "audio.mp3"], scene, null, { loop: true, autoplay: true, spatialSound: true }); would be nice. Was this ever added into the framework? Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 21, 2016 Share Posted June 21, 2016 1 hour ago, FlashyGoblin said: Was this ever added into the framework? I think yes. Signature of the function: Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted June 21, 2016 Share Posted June 21, 2016 41 minutes ago, Dad72 said: I think yes. Signature of the function: Sound(name, urlOrArrayBuffer, scene, readyToPlayCallback, options) An ArrayBuffer is different from an Array. https://doc.babylonjs.com/overviews/Playing_sounds_and_music#loading-a-sound-from-an-arraybuffer I don't think it has been implemented. Phaser allows it. (http://phaser.io/examples/v2/audio/play-music) So helpful. It would be great if Babylon did as well. Quote Link to comment Share on other sites More sharing options...
dbawel Posted June 21, 2016 Share Posted June 21, 2016 Hello, On 1/29/2015 at 1:04 PM, davrous said: I don't understand your point. This is already the case. If the browser supports ogg, Babylon.JS will be able to use it. I was going to post this eventually, but haven't yet gotten around to it. So this ppears that this topic might be an appropriate time to mention this. In the past, I've found the most flexible AV file format to be .ogv (.ogg) files, as there was always less time to decompress and faster loading and playback initialized by the HTML video player. However, in the past 2 yeas there has been a substantial change in Chrome and other browsers where the .ogv file format no longer plays. I didn;t notive this as I was also providing the paths to .webm and .mp4 files if the .ogv files wouldn't play. So I just found that Chrome and other browsers no longer play .ogv (.ogg) files on Android as I was testing specific compression dettings for the best optimization, as I often test from time to time to improve performance. So I can no longer play .ogv files on my tablets, and am considering dropping support all together for the .ogv file format. I only currently continue support for legacy issues on older devices and OS versions. So if anyone else has found playback of /ogv files to be a problem, I would like to know what you have discovered as well as any other info I might have missed, So I still list .ogv as the first AV file format to call for a videoTexture to ensure backwards compatability, but perhaps this is no longer useful? Thank you, DB Quote Link to comment Share on other sites More sharing options...
davrous Posted June 22, 2016 Author Share Posted June 22, 2016 Hi @dbawel, This is exactly why I haven't spent time on this feature yet. MP3, even if far from perfect, is now the only format supported by all browsers (Firefox, Chrome/Opera, Safari & IE/Edge). I can't see cases where you need ogg instead of mp3 but I may be wrong. I'm open to feedback. David Quote Link to comment Share on other sites More sharing options...
Dad72 Posted June 22, 2016 Share Posted June 22, 2016 In made Davrous , ogg is lighter for transfer to a server and faster to load, it would be the only advantage . Wav is too heavy, so ogg and mp3 would be good. But I also agree that mp3 is compatible on all browsers may be sufficient, but a ogg file'll also be faster to load in case a browser supports it. Quote Link to comment Share on other sites More sharing options...
FlashyGoblin Posted August 10, 2016 Share Posted August 10, 2016 Has anyone found a work all solution for this issue yet? I would love to discuss! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 10, 2016 Share Posted August 10, 2016 I do like this if necessary. var music = null, fileAudio = null, audio = new Audio(); if(audio.canPlayType("audio/ogg") != "") { fileAudio = "music.ogg"; } else if(audio.canPlayType("audio/mpeg") != "") { fileAudio = "music.mp3"; } else if(audio.canPlayType("audio/wav") != "") { fileAudio = "music.wav"; } music = new BABYLON.Sound("music", fileAudio, scene, null, { loop: true, autoplay: true, spatialSound: true }); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.