Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playing audio with pythreejs? #339

Open
nthiery opened this issue Oct 25, 2020 · 2 comments
Open

Playing audio with pythreejs? #339

nthiery opened this issue Oct 25, 2020 · 2 comments

Comments

@nthiery
Copy link

nthiery commented Oct 25, 2020

I have tried to reproduce the following threejs example in
pythreejs, but with no success yet:

https://threejs.org/docs/#api/en/audio/Audio

import pythreejs
audioLoader = pythreejs.AudioLoader()
audioLoader.load("http://nicolas.thiery.name/sol.ogg")
AttributeError: 'AudioLoader' object has no attribute 'load'

Similarly, the Audio constructor takes no argument, etc.

Has anyone managed to play sound with pythreejs?

@vidartf
Copy link
Member

vidartf commented Nov 10, 2020

The audio classes have not been specced out yet:

Audio: {
relativePath: './audio/Audio',
},
AudioAnalyser: {
relativePath: './audio/AudioAnalyser',
},
AudioBuffer: {
relativePath: './audio/AudioBuffer',
},
AudioListener: {
relativePath: './audio/AudioListener',
},
PositionalAudio: {
relativePath: './audio/PositionalAudio',
},

For context: Is there a reason to prefer the pythreejs audio over IPython.display.Audio or ipywebrtc ?

@nthiery
Copy link
Author

nthiery commented Nov 11, 2020

Hi Vidar! Thanks for the feedback.

Context: I am building a widget to display and analyze musical juggling patterns.
To this end, I am toying out with threejs's animation capabilities (with AnimationClip ...)
to animate the balls moving in the air. It's pretty fun to play with these capabilities!

Now, for the musical aspect, I need to play audio at certain times in the animation.
This called for a pythreejs solution, but other option would certainly do.

If at all possible, I would like a solution that can be controlled purely from the
Python side. For simplicity of deployment; because I am very slow at anything
javascript; and also to empower the end users for whom Python is already a
serious step.

The most versatile tool would be the ability to setup a callback to Python at
certain times in the animation. Does pythreejs enable something like this?

Tips most welcome :-)

(sorry for the topic deviation in this issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants