Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
Sound

shoottheluck
Registered User
Quote
2019-02-15 21:49:52

Hello Ambiera, niko, and fine folks of this forum!

First, niko thank you so much for sharing CopperLicht and CopperCube! They're both really amazing and a lot of fun. I've worked quite a bit with some of the other JS/WebGL libraries out there and really admire what you've done. CopperLicht coded in a straight-foward way, it's friendly, it's efficient, and it's fast!

Like someone else mentioned, there doesn't seem to be a tutorial or example for making sound with CopperLicht alone (and the documentation for SoundSourceNode is a little thinner than most), so I thought I'd post the way that I've been doing it in the hopes that I can get some feedback if I'm doing it wrong or help someone else out if I'm doing it right.

Had some trouble with whole post so I'm going to break this up...


shoottheluck
Registered User
Quote
2019-02-15 21:52:20

As far as I can tell, after you've started the engine, you need to do at least the following to make a CopperLicht sound from a local source file and then play it:
var sound = new CL3D.SoundSceneNode();
sound.TheSound = CL3D.gSoundManager.getSoundFromSoundName("bell.wav", true);
sound.startSound();

CL3D.gSoundManager is made at startup from CL3D.SoundManager. (Neither it nor the property "TheSound" shows up in the documentation.)

To make it positional (louder when closer and softer when farther away), a few properties needed to be changed from defaults (before startSound):

sound.MinDistance = 100; // default is 0
sound.MaxDistance = 10000000; // default is 0
sound.Volume: 1; // default is 0
yourScene.getRootSceneNode().addChild(sound);
sound.Pos = yourDesiredPositionVect3d;
sound.updateAbsolutePosition();

Anyone else doing this the same way, a different way, a better way? Let me know. Thanks!


niko
Moderator
Quote
2019-02-18 08:01:18

Yes, that's how it works, but you can also always just use the HTML audio API. The sound manager in CopperLicht is only there so that it can play back sounds from CopperCube, usually not intended for puplic use. But of course, if it works for you, just use it.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact