mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.77k stars 35.38k forks source link

THREE.Audio controls? #5972

Closed glennflanagan closed 9 years ago

glennflanagan commented 9 years ago

I'm looking to implement some sound effects into a game and I've been looking into the THREE.Audio object. I've got the sound effect loading into my scene but it just plays on load.

Is there any way of controlling the playback so the sound effect plays on an event of my choosing?

mrdoob commented 9 years ago

Oh! Uh! Yeah, THREE.Audio is pretty limited right now. Shouldn't be hard to implement though! :)

glennflanagan commented 9 years ago

That's cool. I'm pretty novice when it comes to javascript stuff. I'll let you know if I manage to figure it out. :-)

waldenn commented 9 years ago

Perhaps of interest: http://mohayonao.github.io/timbre.js/ https://github.com/mohayonao/timbre.js/

Examples: http://mohayonao.github.io/timbre.js/reich.html http://mohayonao.github.io/timbre.js/satie.html

Used from within the editor: http://threejs.org/editor/#app=https://gist.githubusercontent.com/walden-/98d41536d2e2e431a387/raw/7a7995623856a9d2624c1d4e1ebf942285e8c582/arkanoid.app.json

I found the API and docs a bit confusing, but this is very powerful web audio synthesis stuff. It would be neat to integrate 3D audio in that library and then use it with three.js.

mrdoob: btw: The author of that library lives in Osaka, Japan. I saw on your twitter feed that you visit that country sometimes. Perhaps you could have a chat with him :-)

mrdoob commented 9 years ago

Used from within the editor: http://threejs.org/editor/#app=https://gist.githubusercontent.com/walden-/98d41536d2e2e431a387/raw/7a7995623856a9d2624c1d4e1ebf942285e8c582/arkanoid.app.json

Haha! Wow! Ok, we need a way to include libraries... :)

waldenn commented 9 years ago

Yes. I think jspm & systemjs could be a perfect solution for that. With it we can easily include any JS package out there. When I get some time to hack for fun again...

mrdoob commented 9 years ago

Implemented in #6233.