-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Audio Visualization #761
Comments
That's cool! Would an example with sound be possible? Maybe the logic is a bit niche. You could create |
shadertoy will eventually support some audio features too. This includes inputs and outputs. It's on my to-do list but requires me to finish the Multipass PR first. So I will gladly look at some references |
This is cool! I'm curious how you synced the live audio with the visualization! |
I have opened a draft PR #765 |
Here, I would like to take a moment to talk about Shadertoy in passing. It's great to see that you are also interested in this and have continued to expand and maintain it, turning it into an independent project. Shadertoy originally started as a small built-in tool and example for wgpu-py that I created out of personal interest. I was fascinated by the concept of "using mathematical formulas to create amazing images" on Shadertoy website, so I set out to replicate some of the magical examples from the Shadertoy website using wgpu and WGSL. After completing the initial version, I did consider adding support for channel inputs and multiple render passes. The functionality wasn't particularly complex to implement, and I even wrote some examples of this case. However, those examples remained on my computer, and those additional features were only noted as to-dos in the code comments. The main reasons for this were:
After taking a break from work and returning, I was delighted to see Shadertoy become an independent project with you maintaining it and planning new features. I initially intended to tidy up my old code and submit some PRs, but noticed that you had already implemented some of these features or had them in your roadmap. I understand that there are different ways to achieve the same capabilities, and everyone has their own approach and architecture. It's important to maintain consistency and completeness in the overall concept of the program, so I didn't proceed further. Recently, I also organized my code a bit and uploaded it to GitHub for reference. :) See: https://github.com/panxinmiao/wgpu-py/blob/shadertoy/wgpu/utils/shadertoy.py |
Here are some examples use channel inputs or multiple render passes: https://github.com/panxinmiao/wgpu-py/blob/shadertoy/examples/shadertoy_glsl_rainforest.py Video_071713.mp4https://github.com/panxinmiao/wgpu-py/blob/shadertoy/examples/shadertoy_glsl_dawn.py Video_071815.mp4https://github.com/panxinmiao/wgpu-py/blob/shadertoy/examples/shadertoy_glsl_mountain.py Video_071925.mp4https://github.com/panxinmiao/wgpu-py/blob/shadertoy/examples/shadertoy_glsl_lover.py Video_072113.mp4In this typical multi channel input and multi rendering passes example (Original is here), The API is used in this way, 😅 : shader = Shadertoy(
main_code,
common_code=common_code,
buffer_a_code=buffer_a_code,
buffer_b_code=buffer_b_code,
buffer_c_code=buffer_c_code,
buffer_d_code=buffer_d_code,
)
shader.buffer_a_pass.channel_0 = shader.buffer_a_pass
shader.buffer_a_pass.channel_3 = shader.buffer_d_pass
shader.buffer_b_pass.channel_0 = shader.buffer_a_pass
shader.buffer_b_pass.channel_1 = shader.buffer_b_pass
shader.buffer_c_pass.channel_0 = shader.buffer_a_pass
shader.buffer_c_pass.channel_1 = shader.buffer_b_pass
shader.buffer_d_pass.channel_0 = shader.buffer_a_pass
shader.buffer_d_pass.channel_1 = shader.buffer_b_pass
shader.buffer_d_pass.channel_2 = shader.buffer_c_pass
shader.buffer_d_pass.channel_3 = shader.buffer_d_pass
shader.main_pass.channel_0 = shader.buffer_a_pass
shader.main_pass.channel_1 = shader.buffer_b_pass
shader.main_pass.channel_2 = shader.buffer_c_pass
shader.main_pass.channel_3 = shader.buffer_d_pass
shader.show() |
Thanks for the references, I will gladly take a look tomorrow. Don't feel discouraged to open PRs or review mine :) |
Closed by #765 |
I've recently written some audio visualization code using pygfx out of interest. It might need some tidying up and refactoring.
I'm wondering if you'd be interested in this kind of audio visualization example in pygfx? Or perhaps as a built-in utility in pygfx?
Something like this: ( Remember to turn on the sound :) )
audio.visualizer.mp4
The text was updated successfully, but these errors were encountered: