Jump to content

Position of noisy mesh relative to hero for Audio


JackFalcon
 Share

Recommended Posts

Hello,

      Evaluating Web Audio API, for 3D sound, mixed HowlerJS with BJS without realizing: Oh, Babylon.Sound ... ? Whylookathat, lots of sound! : )

      Thanks to answer below, with links. I will head that way.

       Related question is  around WebAudio API AudioContext and ->

                     compressors, oscillators, reverb, etc. with JS! +1. 

                            That should all be available through the AudioContext in Web Audio API... if there is an example. If not. I'll dig down, figure it out, and put it here.... : )

       Applying 3D Sound with BABYLON.Sound. : )

Cheers.

 

 

 

 

     

Link to comment
Share on other sites

This does not answer your question, but I don't know if you have seen sound.attachToMesh(), which accomplishes what you are trying to do position-wise. Maybe you can copy that?

https://github.com/BabylonJS/Babylon.js/blob/7ff79d4805ccbad6f169bf9961c1376c7cff1908/src/Audio/babylon.sound.ts  (line 519)

https://doc.babylonjs.com/classes/2.5/sound#attachtomesh-meshtoconnectto-rarr-void

 

Link to comment
Share on other sites

Thank you Mr. brianzinn,

~ Babylon.Sound(!?!): https://doc.babylonjs.com/overviews/playing_sounds_and_music

Look 3D sound... : ) cool.  

Remembers two-step process: 1) open file babylon_v3.0_max.js 2) read... sound! :)

Reading through .max.js is really nice...

Moves to corner... I'll  dig over near that... world conversion to local, matrix transformation mathmatification...real quick

before checking out BABYLON.Sound = Sound; thanks...  

RelatedQuestion: ctx.createOscillator, compressor, filter, delay, convolver... <searches-source-code>...</>

~++/--: )

 

Link to comment
Share on other sites

Solution: Babylon.Sound, is pretty great. Even more so after comparison. Sound interface is nicer than others.

Here is solution to noisy mesh in relation to hero:

var assetsManager = new BABYLON.AssetsManager(scene);

var binaryTask3 = assetsManager.addBinaryFileTask("snd3task", "../audio/CC/zap1.wav");
binaryTask3.onSuccess = function (task) {
    soundObj3 = new BABYLON.Sound("zap1", task.data, scene, null, { loop: true, volume: 2.5, 
        spatialSound: true, 
        distanceModel: "exponential", //"inverse"
        maxDistance: 10, //distance to 0 volume.
        rolloffFactor: 2 });
}

assetsManager.load();

soundObj3.setPosition(noisyMesh1.position);

This simplification was also nice(via brianzinn):

soundObj3.attachToMesh(noisyMesh1);

in the tutorial, here:

https://doc.babylonjs.com/overviews/playing_sounds_and_music

Cheers.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...