rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.
MIT License
1.88k stars 160 forks source link

Adding attenuation to a Wad for 3D Panning? #110

Closed frastlin closed 5 years ago

frastlin commented 5 years ago

Hello, I have some objects I want a 10 point attenuation on and some I want a 50 point attenuation on. How do I set attenuation on a Wad? Thanks,

rserota commented 5 years ago

If I'm understanding you correctly, it sounds like you need to set the refDistance? Wad.js doesn't support this currently, but I could probably add that feature without too much trouble.

frastlin commented 5 years ago

I think I want: https://developer.mozilla.org/en-US/docs/Web/API/PannerNode/rolloffFactor I'm not exactly sure what the difference is between the two though. I want a sound to be completely quiet 10 squares away, but the other sounds to be quiet how they are currently.

rserota commented 5 years ago

In version 4.6.0 you can now pass any parameters for 3d panning, including rolloffFactor and refDistance, into the wad constructor, or into the play() method. This is mentioned briefly in the docs

frastlin commented 5 years ago

It would be nice if you said explicitly the attributes and their default values for rolloffFactor, refDistance, and other attributes, because I don't have the panning node documentation open when I'm using Wad, and I like to know the defaults Wad has set.